|
|
@ -18,25 +18,31 @@ e_code_stylus_pressure = 24 |
|
|
|
# evcode_finger_ypos = 54 |
|
|
|
# evcode_finger_ypos = 54 |
|
|
|
# evcode_finger_pressure = 58 |
|
|
|
# evcode_finger_pressure = 58 |
|
|
|
|
|
|
|
|
|
|
|
stylus_width = 15725 |
|
|
|
# wacom digitizer dimensions |
|
|
|
stylus_height = 20951 |
|
|
|
# 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_width = 767 |
|
|
|
# finger_height = 1023 |
|
|
|
# finger_height = 1023 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# remap wacom coordinates in various orientations |
|
|
|
# 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': |
|
|
|
if orientation == 'bottom': |
|
|
|
y = stylus_height - y |
|
|
|
y = wacom_height - y |
|
|
|
elif orientation == 'right': |
|
|
|
elif orientation == 'right': |
|
|
|
x, y = y, x |
|
|
|
x, y = wacom_height - y, wacom_width - x |
|
|
|
stylus_width, stylus_height = stylus_height, stylus_width |
|
|
|
wacom_width, wacom_height = wacom_height, wacom_width |
|
|
|
elif orientation == 'left': |
|
|
|
elif orientation == 'left': |
|
|
|
x, y = stylus_height - y, stylus_width - x |
|
|
|
x, y = y, x |
|
|
|
stylus_width, stylus_height = stylus_height, stylus_width |
|
|
|
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': |
|
|
|
if mode == 'fill': |
|
|
|
scaling = max(ratio_width, ratio_height) |
|
|
|
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) |
|
|
|
scaling = min(ratio_width, ratio_height) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
scaling * (x - (stylus_width - monitor.width / scaling) / 2), |
|
|
|
scaling * (x - (wacom_width - monitor.width / scaling) / 2), |
|
|
|
scaling * (y - (stylus_height - monitor.height / 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: |
|
|
|
if new_x and new_y: |
|
|
|
mapped_x, mapped_y = remap( |
|
|
|
mapped_x, mapped_y = remap( |
|
|
|
x, y, |
|
|
|
x, y, |
|
|
|
stylus_width, stylus_height, |
|
|
|
wacom_width, wacom_height, |
|
|
|
monitor, args.orientation, |
|
|
|
monitor, args.orientation, |
|
|
|
args.mode |
|
|
|
args.mode |
|
|
|
) |
|
|
|
) |
|
|
|