Skip to content

Add wxEVT_CHAR_HOOK event type - #185

Open
trypsynth wants to merge 1 commit into
AllenDang:mainfrom
trypsynth:window-char-hook-event
Open

Add wxEVT_CHAR_HOOK event type#185
trypsynth wants to merge 1 commit into
AllenDang:mainfrom
trypsynth:window-char-hook-event

Conversation

@trypsynth

Copy link
Copy Markdown
Contributor

Summary

  • Adds WXD_EVENT_TYPE_CHAR_HOOK, mapped to wxEVT_CHAR_HOOK, following the same pattern as the existing KEY_DOWN/KEY_UP/CHAR event types.
  • Includes it in wxd_IsKeyboardEvent so the existing KeyEventData helpers (get_key_code, cmd_down, control_down, and so on) work for it.
  • Adds the corresponding EventType::CHAR_HOOK constant on the Rust side.

Motivation

wxEVT_CHAR_HOOK is the standard wxWidgets mechanism for catching a keyboard shortcut at the level of a dialog or frame regardless of which child control currently has focus. A plain KEY_DOWN binding on the top level window only fires when that window itself has focus, not when a child control inside it does, which makes it unsuitable for implementing shortcuts like closing a dialog with Cmd+W. CHAR_HOOK fires before normal key routing and is delivered to the top level window's handler chain first, so it does not have this limitation.

Test plan

  • cargo build -p wxdragon succeeds locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant