Ticket #13611: 0001-Fix-window-behavior-if-default-button-is-present.patch

File 0001-Fix-window-behavior-if-default-button-is-present.patch, 1.2 KB (added by KapiX, 7 years ago)
  • src/kits/interface/Window.cpp

    From e35e003bbf120a678c3b7ade58cf52b6079df69a Mon Sep 17 00:00:00 2001
    From: Kacper Kasper <kacperkasper@gmail.com>
    Date: Tue, 18 Jul 2017 23:15:43 +0200
    Subject: [PATCH] Fix window behavior if default button is present.
    
    * Almost all Enter keystrokes were hijacked without the ability to
      reconfigure.
    * Let apps use these shortcuts.
    ---
     src/kits/interface/Window.cpp | 5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp
    index 4be291ad68..4d10cbc225 100644
    a b BWindow::_DetermineTarget(BMessage* message, BHandler* target)  
    33243324        {
    33253325            // if we have a default button, it might want to hear
    33263326            // about pressing the <enter> key
     3327            const int32 kNonLockModifierKeys = B_SHIFT_KEY | B_COMMAND_KEY
     3328                | B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY;
    33273329            int32 rawChar;
    33283330            if (DefaultButton() != NULL
    33293331                && message->FindInt32("raw_char", &rawChar) == B_OK
    3330                 && rawChar == B_ENTER)
     3332                && rawChar == B_ENTER
     3333                && (modifiers() & kNonLockModifierKeys) == 0)
    33313334                return DefaultButton();
    33323335
    33333336            // supposed to fall through