From 9702d7e8c62c134804e4d91d34d19d93f76a210f Mon Sep 17 00:00:00 2001 From: James Spurin Date: Wed, 3 Aug 2016 20:51:51 +0100 Subject: [PATCH] #3705 Hotkeys broken on macOS servers --- src/lib/platform/OSXScreen.mm | 51 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 28 deletions(-) mode change 100644 => 100755 src/lib/platform/OSXScreen.mm diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm old mode 100644 new mode 100755 index ba2814ef..aea9b87f --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -1282,36 +1282,31 @@ OSXScreen::onKey(CGEventRef event) return true; } - // check for hot key. when we're on a secondary screen we disable - // all hotkeys so we can capture the OS defined hot keys as regular - // keystrokes but that means we don't get our own hot keys either. - // so we check for a key/modifier match in our hot key map. - if (!m_isOnScreen) { - HotKeyToIDMap::const_iterator i = - m_hotKeyToIDMap.find(HotKeyItem(virtualKey, - m_keyState->mapModifiersToCarbon(macMask) - & 0xff00u)); - if (i != m_hotKeyToIDMap.end()) { - UInt32 id = i->second; + // check for hot key + HotKeyToIDMap::const_iterator i = + m_hotKeyToIDMap.find(HotKeyItem(virtualKey, + m_keyState->mapModifiersToCarbon(macMask) + & 0xff00u)); + if (i != m_hotKeyToIDMap.end()) { + UInt32 id = i->second; - // determine event type - Event::Type type; - //UInt32 eventKind = GetEventKind(event); - if (eventKind == kCGEventKeyDown) { - type = m_events->forIPrimaryScreen().hotKeyDown(); - } - else if (eventKind == kCGEventKeyUp) { - type = m_events->forIPrimaryScreen().hotKeyUp(); - } - else { - return false; - } - - m_events->addEvent(Event(type, getEventTarget(), - HotKeyInfo::alloc(id))); - - return true; + // determine event type + Event::Type type; + //UInt32 eventKind = GetEventKind(event); + if (eventKind == kCGEventKeyDown) { + type = m_events->forIPrimaryScreen().hotKeyDown(); } + else if (eventKind == kCGEventKeyUp) { + type = m_events->forIPrimaryScreen().hotKeyUp(); + } + else { + return false; + } + + m_events->addEvent(Event(type, getEventTarget(), + HotKeyInfo::alloc(id))); + + return true; } // decode event type