[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libinput: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit 45e5847bf3e755532b2b6a62b74b85fcdadf2e36
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Feb 23 16:13:03 2016 +1000

    configure.ac: libinput 1.2.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 3eec57d..d400f21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
 AC_PREREQ([2.64])
 
 m4_define([libinput_major_version], [1])
-m4_define([libinput_minor_version], [1])
-m4_define([libinput_micro_version], [902])
+m4_define([libinput_minor_version], [2])
+m4_define([libinput_micro_version], [0])
 m4_define([libinput_version],
           [libinput_major_version.libinput_minor_version.libinput_micro_version])
 
@@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
 # b) If interfaces have been changed or added, but binary compatibility has
 #    been preserved, change to C+1:0:A+1
 # c) If the interface is the same as the previous version, change to C:R+1:A
-LIBINPUT_LT_VERSION=17:1:7
+LIBINPUT_LT_VERSION=17:2:7
 AC_SUBST(LIBINPUT_LT_VERSION)
 
 AM_SILENT_RULES([yes])

commit 0e17dc58aa2469909d9e21d889ff119b6170e15a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Feb 18 09:42:27 2016 +1000

    tablet: use the tilt resolution if we have it
    
    A nonzero resolution on the tilt axes is units/rad so we can calculate the
    physical min/max based. Uneven min/max ranges are supported.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 1e5c2cd..22ea1eb 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -231,16 +231,25 @@ adjust_tilt(const struct input_absinfo *absinfo)
 	double value = (absinfo->value - absinfo->minimum) / range;
 	const int WACOM_MAX_DEGREES = 64;
 
-	/* Map to the (-1, 1) range */
-	value = (value * 2) - 1;
-
-	/* Wacom supports physical [-64, 64] degrees, so map to that by
-	 * default. If other tablets have a different physical range or
-	 * nonzero physical offsets, they need extra treatment
-	 * here.
-	 */
+	/* If resolution is nonzero, it's in units/radian. But require
+	 * a min/max less/greater than zero so we can assume 0 is the
+	 * center */
+	if (absinfo->resolution != 0 &&
+	    absinfo->maximum > 0 &&
+	    absinfo->minimum < 0) {
+		value = 180.0/M_PI * absinfo->value/absinfo->resolution;
+	} else {
+		/* Wacom supports physical [-64, 64] degrees, so map to that by
+		 * default. If other tablets have a different physical range or
+		 * nonzero physical offsets, they need extra treatment
+		 * here.
+		 */
+		/* Map to the (-1, 1) range */
+		value = (value * 2) - 1;
+		value *= WACOM_MAX_DEGREES;
+	}
 
-	return value * WACOM_MAX_DEGREES;
+	return value;
 }
 
 static inline int32_t
diff --git a/test/tablet.c b/test/tablet.c
index c5dc892..ad6ac45 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -3298,7 +3298,8 @@ START_TEST(tilt_x)
 	ck_assert_double_ge(tx, -52);
 
 	ty = libinput_event_tablet_tool_get_tilt_y(tev);
-	ck_assert_double_eq(ty, -64);
+	ck_assert_double_ge(ty, -65);
+	ck_assert_double_lt(ty, -63);
 
 	libinput_event_destroy(event);
 
@@ -3320,7 +3321,8 @@ START_TEST(tilt_x)
 		ck_assert_double_le(tx, expected_tx + 2);
 
 		ty = libinput_event_tablet_tool_get_tilt_y(tev);
-		ck_assert_double_eq(ty, -64);
+		ck_assert_double_ge(ty, -65);
+		ck_assert_double_lt(ty, -63);
 
 		libinput_event_destroy(event);
 
@@ -3365,7 +3367,8 @@ START_TEST(tilt_y)
 	ck_assert_double_ge(ty, -52);
 
 	tx = libinput_event_tablet_tool_get_tilt_x(tev);
-	ck_assert_double_eq(tx, -64);
+	ck_assert_double_ge(tx, -65);
+	ck_assert_double_lt(tx, -63);
 
 	libinput_event_destroy(event);
 
@@ -3387,7 +3390,8 @@ START_TEST(tilt_y)
 		ck_assert_double_le(ty, expected_ty + 2);
 
 		tx = libinput_event_tablet_tool_get_tilt_x(tev);
-		ck_assert_double_eq(tx, -64);
+		ck_assert_double_ge(tx, -65);
+		ck_assert_double_lt(tx, -63);
 
 		libinput_event_destroy(event);
 

commit 79139ebcd1cc81eecdd2d0dc6f006fbec4c2c6f2
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Feb 15 17:02:45 2016 +1000

    touchpad: move the tapping exclusion zone to the top edge of the button
    
    We previously used the half-way mark of the touchpad's y axis to decide where
    to ignore tapping. Move this down to the top edge of the software buttons
    instead. Users may tap with a finger in the software button areas, on the rest
    of the touchpad it's unlikely that they tap within 5% of the edge.
    
    On touchpads with physical buttons or if clickfinger is enabled, the
    no-tapping zone extends to the bottom of the touchpad. This required splitting
    the tests into clickfinger, softbuttons and hardbuttons.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=93947
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 912a0f0..95d650a 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -538,9 +538,9 @@ tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t)
 	    t->point.x < tp->palm.right_edge)
 		return false;
 
-	/* We're inside the left/right palm edge and in the northern half of
-	 * the touchpad - this tap is a palm */
-	if (t->point.y < tp->palm.vert_center) {
+	/* We're inside the left/right palm edge and not in one of the
+	 * software button areas */
+	if (t->point.y < tp->buttons.bottom_area.top_edge) {
 		log_debug(tp_libinput_context(tp),
 			  "palm: palm-tap detected\n");
 		return true;
@@ -1824,14 +1824,12 @@ static int
 tp_init_palmdetect(struct tp_dispatch *tp,
 		   struct evdev_device *device)
 {
-	int width, height;
+	int width;
 
 	tp->palm.right_edge = INT_MAX;
 	tp->palm.left_edge = INT_MIN;
-	tp->palm.vert_center = INT_MIN;
 
 	width = device->abs.dimensions.x;
-	height = device->abs.dimensions.y;
 
 	/* Wacom doesn't have internal touchpads */
 	if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
@@ -1845,7 +1843,6 @@ tp_init_palmdetect(struct tp_dispatch *tp,
 	/* palm edges are 5% of the width on each side */
 	tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05;
 	tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05;
-	tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2;
 
 	tp->palm.monitor_trackpoint = true;
 
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 87d34b2..eae327b 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -321,7 +321,6 @@ struct tp_dispatch {
 	struct {
 		int32_t right_edge;		/* in device coordinates */
 		int32_t left_edge;		/* in device coordinates */
-		int32_t vert_center;		/* in device coordinates */
 
 		bool trackpoint_active;
 		struct libinput_event_listener trackpoint_listener;
diff --git a/test/touchpad.c b/test/touchpad.c
index 3574edd..be9c566 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -1031,7 +1031,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_edges)
 }
 END_TEST
 
-START_TEST(touchpad_palm_detect_tap)
+START_TEST(touchpad_palm_detect_tap_hardbuttons)
 {
 	struct litest_device *dev = litest_current_device();
 	struct libinput *li = dev->libinput;
@@ -1051,7 +1051,38 @@ START_TEST(touchpad_palm_detect_tap)
 	litest_touch_up(dev, 0);
 	litest_assert_empty_queue(li);
 
-	litest_touch_down(dev, 0, 5, 90);
+	litest_touch_down(dev, 0, 5, 99);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 95, 99);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_palm_detect_tap_softbuttons)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (!touchpad_has_palm_detect_size(dev))
+		return;
+
+	litest_enable_tap(dev->libinput_device);
+	litest_enable_buttonareas(dev);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 95, 5);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 5, 5);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 5, 99);
 	litest_touch_up(dev, 0);
 	litest_assert_button_event(li,
 				   BTN_LEFT,
@@ -1061,7 +1092,7 @@ START_TEST(touchpad_palm_detect_tap)
 				   LIBINPUT_BUTTON_STATE_RELEASED);
 	litest_assert_empty_queue(li);
 
-	litest_touch_down(dev, 0, 95, 90);
+	litest_touch_down(dev, 0, 95, 99);
 	litest_touch_up(dev, 0);
 	litest_assert_button_event(li,
 				   BTN_LEFT,
@@ -1073,6 +1104,37 @@ START_TEST(touchpad_palm_detect_tap)
 }
 END_TEST
 
+START_TEST(touchpad_palm_detect_tap_clickfinger)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+
+	if (!touchpad_has_palm_detect_size(dev))
+		return;
+
+	litest_enable_tap(dev->libinput_device);
+	litest_enable_clickfinger(dev);
+
+	litest_drain_events(li);
+
+	litest_touch_down(dev, 0, 95, 5);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 5, 5);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 5, 99);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+
+	litest_touch_down(dev, 0, 95, 99);
+	litest_touch_up(dev, 0);
+	litest_assert_empty_queue(li);
+}
+END_TEST
+
 START_TEST(touchpad_left_handed)
 {
 	struct litest_device *dev = litest_current_device();
@@ -3933,7 +3995,9 @@ litest_setup_tests(void)
 	litest_add("touchpad:palm", touchpad_palm_detect_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_ANY);
 	litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY);
 	litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY);
-	litest_add("touchpad:palm", touchpad_palm_detect_tap, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("touchpad:palm", touchpad_palm_detect_tap_hardbuttons, LITEST_TOUCHPAD, LITEST_CLICKPAD);
+	litest_add("touchpad:palm", touchpad_palm_detect_tap_softbuttons, LITEST_CLICKPAD, LITEST_ANY);
+	litest_add("touchpad:palm", touchpad_palm_detect_tap_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
 	litest_add("touchpad:palm", touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD);
 
 	litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);

commit d6b889852abd3e5f238769be55cb4a30e5db6dcb
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Feb 17 09:06:09 2016 +1000

    touchpad: add synaptics semi-mt devices to those needing hysteresis
    
    https://bugs.freedesktop.org/show_bug.cgi?id=94097
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index d8b2334..912a0f0 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1991,17 +1991,28 @@ tp_init_hysteresis(struct tp_dispatch *tp)
 {
 	int res_x, res_y;
 
+	if (tp->device->model_flags & EVDEV_MODEL_CYAPA)
+		goto want_hysteresis;
+
+	if (tp->device->model_flags & EVDEV_MODEL_ALPS_RUSHMORE)
+		goto want_hysteresis;
+
+	if (tp->semi_mt &&
+	    (tp->device->model_flags & EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD))
+		goto want_hysteresis;
+
+	tp->hysteresis_margin.x = 0;
+	tp->hysteresis_margin.y = 0;
+
+	return;
+
+want_hysteresis:
 	res_x = tp->device->abs.absinfo_x->resolution;
 	res_y = tp->device->abs.absinfo_y->resolution;
 
-	if (tp->device->model_flags &
-	    (EVDEV_MODEL_CYAPA|EVDEV_MODEL_ALPS_RUSHMORE)) {
-		tp->hysteresis_margin.x = res_x/2;
-		tp->hysteresis_margin.y = res_y/2;
-	} else {
-		tp->hysteresis_margin.x = 0;
-		tp->hysteresis_margin.y = 0;
-	}
+	tp->hysteresis_margin.x = res_x/2;
+	tp->hysteresis_margin.y = res_y/2;
+	return;
 }
 
 static int

commit cc0c3e85988c25b6f637d27979c93283b8224224
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Feb 15 17:13:01 2016 +1000

    configure.ac: libinput 1.2rc2
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index b20a5c8..3eec57d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
 
 m4_define([libinput_major_version], [1])
 m4_define([libinput_minor_version], [1])
-m4_define([libinput_micro_version], [901])
+m4_define([libinput_micro_version], [902])
 m4_define([libinput_version],
           [libinput_major_version.libinput_minor_version.libinput_micro_version])
 
@@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
 # b) If interfaces have been changed or added, but binary compatibility has
 #    been preserved, change to C+1:0:A+1
 # c) If the interface is the same as the previous version, change to C:R+1:A
-LIBINPUT_LT_VERSION=17:0:7
+LIBINPUT_LT_VERSION=17:1:7
 AC_SUBST(LIBINPUT_LT_VERSION)
 
 AM_SILENT_RULES([yes])

commit 3d1b17e1fdc89ebf479dc14ac02ccd5f28b0ad93
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Feb 11 14:32:33 2016 +1000

    test: add tablet test for out-of-bounds motion coordinates
    
    The newer Cintiqs have a minimum value of 400/400 advertised by the kernel but
    the actual sensor goes past the 0/0 origin. Test this, make sure that a value
    outside the boundaries generates negative mm values.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/doc/svg/tablet-out-of-bounds.svg b/doc/svg/tablet-out-of-bounds.svg
new file mode 100644
index 0000000..83e5021
--- /dev/null
+++ b/doc/svg/tablet-out-of-bounds.svg
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="134.12477mm"
+   height="73.121971mm"
+   viewBox="0 0 475.24525 259.0936"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="tablet-out-of-bounds.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="5.6"
+     inkscape:cx="105.43109"
+     inkscape:cy="265.46934"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:window-width="1920"
+     inkscape:window-height="1136"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0">
+    <sodipodi:guide
+       position="63.6133,240.91614"
+       orientation="0,1"
+       id="guide4164" />
+    <sodipodi:guide
+       position="61.08792,13.126743"
+       orientation="0,1"
+       id="guide4166" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="tablet"
+     inkscape:groupmode="layer"
+     id="layer1"
+     style="display:inline"
+     transform="translate(-139.42736,-156.36219)">
+    <rect
+       style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.9201867;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.68074643, 0.92018661;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect4136"
+       width="474.32504"
+       height="258.1734"
+       x="139.88745"
+       y="156.82228"
+       rx="5" />
+    <rect
+       y="175.42407"
+       x="199.33878"
+       height="226.52563"
+       width="357.34042"
+       id="rect4140"
+       style="opacity:0.92000002;fill:#a44d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.74800003;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+    <g
+       id="g7041"
+       transform="translate(12,0)">
+      <g
+         transform="matrix(0.53265351,0,0,0.53265351,92.308091,96.440418)"
+         id="g7023">
+        <circle
+           style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.98900002;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1"
+           id="path4158"
+           cx="135.61298"
+           cy="287.06125"
+           r="22.98097" />
+        <ellipse
+           cy="287.06125"
+           cx="135.61298"
+           id="circle4160"
+           style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.52043104;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2.08172421, 0.52043105;stroke-dashoffset:0;stroke-opacity:1"
+           rx="11.5985"
+           ry="12.608653" />
+      </g>
+      <rect
+         rx="0.5"
+         y="268.93671"
+         x="163.8243"
+         height="8.9902887"
+         width="13.786156"
+         id="rect4162"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         rx="0.5"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7027"
+         width="13.786156"
+         height="8.9902887"
+         x="163.8243"
+         y="280.97675" />
+      <rect
+         rx="0.5"
+         y="293.01678"
+         x="163.8243"
+         height="8.9902887"
+         width="13.786156"
+         id="rect7029"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         rx="0.5"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.44849709;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.79398834, 0.44849708;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7031"
+         width="9.1119308"
+         height="32.483532"
+         x="149.90343"
+         y="269.44443" />
+      <rect
+         rx="0.5"
+         y="269.44443"
+         x="137.90343"
+         height="32.483532"
+         width="9.1119308"
+         id="rect7033"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.44849709;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.79398834, 0.44849708;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         rx="0.5"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7035"
+         width="9.3657951"
+         height="5.9516821"
+         x="137.77649"
+         y="256.10321" />
+      <rect
+         rx="0.5"
+         y="246.10321"
+         x="137.77649"
+         height="5.9516821"
+         width="9.3657951"
+         id="rect7037"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         rx="0.5"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7039"
+         width="9.3657951"
+         height="5.9516821"
+         x="137.77649"
+         y="236.10321" />
+    </g>
+    <g
+       transform="matrix(-1,0,0,1,743.43474,0)"
+       id="g7054">
+      <g
+         id="g7056"
+         transform="matrix(0.53265351,0,0,0.53265351,92.308091,96.440418)">
+        <circle
+           r="22.98097"
+           cy="287.06125"
+           cx="135.61298"
+           id="circle7058"
+           style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.98900002;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
+        <ellipse
+           ry="12.608653"
+           rx="11.5985"
+           style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.52043104;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2.08172421, 0.52043105;stroke-dashoffset:0;stroke-opacity:1"
+           id="ellipse7060"
+           cx="135.61298"
+           cy="287.06125" />
+      </g>
+      <rect
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7062"
+         width="13.786156"
+         height="8.9902887"
+         x="163.8243"
+         y="268.93671"
+         rx="0.5" />
+      <rect
+         y="280.97675"
+         x="163.8243"
+         height="8.9902887"
+         width="13.786156"
+         id="rect7064"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1"
+         rx="0.5" />
+      <rect
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.29022256;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.16089031, 0.29022258;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7066"
+         width="13.786156"
+         height="8.9902887"
+         x="163.8243"
+         y="293.01678"
+         rx="0.5" />
+      <rect
+         y="269.44443"
+         x="149.90343"
+         height="32.483532"
+         width="9.1119308"
+         id="rect7068"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.44849709;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.79398834, 0.44849708;stroke-dashoffset:0;stroke-opacity:1"
+         rx="0.5" />
+      <rect
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.44849709;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:1.79398834, 0.44849708;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7070"
+         width="9.1119308"
+         height="32.483532"
+         x="137.90343"
+         y="269.44443"
+         rx="0.5" />
+      <rect
+         y="256.10321"
+         x="137.77649"
+         height="5.9516821"
+         width="9.3657951"
+         id="rect7072"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1"
+         rx="0.5" />
+      <rect
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect7074"
+         width="9.3657951"
+         height="5.9516821"
+         x="137.77649"
+         y="246.10321"
+         rx="0.5" />
+      <rect
+         y="236.10321"
+         x="137.77649"
+         height="5.9516821"
+         width="9.3657951"
+         id="rect7076"
+         style="opacity:0.92000002;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.19463234;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:0.77852936, 0.19463234;stroke-dashoffset:0;stroke-opacity:1"
+         rx="0.5" />
+    </g>
+    <rect
+       style="opacity:0.92000002;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.6687212;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2.6748846, 0.66872115;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect7078"
+       width="326.1051"
+       height="198.32079"
+       x="214.95644"
+       y="189.5265" />
+  </g>
+  <g
+     inkscape:groupmode="layer"
+     id="layer3"
+     inkscape:label="stylus"
+     style="display:inline"
+     transform="translate(-139.42736,-156.36219)" />
+</svg>
diff --git a/doc/tablet-support.dox b/doc/tablet-support.dox
index ff4e460..0e719b7 100644
--- a/doc/tablet-support.dox
+++ b/doc/tablet-support.dox
@@ -186,4 +186,26 @@ Intuos 3, 4, 5, Wacon Cintiq and Wacom Intuos Pro series. The tool ID can
 be used to distinguish between e.g. a Wacom Classic Pen or a Wacom Pro Pen.
 It is  the caller's responsibility to interpret the tool ID.
 
+@section tablet-bounds Out-of-bounds motion events
+
+Some tablets integrated into a screen (e.g. Wacom Cintiq 24HD, 27QHD and
+13HD series, etc.) have a sensor larger than the display area. libinput uses
+the range advertised by the kernel as the valid range unless device-specific
+quirks are present. Events outside this range will produce coordinates that
+may be negative or larger than the tablet's width and/or height. It is up to
+the caller to ignore these events.
+
+@image html tablet-out-of-bounds.svg "Illustration of the out-of-bounds area on a tablet"
+
+In the image above, the display area is shown in black. The red area around
+the display illustrates the sensor area that generates input events. Events
+within this area will have negative coordinate or coordinates larger than
+the width/height of the tablet.
+
+If events outside the logical bounds of the input area are scaled into a
+custom range with libinput_event_tablet_tool_get_x_transformed() and
+libinput_event_tablet_tool_get_y_transformed() the resulting value may be
+less than 0 or larger than the upper range provided. It is up to the caller
+to test for this and handle or ignore these events accordingly.
+
 */
diff --git a/src/libinput.h b/src/libinput.h
index b14c281..cf33492 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1562,6 +1562,9 @@ libinput_event_tablet_tool_wheel_has_changed(
  * libinput_event_tablet_tool_get_x_transformed() for transforming the axis
  * value into a different coordinate space.
  *
+ * @note On some devices, returned value may be negative or larger than the
+ * width of the device. See @ref tablet-bounds for more details.
+ *
  * @param event The libinput tablet tool event
  * @return The current value of the the axis
  */
@@ -1576,6 +1579,9 @@ libinput_event_tablet_tool_get_x(struct libinput_event_tablet_tool *event);
  * libinput_event_tablet_tool_get_y_transformed() for transforming the axis
  * value into a different coordinate space.
  *
+ * @note On some devices, returned value may be negative or larger than the
+ * width of the device. See @ref tablet-bounds for more details.
+ *
  * @param event The libinput tablet tool event
  * @return The current value of the the axis
  */
@@ -1754,6 +1760,9 @@ libinput_event_tablet_tool_get_wheel_delta_discrete(
  * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.
  * libinput always includes all device axes in the event.
  *
+ * @note On some devices, returned value may be negative or larger than the
+ * width of the device. See @ref tablet-bounds for more details.
+ *
  * @param event The libinput tablet tool event
  * @param width The current output screen width
  * @return the current absolute x coordinate transformed to a screen coordinate
@@ -1772,6 +1781,9 @@ libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *
  * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.
  * libinput always includes all device axes in the event.
  *
+ * @note On some devices, returned value may be negative or larger than the
+ * width of the device. See @ref tablet-bounds for more details.
+ *
  * @param event The libinput tablet tool event
  * @param height The current output screen height
  * @return the current absolute y coordinate transformed to a screen coordinate
diff --git a/test/tablet.c b/test/tablet.c
index 6909f95..c5dc892 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -1655,6 +1655,63 @@ START_TEST(motion_event_state)
 }
 END_TEST
 
+START_TEST(motion_outside_bounds)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput *li = dev->libinput;
+	struct libinput_event *event;
+	struct libinput_event_tablet_tool *tablet_event;
+	double val;
+
+	struct axis_replacement axes[] = {
+		{ ABS_DISTANCE, 10 },
+		{ ABS_PRESSURE, 0 },
+		{ -1, -1 }
+	};
+
+	litest_tablet_proximity_in(dev, 50, 50, axes);
+	litest_drain_events(li);
+
+	/* On the 24HD x/y of 0 is outside the limit */
+	litest_event(dev, EV_ABS, ABS_X, 0);
+	litest_event(dev, EV_ABS, ABS_Y, 1000);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	libinput_dispatch(li);
+
+	event = libinput_get_event(li);
+	tablet_event = litest_is_tablet_event(event,
+					      LIBINPUT_EVENT_TABLET_TOOL_AXIS);
+	val = libinput_event_tablet_tool_get_x(tablet_event);
+	ck_assert_double_lt(val, 0.0);
+	val = libinput_event_tablet_tool_get_y(tablet_event);
+	ck_assert_double_gt(val, 0.0);
+
+	val = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100);
+	ck_assert_double_lt(val, 0.0);
+
+	libinput_event_destroy(event);
+
+	/* On the 24HD x/y of 0 is outside the limit */
+	litest_event(dev, EV_ABS, ABS_X, 1000);
+	litest_event(dev, EV_ABS, ABS_Y, 0);
+	litest_event(dev, EV_SYN, SYN_REPORT, 0);
+	libinput_dispatch(li);
+
+	event = libinput_get_event(li);
+	tablet_event = litest_is_tablet_event(event,
+					      LIBINPUT_EVENT_TABLET_TOOL_AXIS);
+	val = libinput_event_tablet_tool_get_x(tablet_event);
+	ck_assert_double_gt(val, 0.0);
+	val = libinput_event_tablet_tool_get_y(tablet_event);
+	ck_assert_double_lt(val, 0.0);
+
+	val = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100);
+	ck_assert_double_lt(val, 0.0);
+
+	libinput_event_destroy(event);
+}
+END_TEST
+
 START_TEST(bad_distance_events)
 {
 	struct litest_device *dev = litest_current_device();
@@ -3577,6 +3634,7 @@ litest_setup_tests(void)
 	litest_add("tablet:tip", tip_state_button, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:motion", motion, LITEST_TABLET, LITEST_ANY);
 	litest_add("tablet:motion", motion_event_state, LITEST_TABLET, LITEST_ANY);
+	litest_add_for_device("tablet:motion", motion_outside_bounds, LITEST_WACOM_CINTIQ_24HD);
 	litest_add("tablet:tilt", tilt_available, LITEST_TABLET|LITEST_TILT, LITEST_ANY);
 	litest_add("tablet:tilt", tilt_not_available, LITEST_TABLET, LITEST_TILT);
 	litest_add("tablet:tilt", tilt_x, LITEST_TABLET|LITEST_TILT, LITEST_ANY);

commit 197bad1676bb4b507db81e1d535e78c82a101942
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Feb 11 13:52:55 2016 +1000

    test: add Wacom Cintiq 24HD Pen
    
    One test now gets close enough to 100% of the axis value that
    ck_assert_double_lt() is not fine-grained enough. Switch to a direct x < 100.0
    check.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/Makefile.am b/test/Makefile.am
index bee7203..d328c92 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -46,6 +46,7 @@ liblitest_la_SOURCES = \
 	litest-device-touch-screen.c \
 	litest-device-wacom-bamboo-tablet.c \
 	litest-device-wacom-cintiq-tablet.c \
+	litest-device-wacom-cintiq-24hd.c \
 	litest-device-wacom-intuos-tablet.c \
 	litest-device-wacom-isdv4-tablet.c \
 	litest-device-wacom-touch.c \
diff --git a/test/litest-device-wacom-cintiq-24hd.c b/test/litest-device-wacom-cintiq-24hd.c
new file mode 100644
index 0000000..07f27f9
--- /dev/null
+++ b/test/litest-device-wacom-cintiq-24hd.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "litest.h"
+#include "litest-int.h"
+
+static void litest_wacom_cintiq_tablet_setup(void)
+{
+	struct litest_device *d = litest_create_device(LITEST_WACOM_CINTIQ_24HD);
+	litest_set_current_device(d);
+}
+
+static struct input_event proximity_in[] = {
+	{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MISC, .value = 2083 },
+	{ .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+	{ .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 },
+	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+	{ .type = -1, .code = -1 },
+};
+
+static struct input_event proximity_out[] = {
+	{ .type = EV_ABS, .code = ABS_X, .value = 0 },
+	{ .type = EV_ABS, .code = ABS_Y, .value = 0 },
+	{ .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 },
+	{ .type = EV_ABS, .code = ABS_TILT_X, .value = 0 },
+	{ .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 },
+	{ .type = EV_ABS, .code = ABS_MISC, .value = 0 },
+	{ .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+	{ .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 },
+	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+	{ .type = -1, .code = -1 },
+};
+
+static struct input_event motion[] = {
+	{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 },
+	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+	{ .type = -1, .code = -1 },
+};
+
+static int
+get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
+{
+	switch (evcode) {
+	case ABS_TILT_X:
+	case ABS_TILT_Y:
+		*value = 0;
+		return 0;
+	case ABS_PRESSURE:
+		*value = 100;
+		return 0;
+	case ABS_DISTANCE:
+		*value = 0;
+		return 0;
+	}
+	return 1;
+}
+
+static struct litest_device_interface interface = {
+	.tablet_proximity_in_events = proximity_in,
+	.tablet_proximity_out_events = proximity_out,
+	.tablet_motion_events = motion,
+
+	.get_axis_default = get_axis_default,
+};
+
+static struct input_absinfo absinfo[] = {
+	{ ABS_X, 400, 104080, 4, 0, 200 },
+	{ ABS_Y, 400, 65200, 4, 0, 200 },
+	{ ABS_Z, -900, 899, 0, 0, 0 },
+	{ ABS_WHEEL, 0, 1023, 0, 0, 0 },
+	{ ABS_THROTTLE, 0, 71, 0, 0, 0 },
+	{ ABS_PRESSURE, 0, 2047, 0, 0, 0 },
+	{ ABS_DISTANCE, 0, 63, 0, 0, 0 },
+	{ ABS_TILT_X, -64, 63, 0, 0, 57 },
+	{ ABS_TILT_Y, -64, 63, 0, 0, 57 },
+	{ ABS_MISC, 0, 0, 0, 0, 0 },
+	{ .value = -1 },
+};
+
+static struct input_id input_id = {
+	.bustype = 0x3,
+	.vendor = 0x56a,
+	.product = 0xf4,
+	.version = 0x113,
+};
+
+static int events[] = {
+	EV_KEY, BTN_TOOL_PEN,
+	EV_KEY, BTN_TOOL_RUBBER,
+	EV_KEY, BTN_TOOL_BRUSH,
+	EV_KEY, BTN_TOOL_PENCIL,
+	EV_KEY, BTN_TOOL_AIRBRUSH,
+	EV_KEY, BTN_TOUCH,
+	EV_KEY, BTN_STYLUS,
+	EV_KEY, BTN_STYLUS2,


Reply to: