aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys/keyboard_event.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-09 12:42:10 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-09 12:42:10 +0100
commitb0def958c705ffadeca365753f18aa24ebe85e01 (patch)
tree8c7a0fa71d00894715cbf9344ed9ef9b13e29c62 /tools/gsr-global-hotkeys/keyboard_event.h
parent698538ac843e8cf2b82dea0f893a1d35204accb2 (diff)
Dont use dlopen in gsr-global-hotkeys
Diffstat (limited to 'tools/gsr-global-hotkeys/keyboard_event.h')
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.h29
1 files changed, 6 insertions, 23 deletions
diff --git a/tools/gsr-global-hotkeys/keyboard_event.h b/tools/gsr-global-hotkeys/keyboard_event.h
index 9904237..cd5e119 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.h
+++ b/tools/gsr-global-hotkeys/keyboard_event.h
@@ -12,30 +12,13 @@
/* POSIX */
#include <sys/poll.h>
-/* LINUX */
+/* Linux */
#include <linux/input-event-codes.h>
-#define MAX_EVENT_POLLS 32
-
-typedef struct {
- union {
- int type;
- unsigned char data[192];
- };
-} XEvent;
+/* System */
+#include <X11/Xlib.h>
-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;
+#define MAX_EVENT_POLLS 32
typedef enum {
KEYBOARD_MODKEY_LALT = 1 << 0,
@@ -72,7 +55,7 @@ typedef struct {
int uinput_fd;
bool stdout_failed;
keyboard_grab_type grab_type;
- x11_context x_context;
+ Display *display;
hotplug_event hotplug_ev;
@@ -90,7 +73,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, x11_context x_context);
+bool keyboard_event_init(keyboard_event *self, bool poll_stdout_error, bool exclusive_grab, keyboard_grab_type grab_type, Display *display);
void keyboard_event_deinit(keyboard_event *self);
/* If |timeout_milliseconds| is -1 then wait until an event is received */