Files
guru/dev-python/pynput/files/patches/uinput.patch
Dale Showers 157b45a909 dev-python/pynput: add 1.8.2
Add python 14

Signed-off-by: Dale Showers <gentoo@fictx.com>
2026-06-02 15:37:45 -04:00

20 lines
817 B
Diff

diff --git a/lib/pynput/_util/uinput.py b/lib/pynput/_util/uinput.py
index b0a6a78..c891b83 100644
--- a/lib/pynput/_util/uinput.py
+++ b/lib/pynput/_util/uinput.py
@@ -72,6 +72,14 @@ class ListenerMixin(object):
except OSError:
continue
+ # Some programmable mouse devices report each programmable input as
+ # a separate capability, so it is possible for a mouse to exceed
+ # keyboards in capability count; for this reason we will prefer a
+ # device with "keyboard" in its name
+ if 'keyboard' in next_dev.name.lower():
+ dev = next_dev
+ break
+
# Does this device provide more handled event codes?
capabilities = next_dev.capabilities()
next_count = sum(