Skip to content

Commit

Permalink
Fix extra devices being enumerated on Tablet creation (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoran56 committed Oct 22, 2021
1 parent a21ae0d commit 579eed5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions examples/input/tablet.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#!/usr/bin/python
# $Id:$

from __future__ import print_function

import pyglet

window = pyglet.window.Window()
Expand Down Expand Up @@ -34,6 +29,7 @@ def on_text(text):
canvas = tablets[i].open(window)
except pyglet.input.DeviceException:
print('Failed to open tablet %d on window' % index)
return

print('Opened %s' % name)

Expand All @@ -46,8 +42,8 @@ def on_leave(cursor):
print('%s: on_leave(%r)' % (name, cursor))

@canvas.event
def on_motion(cursor, x, y, pressure):
print('%s: on_motion(%r, %r, %r, %r)' % (name, cursor, x, y, pressure))
def on_motion(cursor, x, y, pressure, tilt_x, tilt_y):
print('%s: on_motion(%r, %r, %r, %r, %r, %r)' % (name, cursor, x, y, pressure, tilt_x, tilt_y))


@window.event
Expand Down
2 changes: 1 addition & 1 deletion pyglet/input/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def on_leave(self, cursor):
:event:
"""

def on_motion(self, cursor, x, y, pressure):
def on_motion(self, cursor, x, y, pressure, tilt_x, tilt_y):
"""The cursor moved on the tablet surface.
If `pressure` is 0, then the cursor is actually hovering above the
Expand Down
2 changes: 1 addition & 1 deletion pyglet/input/x11_xinput_tablet.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(self, device):
def get_tablets(display=None):
# Each cursor appears as a separate xinput device; find devices that look
# like Wacom tablet cursors and amalgamate them into a single tablet.
valid_names = ('stylus', 'cursor', 'eraser', 'wacom', 'pen', 'pad')
valid_names = ('stylus', 'cursor', 'eraser', 'pen', 'pad')
cursors = []
devices = get_devices(display)
for device in devices:
Expand Down

0 comments on commit 579eed5

Please sign in to comment.