diff options
Diffstat (limited to 'qxt-mini/qxtglobalshortcut_mac.cpp')
-rw-r--r-- | qxt-mini/qxtglobalshortcut_mac.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/qxt-mini/qxtglobalshortcut_mac.cpp b/qxt-mini/qxtglobalshortcut_mac.cpp index d7cd7f84..571a6783 100644 --- a/qxt-mini/qxtglobalshortcut_mac.cpp +++ b/qxt-mini/qxtglobalshortcut_mac.cpp @@ -49,13 +49,14 @@ OSStatus qxt_mac_handle_hot_key(EventHandlerCallRef nextHandler, EventRef event, { Q_UNUSED(nextHandler); Q_UNUSED(data); - if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed) + if (GetEventClass(event) == kEventClassKeyboard && (GetEventKind(event) == kEventHotKeyPressed || GetEventKind(event) == kEventHotKeyReleased)) { EventHotKeyID keyID; GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(keyID), NULL, &keyID); Identifier id = keyIDs.key(keyID.id); - if(id != Identifier()) - QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first, true); + if(id != Identifier()) { + QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first, GetEventKind(event) == kEventHotKeyPressed); + } } return noErr; } @@ -233,10 +234,12 @@ bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativ if (!qxt_mac_handler_installed) { qxt_mac_handler_installed = true; - EventTypeSpec t; - t.eventClass = kEventClassKeyboard; - t.eventKind = kEventHotKeyPressed; - InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 1, &t, NULL, NULL); + EventTypeSpec t[2]; + t[0].eventClass = kEventClassKeyboard; + t[0].eventKind = kEventHotKeyPressed; + t[1].eventClass = kEventClassKeyboard; + t[1].eventKind = kEventHotKeyReleased; + InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 2, t, NULL, NULL); } EventHotKeyID keyID; @@ -263,7 +266,7 @@ bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nat return !UnregisterEventHotKey(ref); } bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType, - void *message, long *result) + void *message, qintptr *result) { return false; } |