From 2eb51e5f798df0006bee4e58e8279838f9e49ff8 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 25 Dec 2017 18:14:56 +0200 Subject: [PATCH] Disabled modifier keys processing in UI by Cocoa backend Modifier keys no longer trigger bound actions in menu/console/chat --- src/posix/cocoa/i_input.mm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 7eda4785df..745b0c6dca 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -588,6 +588,12 @@ void ProcessKeyboardEvent(NSEvent* theEvent) void ProcessKeyboardFlagsEvent(NSEvent* theEvent) { + if (GUICapture) + { + // Ignore events from modifier keys in menu/console/chat + return; + } + static const uint32_t FLAGS_MASK = NSDeviceIndependentModifierFlagsMask & ~NSNumericPadKeyMask; @@ -601,23 +607,15 @@ void ProcessKeyboardFlagsEvent(NSEvent* theEvent) } event_t event = {}; - event.type = modifiers > oldModifiers ? EV_KeyDown : EV_KeyUp; event.data1 = ModifierToDIK(deltaModifiers); oldModifiers = modifiers; - // Caps Lock is a modifier key which generates one event per state change - // but not per actual key press or release. So treat any event as key down - // Also its event should be not be posted in menu and console - if (DIK_CAPITAL == event.data1) { - if (GUICapture) - { - return; - } - + // Caps Lock is a modifier key which generates one event per state change + // but not per actual key press or release. So treat any event as key down event.type = EV_KeyDown; }