Also check for shiftable shortcuts in the virtual key code case
This commit is contained in:
parent
1a374a7678
commit
aab121b35d
@ -592,6 +592,11 @@ build_global_shortcuts_lookup(void) {
|
|||||||
/* NSLog(@"global_shortcuts: %@", global_shortcuts); */
|
/* NSLog(@"global_shortcuts: %@", global_shortcuts); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_shiftable_shortcut(int scv) {
|
||||||
|
return scv == kSHKMoveFocusToActiveOrNextWindow || scv == kSHKMoveFocusToNextWindow;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
is_active_apple_global_shortcut(NSEvent *event) {
|
is_active_apple_global_shortcut(NSEvent *event) {
|
||||||
if (global_shortcuts == nil) build_global_shortcuts_lookup();
|
if (global_shortcuts == nil) build_global_shortcuts_lookup();
|
||||||
@ -610,7 +615,7 @@ is_active_apple_global_shortcut(NSEvent *event) {
|
|||||||
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
||||||
if (sc != nil) {
|
if (sc != nil) {
|
||||||
int scv = [sc intValue];
|
int scv = [sc intValue];
|
||||||
if (scv == kSHKMoveFocusToActiveOrNextWindow || scv == kSHKMoveFocusToNextWindow) return scv;
|
if (is_shiftable_shortcut(scv)) return scv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,6 +625,13 @@ is_active_apple_global_shortcut(NSEvent *event) {
|
|||||||
snprintf(lookup_key, sizeof(lookup_key) - 1, "v:%lx:%ld", (unsigned long)modifierFlags, (long)vk);
|
snprintf(lookup_key, sizeof(lookup_key) - 1, "v:%lx:%ld", (unsigned long)modifierFlags, (long)vk);
|
||||||
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
||||||
if (sc != nil) return [sc intValue];
|
if (sc != nil) return [sc intValue];
|
||||||
|
// the move to next window shortcuts also respond to the same shortcut + shift so check for that
|
||||||
|
snprintf(lookup_key, sizeof(lookup_key) - 1, "v:%lx:%ld", (unsigned long)(modifierFlags & ~NSEventModifierFlagShift), (long)vk);
|
||||||
|
sc = global_shortcuts[@(lookup_key)];
|
||||||
|
if (sc != nil) {
|
||||||
|
int scv = [sc intValue];
|
||||||
|
if (is_shiftable_shortcut(scv)) return scv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return kSHKUnknown;
|
return kSHKUnknown;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user