mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Map some specific high keycodes into the FK20-23 range
These mappings have been part of xkeyboard-config for over a decade and the likely reason they were introduced is that the corresponding evdev keycode is > 255. Let's forcibly remap those in the driver here so the rest of the system can switch to the real keycodes instead of having to map them to the whatever X expects. See https://github.com/systemd/systemd/pull/34325/ Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/10>
This commit is contained in:
12
src/evdev.c
12
src/evdev.c
@@ -282,7 +282,7 @@ EvdevNextInQueue(InputInfoPtr pInfo)
|
||||
void
|
||||
EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
||||
{
|
||||
int code = ev->code + MIN_KEYCODE;
|
||||
int code = ev->code;
|
||||
EventQueuePtr pQueue;
|
||||
|
||||
/* Filter all repeated events from device.
|
||||
@@ -290,10 +290,18 @@ EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
||||
if (value == 2)
|
||||
return;
|
||||
|
||||
/* keycodes > 256 that have a historical mapping in xkeyboard-config */
|
||||
switch (code) {
|
||||
case KEY_TOUCHPAD_TOGGLE: code = KEY_F21; break;
|
||||
case KEY_TOUCHPAD_ON: code = KEY_F22; break;
|
||||
case KEY_TOUCHPAD_OFF: code = KEY_F23; break;
|
||||
case KEY_MICMUTE: code = KEY_F20; break;
|
||||
}
|
||||
|
||||
if ((pQueue = EvdevNextInQueue(pInfo)))
|
||||
{
|
||||
pQueue->type = EV_QUEUE_KEY;
|
||||
pQueue->detail.key = code;
|
||||
pQueue->detail.key = code + MIN_KEYCODE;
|
||||
pQueue->val = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user