From 02a17d51bd6cfe04d1046b0a0738c3d7a7802df5 Mon Sep 17 00:00:00 2001 From: Tobi Date: Sun, 27 Feb 2022 16:11:07 +0100 Subject: [PATCH] Copy props to the forwarded UInput (#319) --- inputremapper/gui/editor/editor.py | 3 ++- inputremapper/injection/injector.py | 13 +++++++++---- inputremapper/input_event.py | 4 ++-- tests/test.py | 3 +++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/inputremapper/gui/editor/editor.py b/inputremapper/gui/editor/editor.py index 6e126c0b..587776a2 100644 --- a/inputremapper/gui/editor/editor.py +++ b/inputremapper/gui/editor/editor.py @@ -323,7 +323,8 @@ class Editor: logger.debug("Disabling the text input") text_input = self.get_text_input() - # beware that this also disables event listeners like focus-out-event: + # beware that this also appeared to disable event listeners like + # focus-out-event: text_input.set_sensitive(False) text_input.set_opacity(0.5) diff --git a/inputremapper/injection/injector.py b/inputremapper/injection/injector.py index d4ef7629..ec713c0f 100644 --- a/inputremapper/injection/injector.py +++ b/inputremapper/injection/injector.py @@ -325,13 +325,18 @@ class Injector(multiprocessing.Process): coroutines = [] for source in sources: - # certain capabilities can have side effects apparently. with an - # EV_ABS capability, EV_REL won't move the mouse pointer anymore. - # so don't merge all InputDevices into one UInput device. + # copy as much information as possible, because libinput uses the extra + # information to enable certain features like "Disable touchpad while + # typing" forward_to = evdev.UInput( name=get_udev_name(source.name, "forwarded"), - phys=DEV_NAME, events=self._copy_capabilities(source), + phys=source.phys, + vendor=source.info.vendor, + product=source.info.product, + version=source.info.version, + bustype=source.info.bustype, + input_props=source.input_props(), ) # actually doing things diff --git a/inputremapper/input_event.py b/inputremapper/input_event.py index 796cbfc1..1d2f413c 100644 --- a/inputremapper/input_event.py +++ b/inputremapper/input_event.py @@ -118,9 +118,9 @@ class InputEvent: def __str__(self): if self.type == evdev.ecodes.EV_KEY: - key_name = evdev.ecodes.bytype[self.type].get(self.code, self.code) + key_name = evdev.ecodes.bytype[self.type].get(self.code, "unknown") action = "down" if self.value == 1 else "up" - return f"" + return f"" return f"" diff --git a/tests/test.py b/tests/test.py index 5f9d7388..55246639 100644 --- a/tests/test.py +++ b/tests/test.py @@ -425,6 +425,9 @@ class InputDevice: return result + def input_props(self): + return [] + uinputs = {}