aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys/hotplug.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-12-16 02:21:38 +0100
committerdec05eba <dec05eba@protonmail.com>2024-12-16 02:21:38 +0100
commitebd8c2726b8caac6adc00cf15c5631e51d05ba1f (patch)
treefb60d1908154aeec0ff6b568b269e97b9601d70b /tools/gsr-global-hotkeys/hotplug.h
parent970d87975b01cd083749179df489477b94a35f41 (diff)
Rewrite linux global hotkey to not depend on any libraries (also allows it to work on non-systemd systems(?)), remove unused gsr-window-name
Diffstat (limited to 'tools/gsr-global-hotkeys/hotplug.h')
-rw-r--r--tools/gsr-global-hotkeys/hotplug.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/gsr-global-hotkeys/hotplug.h b/tools/gsr-global-hotkeys/hotplug.h
new file mode 100644
index 0000000..665485a
--- /dev/null
+++ b/tools/gsr-global-hotkeys/hotplug.h
@@ -0,0 +1,22 @@
+#ifndef HOTPLUG_H
+#define HOTPLUG_H
+
+/* C stdlib */
+#include <stdbool.h>
+
+typedef struct {
+ int fd;
+ bool event_is_add;
+ bool subsystem_is_input;
+ char event_data[1024];
+} hotplug_event;
+
+typedef void (*hotplug_device_added_callback)(const char *devname, void *userdata);
+
+bool hotplug_event_init(hotplug_event *self);
+void hotplug_event_deinit(hotplug_event *self);
+
+int hotplug_event_steal_fd(hotplug_event *self);
+void hotplug_event_process_event_data(hotplug_event *self, int fd, hotplug_device_added_callback callback, void *userdata);
+
+#endif /* HOTPLUG_H */