aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-05-03 12:03:43 +0200
committerdec05eba <dec05eba@protonmail.com>2025-05-03 12:03:43 +0200
commitd08ea692771caa8e385412c2f992089672773e30 (patch)
tree994c05673d90b130e25d8bc25c6c365f607134db /tools
parent180a3b73dbab2f586c53f9e5f044ab88aca95014 (diff)
Keep keyboard led when turning on global hotkeys, move files
Diffstat (limited to 'tools')
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c
index bcfae6b..c7a54c3 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.c
+++ b/tools/gsr-global-hotkeys/keyboard_event.c
@@ -404,8 +404,10 @@ 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);
+ if(self->event_polls[index].fd > 0) {
+ ioctl(self->event_polls[index].fd, EVIOCGRAB, 0);
+ close(self->event_polls[index].fd);
+ }
free(self->event_extra_data[index].key_states);
free(self->event_extra_data[index].key_presses_grabbed);
@@ -435,7 +437,7 @@ static int setup_virtual_keyboard_input(const char *name) {
success &= (ioctl(fd, UI_SET_EVBIT, EV_KEY) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_REP) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_REL) != -1);
- success &= (ioctl(fd, UI_SET_EVBIT, EV_LED) != -1);
+ //success &= (ioctl(fd, UI_SET_EVBIT, EV_LED) != -1);
success &= (ioctl(fd, UI_SET_MSCBIT, MSC_SCAN) != -1);
for(int i = 1; i < KEY_MAX; ++i) {
@@ -445,9 +447,9 @@ static int setup_virtual_keyboard_input(const char *name) {
for(int i = 0; i < REL_MAX; ++i) {
success &= (ioctl(fd, UI_SET_RELBIT, i) != -1);
}
- for(int i = 0; i < LED_MAX; ++i) {
- success &= (ioctl(fd, UI_SET_LEDBIT, i) != -1);
- }
+ // for(int i = 0; i < LED_MAX; ++i) {
+ // success &= (ioctl(fd, UI_SET_LEDBIT, i) != -1);
+ // }
// success &= (ioctl(fd, UI_SET_EVBIT, EV_ABS) != -1);
// success &= (ioctl(fd, UI_SET_ABSBIT, ABS_X) != -1);
@@ -566,8 +568,10 @@ 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);
+ if(self->event_polls[i].fd > 0) {
+ ioctl(self->event_polls[i].fd, EVIOCGRAB, 0);
+ close(self->event_polls[i].fd);
+ }
free(self->event_extra_data[i].key_states);
free(self->event_extra_data[i].key_presses_grabbed);
}