Enable fewer EV_KEY events in InputDevice

Fixes #166

Starting with systemd 247 (?), desktop environments fail to recognize
the virtual input device if it has too many enabled libinput events.

It seems like KEY_ROTATE_LOCK_TOGGLE as the highest enabled event is a
good limit. This is the highest evdev event mapped by xkb, so the
usefulness higher events is limited, anyways.
This commit is contained in:
Kristóf Marussy 2020-12-14 19:49:51 +01:00
parent c261b6582c
commit 911e91eeeb
No known key found for this signature in database
GPG Key ID: 59E156E31028BA29

View File

@ -45,7 +45,9 @@ InputDevice::InputDevice(const char* name)
///TODO: Is it really a good idea to enable all events? ///TODO: Is it really a good idea to enable all events?
libevdev_enable_event_type(device, EV_KEY); libevdev_enable_event_type(device, EV_KEY);
for(unsigned int i = 0; i < KEY_CNT; i++) // KEY_ROTATE_LOCK_TOGGLE is the highest key mapped by
// /usr/share/X11/xkb/keycodes/evdev
for(unsigned int i = 0; i <= KEY_ROTATE_LOCK_TOGGLE; i++)
libevdev_enable_event_code(device, EV_KEY, i, nullptr); libevdev_enable_event_code(device, EV_KEY, i, nullptr);
libevdev_enable_event_type(device, EV_REL); libevdev_enable_event_type(device, EV_REL);
for(unsigned int i = 0; i < REL_CNT; i++) for(unsigned int i = 0; i < REL_CNT; i++)