Skip to content

Commit

Permalink
Import pull request #108
Browse files Browse the repository at this point in the history
  • Loading branch information
RonaldH-Parsec committed Jun 30, 2023
1 parent e030e0c commit 6252d31
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/unix/apple/macosx/app.m
Original file line number Diff line number Diff line change
Expand Up @@ -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->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))
ctx->app->event_func(&evt, ctx->app->opaque);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 6252d31

Please sign in to comment.