<div dir="ltr"><div>I find it hard to believe this is what client programs will want. A painting program wants the axis of an elongated brush to be perpendicular to the tilt will work correctly only if *both* axes are flipped (as your code appears to be doing). But it will get "which edge is nearer" backward if it wants to draw something asymmetric in the direction the pen is tilted. And it also seems to make little sense to flip the vertical tilt for a left-handed user.<br><br></div>Or are you perhaps undoing some flip that the tablet is doing internally?<br><br><div><div><div class="gmail_extra"><div class="gmail_quote">On Sun, Dec 20, 2015 at 5:46 PM, Peter Hutterer <span dir="ltr"><<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>><br>
---<br>
src/evdev-tablet.c | 4 ++++<br>
test/tablet.c | 38 ++++++++++++++++++++++++++++++++++++++<br>
2 files changed, 42 insertions(+)<br>
<br>
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c<br>
index bf61411..50891e3 100644<br>
--- a/src/evdev-tablet.c<br>
+++ b/src/evdev-tablet.c<br>
@@ -365,6 +365,8 @@ tablet_handle_tilt(struct tablet_dispatch *tablet,<br>
if (bit_is_set(tablet->changed_axes, a)) {<br>
absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_X);<br>
tablet->axes[a] = normalize_tilt(absinfo);<br>
+ if (device->left_handed.enabled)<br>
+ tablet->axes[a] *= -1;<br>
}<br>
tilt.x = tablet->axes[a];<br>
<br>
@@ -372,6 +374,8 @@ tablet_handle_tilt(struct tablet_dispatch *tablet,<br>
if (bit_is_set(tablet->changed_axes, a)) {<br>
absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_Y);<br>
tablet->axes[a] = normalize_tilt(absinfo);<br>
+ if (device->left_handed.enabled)<br>
+ tablet->axes[a] *= -1;<br>
}<br>
tilt.y = tablet->axes[a];<br>
<br>
diff --git a/test/tablet.c b/test/tablet.c<br>
index a55b60a..87af814 100644<br>
--- a/test/tablet.c<br>
+++ b/test/tablet.c<br>
@@ -1018,6 +1018,43 @@ START_TEST(no_left_handed)<br>
}<br>
END_TEST<br>
<br>
+START_TEST(left_handed_tilt)<br>
+{<br>
+#if HAVE_LIBWACOM<br>
+ struct litest_device *dev = litest_current_device();<br>
+ struct libinput *li = dev->libinput;<br>
+ struct libinput_event *event;<br>
+ struct libinput_event_tablet_tool *tev;<br>
+ enum libinput_config_status status;<br>
+ struct axis_replacement axes[] = {<br>
+ { ABS_DISTANCE, 10 },<br>
+ { ABS_TILT_X, 90 },<br>
+ { ABS_TILT_Y, 10 },<br>
+ { -1, -1 }<br>
+ };<br>
+ double tx, ty;<br>
+<br>
+ status = libinput_device_config_left_handed_set(dev->libinput_device, 1);<br>
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);<br>
+<br>
+ litest_drain_events(li);<br>
+<br>
+ litest_tablet_proximity_in(dev, 10, 10, axes);<br>
+ libinput_dispatch(li);<br>
+ event = libinput_get_event(li);<br>
+ tev = litest_is_tablet_event(event,<br>
+ LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);<br>
+ tx = libinput_event_tablet_tool_get_tilt_x(tev);<br>
+ ty = libinput_event_tablet_tool_get_tilt_y(tev);<br>
+<br>
+ ck_assert_double_lt(tx, 0);<br>
+ ck_assert_double_gt(ty, 0);<br>
+<br>
+ libinput_event_destroy(event);<br>
+#endif<br>
+}<br>
+END_TEST<br>
+<br>
START_TEST(motion_event_state)<br>
{<br>
struct litest_device *dev = litest_current_device();<br>
@@ -2852,6 +2889,7 @@ litest_setup_tests(void)<br>
litest_add("tablet:tilt", tilt_x, LITEST_TABLET|LITEST_TILT, LITEST_ANY);<br>
litest_add("tablet:tilt", tilt_y, LITEST_TABLET|LITEST_TILT, LITEST_ANY);<br>
litest_add_for_device("tablet:left_handed", left_handed, LITEST_WACOM_INTUOS);<br>
+ litest_add_for_device("tablet:left_handed", left_handed_tilt, LITEST_WACOM_INTUOS);<br>
litest_add_for_device("tablet:left_handed", no_left_handed, LITEST_WACOM_CINTIQ);<br>
litest_add("tablet:normalization", normalization, LITEST_TABLET, LITEST_ANY);<br>
litest_add("tablet:pad", pad_buttons_ignored, LITEST_TABLET, LITEST_ANY);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div></div></div></div>