From 014f90cbffa69598eca98065a046479d5fd0a0fa Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 16 Dec 2024 21:51:09 +0100 Subject: Ungrab before closing event fd --- tools/gsr-global-hotkeys/keyboard_event.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/gsr-global-hotkeys/keyboard_event.c') 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; -- cgit v1.2.3