aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-12-16 21:51:09 +0100
committerdec05eba <dec05eba@protonmail.com>2024-12-16 21:51:09 +0100
commit014f90cbffa69598eca98065a046479d5fd0a0fa (patch)
treefaaf7ac106b6ec44b309208897efd8751cbcea8f
parent14b0d376a8191a8873b1f866a3cfe777bbe091ce (diff)
Ungrab before closing event fd
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c
index 86b7248..0106638 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.c
+++ b/tools/gsr-global-hotkeys/keyboard_event.c
@@ -203,7 +203,9 @@ static void keyboard_event_remove_event(keyboard_event *self, int index) {
if(index < 0 || index >= self->num_event_polls)
return;
+ ioctl(self->event_polls[index].fd, EVIOCGRAB, 0);
close(self->event_polls[index].fd);
+
for(int j = index + 1; j < self->num_event_polls; ++j) {
self->event_polls[j - 1] = self->event_polls[j];
self->event_extra_data[j - 1] = self->event_extra_data[j];
@@ -319,6 +321,7 @@ void keyboard_event_deinit(keyboard_event *self) {
}
for(int i = 0; i < self->num_event_polls; ++i) {
+ ioctl(self->event_polls[i].fd, EVIOCGRAB, 0);
close(self->event_polls[i].fd);
}
self->num_event_polls = 0;