On Mon, Dec 21, 2015 at 10:12:24AM -0800, Bill Spitzak wrote: > 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. > > Or are you perhaps undoing some flip that the tablet is doing internally?
a tablet in left-handed mode is effectively rotated by 180 degrees to bring the set of buttons towards the side of the nondominant hand. this inverts x and y, if we don't also invert tilt the client program will think that the pen is tilted in the opposite direction. symmetrical tablets don't have a left-handed mode. Cheers, Peter > On Sun, Dec 20, 2015 at 5:46 PM, Peter Hutterer <peter.hutte...@who-t.net> > wrote: > > > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> > > --- > > src/evdev-tablet.c | 4 ++++ > > test/tablet.c | 38 ++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 42 insertions(+) > > > > diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c > > index bf61411..50891e3 100644 > > --- a/src/evdev-tablet.c > > +++ b/src/evdev-tablet.c > > @@ -365,6 +365,8 @@ tablet_handle_tilt(struct tablet_dispatch *tablet, > > if (bit_is_set(tablet->changed_axes, a)) { > > absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_X); > > tablet->axes[a] = normalize_tilt(absinfo); > > + if (device->left_handed.enabled) > > + tablet->axes[a] *= -1; > > } > > tilt.x = tablet->axes[a]; > > > > @@ -372,6 +374,8 @@ tablet_handle_tilt(struct tablet_dispatch *tablet, > > if (bit_is_set(tablet->changed_axes, a)) { > > absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_Y); > > tablet->axes[a] = normalize_tilt(absinfo); > > + if (device->left_handed.enabled) > > + tablet->axes[a] *= -1; > > } > > tilt.y = tablet->axes[a]; > > > > diff --git a/test/tablet.c b/test/tablet.c > > index a55b60a..87af814 100644 > > --- a/test/tablet.c > > +++ b/test/tablet.c > > @@ -1018,6 +1018,43 @@ START_TEST(no_left_handed) > > } > > END_TEST > > > > +START_TEST(left_handed_tilt) > > +{ > > +#if HAVE_LIBWACOM > > + struct litest_device *dev = litest_current_device(); > > + struct libinput *li = dev->libinput; > > + struct libinput_event *event; > > + struct libinput_event_tablet_tool *tev; > > + enum libinput_config_status status; > > + struct axis_replacement axes[] = { > > + { ABS_DISTANCE, 10 }, > > + { ABS_TILT_X, 90 }, > > + { ABS_TILT_Y, 10 }, > > + { -1, -1 } > > + }; > > + double tx, ty; > > + > > + status = > > libinput_device_config_left_handed_set(dev->libinput_device, 1); > > + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); > > + > > + litest_drain_events(li); > > + > > + litest_tablet_proximity_in(dev, 10, 10, axes); > > + libinput_dispatch(li); > > + event = libinput_get_event(li); > > + tev = litest_is_tablet_event(event, > > + LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); > > + tx = libinput_event_tablet_tool_get_tilt_x(tev); > > + ty = libinput_event_tablet_tool_get_tilt_y(tev); > > + > > + ck_assert_double_lt(tx, 0); > > + ck_assert_double_gt(ty, 0); > > + > > + libinput_event_destroy(event); > > +#endif > > +} > > +END_TEST > > + > > START_TEST(motion_event_state) > > { > > struct litest_device *dev = litest_current_device(); > > @@ -2852,6 +2889,7 @@ litest_setup_tests(void) > > litest_add("tablet:tilt", tilt_x, LITEST_TABLET|LITEST_TILT, > > LITEST_ANY); > > litest_add("tablet:tilt", tilt_y, LITEST_TABLET|LITEST_TILT, > > LITEST_ANY); > > litest_add_for_device("tablet:left_handed", left_handed, > > LITEST_WACOM_INTUOS); > > + litest_add_for_device("tablet:left_handed", left_handed_tilt, > > LITEST_WACOM_INTUOS); > > litest_add_for_device("tablet:left_handed", no_left_handed, > > LITEST_WACOM_CINTIQ); > > litest_add("tablet:normalization", normalization, LITEST_TABLET, > > LITEST_ANY); > > litest_add("tablet:pad", pad_buttons_ignored, LITEST_TABLET, > > LITEST_ANY); > > -- > > 2.5.0 > > > > _______________________________________________ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > > _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel