From 911e91eeebf72417d081e2b0f7e3d4c6db83c37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Marussy?= Date: Mon, 14 Dec 2020 19:49:51 +0100 Subject: [PATCH] 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. --- src/logid/InputDevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/logid/InputDevice.cpp b/src/logid/InputDevice.cpp index cc36e3b..644b907 100644 --- a/src/logid/InputDevice.cpp +++ b/src/logid/InputDevice.cpp @@ -45,7 +45,9 @@ InputDevice::InputDevice(const char* name) ///TODO: Is it really a good idea to enable all events? 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_type(device, EV_REL); for(unsigned int i = 0; i < REL_CNT; i++)