Fix #232 MACOS serious config file errors - hotkeys totally broken

This commit is contained in:
Chun Wang 2019-06-15 01:52:08 +09:00 committed by Adrian Lucrèce Céleste
parent 6c19a87f63
commit 0f5cdecf51
1 changed files with 16 additions and 29 deletions

View File

@ -1263,36 +1263,23 @@ OSXScreen::onKey(CGEventRef event)
return true; return true;
} }
// check for hot key. when we're on a secondary screen we disable HotKeyToIDMap::const_iterator i = m_hotKeyToIDMap.find(HotKeyItem(virtualKey, m_keyState->mapModifiersToCarbon(macMask) & 0xff00u));
// all hotkeys so we can capture the OS defined hot keys as regular if (i != m_hotKeyToIDMap.end()) {
// keystrokes but that means we don't get our own hot keys either. UInt32 id = i->second;
// so we check for a key/modifier match in our hot key map. // determine event type
if (!m_isOnScreen) { Event::Type type;
HotKeyToIDMap::const_iterator i = //UInt32 eventKind = GetEventKind(event);
m_hotKeyToIDMap.find(HotKeyItem(virtualKey, if (eventKind == kCGEventKeyDown) {
m_keyState->mapModifiersToCarbon(macMask) type = m_events->forIPrimaryScreen().hotKeyDown();
& 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;
} }
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 // decode event type