Passthrough mouse events

To not block mice that have keys, which end up grabbed due to generic
configurations that simply filter anything that responds to CAPSLOCK/ESC.

Fixes #15
This commit is contained in:
Francisco Lopes 2021-01-01 00:18:03 -03:00
parent 8bfd57eda2
commit 975bb74284
No known key found for this signature in database
GPG Key ID: 2E754CF1886344B5

View File

@ -46,25 +46,23 @@ void write_event(const struct input_event *event) {
}
void write_event_with_mode(struct input_event *event, int mode) {
if (event->type == EV_REL || event->type == EV_ABS)
return;
switch (mode) {
case 0:
if (event->code == KEY_ESC)
event->code = KEY_CAPSLOCK;
break;
case 2:
switch (event->code) {
case KEY_ESC:
event->code = KEY_GRAVE;
break;
case KEY_GRAVE:
if (event->type == EV_KEY)
switch (mode) {
case 0:
if (event->code == KEY_ESC)
event->code = KEY_CAPSLOCK;
break;
}
break;
}
break;
case 2:
switch (event->code) {
case KEY_ESC:
event->code = KEY_GRAVE;
break;
case KEY_GRAVE:
event->code = KEY_CAPSLOCK;
break;
}
break;
}
write_event(event);
}