Skip to content

Commit a15a078

Browse files
X-specifc sleeping is done in libsuinput.
1 parent 34dfc18 commit a15a078

2 files changed

Lines changed: 0 additions & 22 deletions

File tree

examples/hellokbd.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ def main():
1313
keys.add(uinput.KEY_L)
1414
keys.add(uinput.KEY_O)
1515

16-
device.activate()
17-
time.sleep(1) # See examples/mouse.py.
18-
1916
keys.click(uinput.KEY_H)
2017
keys.click(uinput.KEY_E)
2118
keys.click(uinput.KEY_L)

examples/mouse.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,6 @@ def main():
1515
for rel_axis in (uinput.REL_X, uinput.REL_Y, uinput.REL_WHEEL):
1616
rel_axes.add(rel_axis)
1717

18-
device.activate()
19-
time.sleep(1)
20-
# This magic sleep needs to be taken under X because of the way
21-
# how X assigns handlers for new devices:
22-
23-
# 1. Kernel creates an evdev device.
24-
25-
# 2. A dbus signal "DeviceAdded" is sent.
26-
27-
# 3. X's handler assigner catches the dbus event and assigns a
28-
# handler for the new device.
29-
30-
# Now the "problem" is in the asynchronous nature of this whole
31-
# process. Kernel is totally happy once it has created the evdev
32-
# device, but X cannot assign a handler for the new device before
33-
# it receives the dbus signal. Without this delay, kernel would
34-
# generate events before a handler is assigned. Perhaps a better
35-
# way would be to listen to the dbus inside the library?
36-
3718
for i in range(20):
3819
rel_axes.move_by(uinput.REL_X, 5, False)
3920
rel_axes.move_by(uinput.REL_Y, 5)

0 commit comments

Comments
 (0)