|
|
|
|
@ -18,25 +18,31 @@ e_code_stylus_pressure = 24
|
|
|
|
|
# evcode_finger_ypos = 54
|
|
|
|
|
# evcode_finger_pressure = 58
|
|
|
|
|
|
|
|
|
|
stylus_width = 15725
|
|
|
|
|
stylus_height = 20951
|
|
|
|
|
# wacom digitizer dimensions
|
|
|
|
|
# FIXME - I found these limits experimentally. We can probably get the
|
|
|
|
|
# exact values off the filesystem somewhere
|
|
|
|
|
wacom_width = 15725
|
|
|
|
|
wacom_height = 20951
|
|
|
|
|
# touchscreen dimensions
|
|
|
|
|
# finger_width = 767
|
|
|
|
|
# finger_height = 1023
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# remap wacom coordinates in various orientations
|
|
|
|
|
def remap(x, y, stylus_width, stylus_height, monitor, orientation, mode):
|
|
|
|
|
def remap(x, y, wacom_width, wacom_height, monitor, orientation, mode):
|
|
|
|
|
|
|
|
|
|
if orientation == 'vertical':
|
|
|
|
|
y = stylus_height - y
|
|
|
|
|
if orientation == 'bottom':
|
|
|
|
|
y = wacom_height - y
|
|
|
|
|
elif orientation == 'right':
|
|
|
|
|
x, y = y, x
|
|
|
|
|
stylus_width, stylus_height = stylus_height, stylus_width
|
|
|
|
|
x, y = wacom_height - y, wacom_width - x
|
|
|
|
|
wacom_width, wacom_height = wacom_height, wacom_width
|
|
|
|
|
elif orientation == 'left':
|
|
|
|
|
x, y = stylus_height - y, stylus_width - x
|
|
|
|
|
stylus_width, stylus_height = stylus_height, stylus_width
|
|
|
|
|
x, y = y, x
|
|
|
|
|
wacom_width, wacom_height = wacom_height, wacom_width
|
|
|
|
|
elif orientation == 'top':
|
|
|
|
|
x = wacom_width - x
|
|
|
|
|
|
|
|
|
|
ratio_width, ratio_height = monitor.width / stylus_width, monitor.height / stylus_height
|
|
|
|
|
ratio_width, ratio_height = monitor.width / wacom_width, monitor.height / wacom_height
|
|
|
|
|
|
|
|
|
|
if mode == 'fill':
|
|
|
|
|
scaling = max(ratio_width, ratio_height)
|
|
|
|
|
@ -44,8 +50,8 @@ def remap(x, y, stylus_width, stylus_height, monitor, orientation, mode):
|
|
|
|
|
scaling = min(ratio_width, ratio_height)
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
scaling * (x - (stylus_width - monitor.width / scaling) / 2),
|
|
|
|
|
scaling * (y - (stylus_height - monitor.height / scaling) / 2)
|
|
|
|
|
scaling * (x - (wacom_width - monitor.width / scaling) / 2),
|
|
|
|
|
scaling * (y - (wacom_height - monitor.height / scaling) / 2)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -99,7 +105,7 @@ def read_tablet(args, remote_device):
|
|
|
|
|
if new_x and new_y:
|
|
|
|
|
mapped_x, mapped_y = remap(
|
|
|
|
|
x, y,
|
|
|
|
|
stylus_width, stylus_height,
|
|
|
|
|
wacom_width, wacom_height,
|
|
|
|
|
monitor, args.orientation,
|
|
|
|
|
args.mode
|
|
|
|
|
)
|
|
|
|
|
|