[BUGFIX] Fix macOS not properly skipping hotkey registration/unregistration

This commit is contained in:
Rajveer Aujla 2023-01-25 00:14:29 +00:00
parent bd1408d87a
commit 37299c2d2e
1 changed files with 6 additions and 4 deletions

View File

@ -336,7 +336,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask, bool registerGlobalHo
// if this hot key has modifiers only then we'll handle it specially // if this hot key has modifiers only then we'll handle it specially
EventHotKeyRef ref = NULL; EventHotKeyRef ref = NULL;
bool okay; bool okay = true;
if (key == kKeyNone) { if (key == kKeyNone) {
if (m_modifierHotKeys.count(mask) > 0) { if (m_modifierHotKeys.count(mask) > 0) {
// already registered // already registered
@ -381,9 +381,11 @@ OSXScreen::unregisterHotKey(UInt32 id, bool unregisterGlobalHotkey)
} }
// unregister with OS // unregister with OS
bool okay; bool okay = true;
if (unregisterGlobalHotkey && i->second.getRef() != NULL) { if (i->second.getRef() != NULL) {
okay = (UnregisterEventHotKey(i->second.getRef()) == noErr); if (unregisterGlobalHotkey) {
okay = (UnregisterEventHotKey(i->second.getRef()) == noErr);
}
} }
else { else {
okay = false; okay = false;