diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-16 21:51:09 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-16 21:51:09 +0100 |
commit | 014f90cbffa69598eca98065a046479d5fd0a0fa (patch) | |
tree | faaf7ac106b6ec44b309208897efd8751cbcea8f /tools/gsr-global-hotkeys | |
parent | 14b0d376a8191a8873b1f866a3cfe777bbe091ce (diff) |
Ungrab before closing event fd
Diffstat (limited to 'tools/gsr-global-hotkeys')
-rw-r--r-- | tools/gsr-global-hotkeys/keyboard_event.c | 3 |
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; |