From eb5215492378364da4995ecebbfde7ba371281e2 Mon Sep 17 00:00:00 2001 From: Ronald Huveneers <114760413+RonaldH-Parsec@users.noreply.github.com> Date: Mon, 15 May 2023 17:56:32 -0400 Subject: [PATCH 1/3] Test fix. --- src/unix/apple/macosx/app.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/unix/apple/macosx/app.m b/src/unix/apple/macosx/app.m index 77ae7eb69..229d82d21 100644 --- a/src/unix/apple/macosx/app.m +++ b/src/unix/apple/macosx/app.m @@ -797,6 +797,10 @@ static void window_keyboard_event(struct window *ctx, uint16_t key_code, NSEvent mty_app_kb_to_hotkey(ctx->app, &evt, MTY_EVENT_HOTKEY); + // Only use hid keys hotkeys if available. + if (evt.type == MTY_EVENT_HOTKEY && pressed && (ctx->flags & MTY_APP_FLAG_HID_KEYBOARD)) + return; + if ((evt.type == MTY_EVENT_HOTKEY && pressed) || (evt.type == MTY_EVENT_KEY && evt.key.key != MTY_KEY_NONE)) ctx->app->event_func(&evt, ctx->app->opaque); } @@ -1290,9 +1294,6 @@ static void app_hid_key(uint32_t usage, bool down, void *opaque) ctx->hid_kb_mod &= ~mod; } - if (!ctx->grab_kb) - return; - struct window *window = app_get_active_window(ctx); if (!window) return; @@ -1310,6 +1311,13 @@ static void app_hid_key(uint32_t usage, bool down, void *opaque) mty_app_kb_to_hotkey(ctx, &evt, MTY_EVENT_HOTKEY); + if (!ctx->grab_kb) { + if (evt.type == MTY_EVENT_HOTKEY && down) + ctx->event_func(&evt, ctx->opaque); + + return; + } + if ((evt.type == MTY_EVENT_HOTKEY && down) || (evt.type == MTY_EVENT_KEY && evt.key.key != MTY_KEY_NONE)) ctx->event_func(&evt, ctx->opaque); } From e435f2005eebf248f350da32b227013f8cca8518 Mon Sep 17 00:00:00 2001 From: Ronald Huveneers <114760413+RonaldH-Parsec@users.noreply.github.com> Date: Mon, 15 May 2023 18:00:49 -0400 Subject: [PATCH 2/3] Fix. --- src/unix/apple/macosx/app.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/apple/macosx/app.m b/src/unix/apple/macosx/app.m index 229d82d21..c6652f2b7 100644 --- a/src/unix/apple/macosx/app.m +++ b/src/unix/apple/macosx/app.m @@ -798,7 +798,7 @@ static void window_keyboard_event(struct window *ctx, uint16_t key_code, NSEvent mty_app_kb_to_hotkey(ctx->app, &evt, MTY_EVENT_HOTKEY); // Only use hid keys hotkeys if available. - if (evt.type == MTY_EVENT_HOTKEY && pressed && (ctx->flags & MTY_APP_FLAG_HID_KEYBOARD)) + if (evt.type == MTY_EVENT_HOTKEY && pressed && (ctx->app.flags & MTY_APP_FLAG_HID_KEYBOARD)) return; if ((evt.type == MTY_EVENT_HOTKEY && pressed) || (evt.type == MTY_EVENT_KEY && evt.key.key != MTY_KEY_NONE)) From ed01b78fee25f9e9d2d9c3aebbd3100c286f3393 Mon Sep 17 00:00:00 2001 From: Ronald Huveneers <114760413+RonaldH-Parsec@users.noreply.github.com> Date: Mon, 15 May 2023 18:05:31 -0400 Subject: [PATCH 3/3] fix. --- src/unix/apple/macosx/app.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/apple/macosx/app.m b/src/unix/apple/macosx/app.m index c6652f2b7..aa9f9f690 100644 --- a/src/unix/apple/macosx/app.m +++ b/src/unix/apple/macosx/app.m @@ -798,7 +798,7 @@ static void window_keyboard_event(struct window *ctx, uint16_t key_code, NSEvent mty_app_kb_to_hotkey(ctx->app, &evt, MTY_EVENT_HOTKEY); // Only use hid keys hotkeys if available. - if (evt.type == MTY_EVENT_HOTKEY && pressed && (ctx->app.flags & MTY_APP_FLAG_HID_KEYBOARD)) + if (evt.type == MTY_EVENT_HOTKEY && pressed && (ctx->app->flags & MTY_APP_FLAG_HID_KEYBOARD)) return; if ((evt.type == MTY_EVENT_HOTKEY && pressed) || (evt.type == MTY_EVENT_KEY && evt.key.key != MTY_KEY_NONE))