diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-07 01:15:56 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-07 01:15:56 +0100 |
commit | 9a5c20836a70fd1f1cf9d21fc7e4febfbed38f53 (patch) | |
tree | 422d18e9d2cf22e8c9aff2b60481b451905cad03 /tools/gsr-global-hotkeys/keyboard_event.h | |
parent | ee123ceb0a52331764901386d404a53aead65c23 (diff) |
Try and support different keyboard layouts through x11 xkb mapping
Diffstat (limited to 'tools/gsr-global-hotkeys/keyboard_event.h')
-rw-r--r-- | tools/gsr-global-hotkeys/keyboard_event.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/gsr-global-hotkeys/keyboard_event.h b/tools/gsr-global-hotkeys/keyboard_event.h index 0283afd..9904237 100644 --- a/tools/gsr-global-hotkeys/keyboard_event.h +++ b/tools/gsr-global-hotkeys/keyboard_event.h @@ -17,6 +17,26 @@ #define MAX_EVENT_POLLS 32 +typedef struct { + union { + int type; + unsigned char data[192]; + }; +} XEvent; + +typedef unsigned long (*XKeycodeToKeysym_FUNC)(void *display, unsigned char keycode, int index); +typedef int (*XPending_FUNC)(void *display); +typedef int (*XNextEvent_FUNC)(void *display, XEvent *event_return); +typedef int (*XRefreshKeyboardMapping_FUNC)(void* event_map); + +typedef struct { + void *display; + XKeycodeToKeysym_FUNC XKeycodeToKeysym; + XPending_FUNC XPending; + XNextEvent_FUNC XNextEvent; + XRefreshKeyboardMapping_FUNC XRefreshKeyboardMapping; +} x11_context; + typedef enum { KEYBOARD_MODKEY_LALT = 1 << 0, KEYBOARD_MODKEY_RALT = 1 << 2, @@ -52,6 +72,7 @@ typedef struct { int uinput_fd; bool stdout_failed; keyboard_grab_type grab_type; + x11_context x_context; hotplug_event hotplug_ev; @@ -69,7 +90,7 @@ typedef struct { /* Return true to allow other applications to receive the key input (when using exclusive grab) */ typedef bool (*key_callback)(uint32_t key, uint32_t modifiers, int press_status, void *userdata); -bool keyboard_event_init(keyboard_event *self, bool poll_stdout_error, bool exclusive_grab, keyboard_grab_type grab_type); +bool keyboard_event_init(keyboard_event *self, bool poll_stdout_error, bool exclusive_grab, keyboard_grab_type grab_type, x11_context x_context); void keyboard_event_deinit(keyboard_event *self); /* If |timeout_milliseconds| is -1 then wait until an event is received */ |