Skip to content

Commit 364e52b

Browse files
authored
Remove dependency on python-uinput
1 parent dbce56e commit 364e52b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ This table specifies the currently supported display interfaces and how each plu
300300

301301
| Plugin | Device Selector | Display Interfaces | Input Interfaces | Operating Systems | Main Dependencies | Notes |
302302
|---|---|---|---|---|---|---|
303-
| [`ximagesrc`](https://gstreamer.freedesktop.org/documentation/ximagesrc/index.html) | `DISPLAY` environment | X.Org / X11 | [`Xlib`](https://github.com/python-xlib/python-xlib) w/ [`pynput`](https://github.com/moses-palmer/pynput), `uinput` | Linux | Various | N/A |
303+
| [`ximagesrc`](https://gstreamer.freedesktop.org/documentation/ximagesrc/index.html) | `DISPLAY` environment | X.Org / X11 | [`Xlib`](https://github.com/python-xlib/python-xlib) w/ [`pynput`](https://github.com/moses-palmer/pynput) | Linux | Various | N/A |
304304

305305
This table specifies the currently implemented audio encoders and their corresponding codecs. Opus is currently the only adequate media codec supported in web browsers by specification.
306306

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ install_requires =
3434
psutil
3535
watchdog
3636
Pillow
37-
python-uinput @ git+https://github.com/selkies-project/python-uinput.git@0.11.3
3837
python-xlib
3938

4039
[options.packages.find]

src/selkies_gstreamer/webrtc_input.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import base64
2727
import pynput
2828
import io
29-
import uinput
3029
import msgpack
3130
import re
3231
import os
@@ -54,18 +53,25 @@
5453
MOUSE_BUTTON_MIDDLE = 42
5554
MOUSE_BUTTON_RIGHT = 43
5655

56+
UINPUT_BTN_LEFT = (0x01, 0x110)
57+
UINPUT_BTN_MIDDLE = (0x01, 0x112)
58+
UINPUT_BTN_RIGHT = (0x01, 0x111)
59+
UINPUT_REL_X = (0x02, 0x00)
60+
UINPUT_REL_Y = (0x02, 0x01)
61+
UINPUT_REL_WHEEL = (0x02, 0x08)
62+
5763
# Local map for uinput and pynput buttons
5864
MOUSE_BUTTON_MAP = {
5965
MOUSE_BUTTON_LEFT: {
60-
"uinput": uinput.BTN_LEFT,
66+
"uinput": UINPUT_BTN_LEFT,
6167
"pynput": pynput.mouse.Button.left,
6268
},
6369
MOUSE_BUTTON_MIDDLE: {
64-
"uinput": uinput.BTN_MIDDLE,
70+
"uinput": UINPUT_BTN_MIDDLE,
6571
"pynput": pynput.mouse.Button.middle,
6672
},
6773
MOUSE_BUTTON_RIGHT: {
68-
"uinput": uinput.BTN_RIGHT,
74+
"uinput": UINPUT_BTN_RIGHT,
6975
"pynput": pynput.mouse.Button.right,
7076
},
7177
}
@@ -267,8 +273,8 @@ def send_mouse(self, action, data):
267273
if self.uinput_mouse_socket_path:
268274
# Send relative motion to uinput device.
269275
# syn=False delays the sync until the second command.
270-
self.__mouse_emit(uinput.REL_X, x, syn=False)
271-
self.__mouse_emit(uinput.REL_Y, y)
276+
self.__mouse_emit(UINPUT_REL_X, x, syn=False)
277+
self.__mouse_emit(UINPUT_REL_Y, y)
272278
else:
273279
# NOTE: the pynput mouse.move method moves the mouse relative to the current position using its internal tracked position.
274280
# this does not work for relative motion where the input should just be a delta value.
@@ -278,13 +284,13 @@ def send_mouse(self, action, data):
278284
elif action == MOUSE_SCROLL_UP:
279285
# Scroll up
280286
if self.uinput_mouse_socket_path:
281-
self.__mouse_emit(uinput.REL_WHEEL, 1)
287+
self.__mouse_emit(UINPUT_REL_WHEEL, 1)
282288
else:
283289
self.mouse.scroll(0, -1)
284290
elif action == MOUSE_SCROLL_DOWN:
285291
# Scroll down
286292
if self.uinput_mouse_socket_path:
287-
self.__mouse_emit(uinput.REL_WHEEL, -1)
293+
self.__mouse_emit(UINPUT_REL_WHEEL, -1)
288294
else:
289295
self.mouse.scroll(0, 1)
290296
elif action == MOUSE_BUTTON:

0 commit comments

Comments
 (0)