macOS: When checking for global shortcuts handle shifted form of cmd+`
This commit is contained in:
parent
c3c7ad78c1
commit
396906860d
@ -602,6 +602,18 @@ is_active_apple_global_shortcut(NSEvent *event) {
|
|||||||
snprintf(lookup_key, sizeof(lookup_key) - 1, "c:%lx:%ld", (unsigned long)modifierFlags, (long)ch);
|
snprintf(lookup_key, sizeof(lookup_key) - 1, "c:%lx:%ld", (unsigned long)modifierFlags, (long)ch);
|
||||||
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
||||||
if (sc != nil) return [sc intValue];
|
if (sc != nil) return [sc intValue];
|
||||||
|
if (modifierFlags & NSEventModifierFlagShift) {
|
||||||
|
// the move to next window shortcuts also respond to the same shortcut + shift so check for that
|
||||||
|
const uint32_t ch_without_shift = vk_to_unicode_key_with_current_layout([event keyCode]);
|
||||||
|
if (ch_without_shift < GLFW_FKEY_FIRST || ch_without_shift > GLFW_FKEY_LAST) {
|
||||||
|
snprintf(lookup_key, sizeof(lookup_key) - 1, "c:%lx:%ld", (unsigned long)(modifierFlags & ~NSEventModifierFlagShift), (long)ch_without_shift);
|
||||||
|
NSNumber *sc = global_shortcuts[@(lookup_key)];
|
||||||
|
if (sc != nil) {
|
||||||
|
int scv = [sc intValue];
|
||||||
|
if (scv == kSHKMoveFocusToActiveOrNextWindow || scv == kSHKMoveFocusToNextWindow) return scv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unsigned short vk = [event keyCode];
|
unsigned short vk = [event keyCode];
|
||||||
if (vk != 0xffff) {
|
if (vk != 0xffff) {
|
||||||
|
|||||||
1
glfw/cocoa_platform.h
vendored
1
glfw/cocoa_platform.h
vendored
@ -249,3 +249,4 @@ void _glfwShutdownCVDisplayLink(unsigned long long, void*);
|
|||||||
void _glfwCocoaPostEmptyEvent(void);
|
void _glfwCocoaPostEmptyEvent(void);
|
||||||
void _glfw_create_cv_display_link(_GLFWDisplayLinkNS *entry);
|
void _glfw_create_cv_display_link(_GLFWDisplayLinkNS *entry);
|
||||||
_GLFWDisplayLinkNS* _glfw_create_display_link(CGDirectDisplayID);
|
_GLFWDisplayLinkNS* _glfw_create_display_link(CGDirectDisplayID);
|
||||||
|
uint32_t vk_to_unicode_key_with_current_layout(uint16_t keycode);
|
||||||
|
|||||||
@ -259,7 +259,7 @@ is_pua_char(uint32_t ch) {
|
|||||||
return (0xE000 <= ch && ch <= 0xF8FF) || (0xF0000 <= ch && ch <= 0xFFFFF) || (0x100000 <= ch && ch <= 0x10FFFF);
|
return (0xE000 <= ch && ch <= 0xF8FF) || (0xF0000 <= ch && ch <= 0xFFFFF) || (0x100000 <= ch && ch <= 0x10FFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
uint32_t
|
||||||
vk_to_unicode_key_with_current_layout(uint16_t keycode)
|
vk_to_unicode_key_with_current_layout(uint16_t keycode)
|
||||||
{
|
{
|
||||||
UInt32 dead_key_state = 0;
|
UInt32 dead_key_state = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user