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

xserver-xorg-input-libinput: Changes to 'debian-unstable'



 ChangeLog                     |  391 ++++++++++++++++++++++++++
 autogen.sh                    |   11 
 configure.ac                  |    2 
 debian/changelog              |    6 
 include/libinput-properties.h |   10 
 man/libinput.man              |   60 ++++
 src/Makefile.am               |    5 
 src/bezier.c                  |  177 ++++++++++++
 src/bezier.h                  |   69 ++++
 src/xf86libinput.c            |  613 ++++++++++++++++++++++++++++++++++++++----
 test/Makefile.am              |    5 
 test/test-bezier.c            |  206 ++++++++++++++
 12 files changed, 1489 insertions(+), 66 deletions(-)

New commits:
commit 4a0e538136447005aaa77d63abcb96ca13edd3a5
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Fri Mar 10 11:00:19 2017 +0200

    update changelogs

diff --git a/ChangeLog b/ChangeLog
index 86d8203..a83d805 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,394 @@
+commit 153a7fc62fa87a2cc2516826b3eae16fa8cc861d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 9 15:58:39 2017 +1000
+
+    xf86-input-libinput 0.25.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 72fb6d304eec6eeeac6b42963c2729134d56de57
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Feb 28 14:45:29 2017 +1000
+
+    test: fix a test failure on ppc64(le) and aarch64
+    
+    Caused by different results in -O0 vs -O2. The resulting array differs only
+    slightly but the initial sequence has one extra zero. That triggers our
+    assert, no other compiler flag seem to be affecting this.
+    
+    Compiled with -O0:
+    Breakpoint 1, test_nonzero_x_linear () at test-bezier.c:157
+    157			assert(bezier[x] > bezier[x-1]);
+    (gdb) p bezier
+    $6 = {0 <repeats 409 times>, 1, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 21, 22,
+    
+    Compiled with -O2:
+    (gdb) p bezier
+    $1 = {0 <repeats 410 times>, 1, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22,
+    
+    Printing of the temporary numbers in the decasteljau function shows that a few
+    of them are off by one, e.g.
+        408.530612/0.836735 with O0, but
+        409.510204/0.836735 with O2
+    Note: these are not rounding errors caused by the code, the cast to int
+    happens afterwards.
+    
+    Hack around this by allowing for one extra zero before we check that the rest
+    of the curve is ascending again.
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=99992
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit aae2c8ad9a9f1712149c93d50284ddb5f37e4cbd
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Feb 24 12:56:41 2017 +1000
+
+    Open sysfs files directly instead of going through the server
+    
+    Only use-case here are pad mode LEDs that now live in /sys/class/leds. Asking
+    the server to open them is pointless, the server only knows how to open Option
+    "Device". And since the LEDs are in sysfs we should have access to them
+    anyway, so no need for jumping through or hula-ing hoops.
+    
+    xf86CloseSerial() works as intended as it's a slim wrapper around close(), so
+    we only have to worry about the open() path here.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit dafc296f2df587a1bb5feb37697c50608db4f246
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Feb 24 12:34:10 2017 +1000
+
+    Add streq() macro, replace strcmp instances with it
+    
+    And why isn't this a thing in glibc yet
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
+
+commit 7c90f06d569b1b14d84075e7cea22bce06b925e6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Feb 24 12:27:37 2017 +1000
+
+    Update pad modes in a workproc, not during the input thread
+    
+    Updating the property directly causes us to send events from the input thread
+    which has some "interesting" side effects like messing up the reply order or
+    just crashing the server.
+    
+    Schedule a work proc instead and update it whenever the server is back in the
+    main thread.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2eb5a2f0c08747df44eba6faff95cc9ce24b78ed
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 9 16:16:34 2017 +1000
+
+    xf86-input-libinput 0.24.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 19ceef972e76bc491438198659748786d9457668
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 27 10:24:08 2017 +1000
+
+    Drop unnecessary function declaration
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 07f30ea049303739bf6006d23ac924971a19d778
+Author: Mihail Konev <k.mvc@ya.ru>
+Date:   Thu Jan 26 14:00:21 2017 +1000
+
+    autogen: add default patch prefix
+    
+    Signed-off-by: Mihail Konev <k.mvc@ya.ru>
+
+commit 6187ed0450e68aaf727779ad61b50b0b70a1122e
+Author: Emil Velikov <emil.l.velikov@gmail.com>
+Date:   Mon Mar 9 12:00:52 2015 +0000
+
+    autogen.sh: use quoted string variables
+    
+    Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
+    fall-outs, when they contain space.
+    
+    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 974ab6b62bd2af97e1556314df28fe9f3b816e54
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 28 11:20:22 2016 +1000
+
+    Add tablet tool area ratio property
+    
+    By default, the X server maps the tablet axes to the available screen area.
+    When a tablet is mapped to the screen but has a different aspect ratio than
+    the screen, input data is skewed. Expose an area ratio property to map the
+    a subsection of the available tablet area into the desired ratio.
+    
+    Differences to the wacom driver: there the x/y min/max values must be
+    specified manually and in device coordinates. For this driver we merely
+    provide the area ratio (e.g. 4:3) and let the driver work out the rest.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
+
+commit 5d0470738125243c98f7a8cc40d62f53604a8051
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 24 14:41:51 2016 +1000
+
+    Implement stylus pressure curve support
+    
+    Takes a 4-point cubic bezier curve as input and maps the pressure coordinates
+    to the values outlined by this curve. This is an extension of the current
+    implementation in the xf86-input-wacom driver which only allows the two center
+    control points to be modified.
+    
+    Over the years a few users have noted that the wacom driver's pressure curve
+    makes it impossible to cap the pressure at a given value. Given our bezier
+    implementation here, it's effectively a freebie to add configurability of the
+    first and last control points. We do require all control points' x coordinates
+    to be in ascending order.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f65a5c50224efc34414f44c86700e15392b7039b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Oct 26 11:57:49 2016 +1000
+
+    Add a bezier curve implementation
+    
+    Needed for the wacom stylus pressure curve
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0dad7408fac3b69c4b6ab7705f39f790d7ba20c2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Nov 28 14:09:06 2016 +1000
+
+    Calculate the required scroll distance based on the angle
+    
+    For a mouse with a click angle of 15 degrees things are unchanged. For devices
+    with angles less than 10, the current code scrolled way too fast. Because the
+    angle wasn't used anywhere, each tick would count as full scroll wheel event,
+    a slight movement of the wheel would thus scroll as much as a large movement
+    on a normal mouse.
+    
+    Fix this by taking the actual click angle of the device into account. We
+    calculate some multiple of the angle that's close enough to the default 15
+    degrees of the wheel and then require that many click events to hit the full
+    scroll distance. For example, a mouse with a click angle of 3 degrees now
+    requires 5 clicks to trigger a full legacy scroll button event.
+    
+    XI2.1 clients get the intermediate events (i.e. in this case five times
+    one-fifth of the scroll distance) and can thus scroll smoothly, or more
+    specifically in smaller events than usual.
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=92772
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit ea02578a4e888d9908eb6bed6dcb858f78acb8bb
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 29 08:31:32 2016 +1000
+
+    Move axis value calculation into a helper function
+    
+    The only difference here is the axis number.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit 2ceb2e1b18b6f971706230d16a2a5665d87aabd4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 29 09:21:24 2016 +1000
+
+    Add a comment regarding scroll dist default values
+    
+    Changed this during development because I forgot that the value actually
+    matters (for touchpads anyway).
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit f47f78eb0bd9fba455f01c8c6dead3bd75242b2b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Dec 20 15:36:55 2016 +1000
+
+    Ignore LED updates for disabled devices
+    
+    If an XKB AccessX timeout is set and a VT switch is triggered, the
+    AccessXTimeoutExpire function may be called after the device has already been
+    disabled. This can cause a null-pointer dereference as our shared libinput
+    device may have been released by then.
+    
+    In the legacy drivers this would've simply caused a write to an invalid fd
+    (-1), not a crash. Here we need to be more careful.
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=98464
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit 1c3ce3ce3c315213511735db1b0fdd74ca8442d0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Dec 12 14:54:00 2016 +1000
+
+    xf86-input-libinput 0.23.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4d481ea7c80dad9f53b47c026959c25ad9da5211
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Dec 5 14:25:31 2016 +1000
+
+    Fix default scroll button number
+    
+    Was exposing the evdev code rather than the xorg code.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit 72bac84df9ce72f2baf730655ecc23f1692d1e64
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 15 11:23:08 2016 +1000
+
+    If the parent libinput_device is unavailable, create a new one
+    
+    The parent device ref's the libinput device during pre_init and unref's it
+    during DEVICE_INIT, so the copy is lost. During DEVICE_ON, the libinput device
+    is re-added and ref'd, this one stays around now. But the takeaway is: unless
+    the device is enabled, no libinput device reference is available.
+    
+    If a device is a mixed pointer + keyboard device, a subdevice is created
+    during a WorkProc. The subdevice relied on the parent's libinput_device being
+    available and didn't even check for it. This WorkProc usually runs after
+    the parent's DEVICE_ON, so in most cases all is well.
+    
+    But when running without logind and the server is vt-switched away, the parent
+    device only runs PreInit and DEVICE_INIT but never DEVICE_ON, causing the
+    subdevice to burn, crash, and generally fail horribly when it dereferences the
+    parent's libinput device.
+    
+    Fix this because we have global warming already and don't need to burn more
+    things and also because it's considered bad user experience to have the
+    server crash. The simple fix is to check the parent device first and if it is
+    unavailable, create a new one because it will end up disabled as well anyway,
+    so the ref goes away as well. The use-case where the parent somehow gets
+    disabled but the subdevice doesn't is a bit too niche to worry about.
+    
+    This doesn't happen with logind because in that case we don't get a usable fd
+    while VT-switched away, so we can't even run PreInit and never get this far
+    (see the paused fd handling in the xfree86 code for that). It can be
+    reproduced by setting AutoEnableDevices off, but why would you do that,
+    seriously.
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=97117
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit 0b073d90e63d644401769c61611638d65a4eaf44
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Nov 11 12:36:01 2016 +1000
+
+    Link the left-handed property between the tools
+    
+    The property is tablet-wide, not just per tool. So when one tool is updated,
+    run through all other devices that share the same underlying device.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+
+commit 669fbb098516e0bdf6c62c52c1bcb12580de069b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 1 10:42:19 2016 +1000
+
+    Drop indentation for matrix handling
+    
+    Exit early if the string is NULL to reduce indentation. No functional changes.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c4f0a9bcb846f70b85a285e8acea8fe086abdccb
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 1 10:06:03 2016 +1000
+
+    conf: match against tablets too
+    
+    Now that we sort below the xf86-input-wacom driver anyway, there's no good
+    reason to ignore tablets anymore.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a61e156326197dbbf1c1294693946c504af9daee
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 24 14:23:16 2016 +1000
+
+    man: sort the options and properties alphabetically
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 552cbaf466a0aede8f789aa2013795f3b9ac253d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Oct 26 15:03:48 2016 +1000
+
+    Don't init the AccelSpeed/LeftHanded properties on the base tablet device
+    
+    This device never sends events, no point in exposing these options
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
+
+commit bc91d337d7cf765fd23e47783a498e4b3b334f39
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Oct 20 08:42:53 2016 +1000
+
+    Fix potential NULL pointer dereferencing
+    
+    Found by coverity.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c8d2293873d3f86e5cefffa5c51cfe423d09c948
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Oct 20 08:38:24 2016 +1000
+
+    Remove superfluous check for next being NULL
+    
+    is_libinput_device(next) causes a dereference of next anyway, so this cannot
+    ever be NULL.
+    
+    Besides, if next ends up as NULL that means we have lost count of how many
+    remaining devices use libinput, so we have other issues.
+    
+    Found by coverity.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a7014aa8c619ed9bc1cd5c0b38428fd88f1bc8d4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Oct 20 08:27:01 2016 +1000
+
+    Remove two unused variables
+    
+    They were never used anyway
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit bf7fffde520277e13b350950de9dc5bf89858951
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Oct 19 11:42:57 2016 +1000
+
+    Don't init the horiz scroll property on non-pointer devices
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
 commit 728217775626e2086d7c3acd0d242562390f145b
 Author: Peter Hutterer <peter.hutterer@who-t.net>
 Date:   Wed Oct 19 10:55:12 2016 +1000
diff --git a/debian/changelog b/debian/changelog
index 2fdd27b..55babfd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xserver-xorg-input-libinput (0.24.0-1) UNRELEASED; urgency=medium
+xserver-xorg-input-libinput (0.25.0-1) UNRELEASED; urgency=medium
 
   * New upstream release.
 

commit 153a7fc62fa87a2cc2516826b3eae16fa8cc861d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Mar 9 15:58:39 2017 +1000

    xf86-input-libinput 0.25.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index d6d7d34..268fda3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-libinput],
-        [0.24.0],
+        [0.25.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-libinput])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 72fb6d304eec6eeeac6b42963c2729134d56de57
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Feb 28 14:45:29 2017 +1000

    test: fix a test failure on ppc64(le) and aarch64
    
    Caused by different results in -O0 vs -O2. The resulting array differs only
    slightly but the initial sequence has one extra zero. That triggers our
    assert, no other compiler flag seem to be affecting this.
    
    Compiled with -O0:
    Breakpoint 1, test_nonzero_x_linear () at test-bezier.c:157
    157			assert(bezier[x] > bezier[x-1]);
    (gdb) p bezier
    $6 = {0 <repeats 409 times>, 1, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 21, 22,
    
    Compiled with -O2:
    (gdb) p bezier
    $1 = {0 <repeats 410 times>, 1, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22,
    
    Printing of the temporary numbers in the decasteljau function shows that a few
    of them are off by one, e.g.
        408.530612/0.836735 with O0, but
        409.510204/0.836735 with O2
    Note: these are not rounding errors caused by the code, the cast to int
    happens afterwards.
    
    Hack around this by allowing for one extra zero before we check that the rest
    of the curve is ascending again.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=99992
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/test-bezier.c b/test/test-bezier.c
index 1b290a4..9a6e59e 100644
--- a/test/test-bezier.c
+++ b/test/test-bezier.c
@@ -153,6 +153,13 @@ test_nonzero_x_linear(void)
 		assert(bezier[x] == 0);
 	} while (++x < size * 0.2 - 1);
 
+	/* ppc64le, ppc64, aarch64 have different math results at -O2,
+	   resulting in one extra zero at the beginning of the array.
+	   some other numbers are different too but within the error
+	   margin (#99992) */
+	if (bezier[x] == 0)
+		x++;
+
 	do {
 		assert(bezier[x] > bezier[x-1]);
 	} while (++x < size * 0.8 - 1);

commit aae2c8ad9a9f1712149c93d50284ddb5f37e4cbd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Feb 24 12:56:41 2017 +1000

    Open sysfs files directly instead of going through the server
    
    Only use-case here are pad mode LEDs that now live in /sys/class/leds. Asking
    the server to open them is pointless, the server only knows how to open Option
    "Device". And since the LEDs are in sysfs we should have access to them
    anyway, so no need for jumping through or hula-ing hoops.
    
    xf86CloseSerial() works as intended as it's a slim wrapper around close(), so
    we only have to worry about the open() path here.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index ef03d3e..888c8f2 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2187,6 +2187,12 @@ open_restricted(const char *path, int flags, void *data)
 	InputInfoPtr pInfo;
 	int fd = -1;
 
+	/* Special handling for sysfs files (used for pad LEDs) */
+	if (strneq(path, "/sys/", 5)) {
+		fd = open(path, flags);
+		return fd < 0 ? -errno : fd;
+	}
+
 	nt_list_for_each_entry(pInfo, xf86FirstLocalDevice(), next) {
 		char *device = xf86CheckStrOption(pInfo->options, "Device", NULL);
 

commit dafc296f2df587a1bb5feb37697c50608db4f246
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Feb 24 12:34:10 2017 +1000

    Add streq() macro, replace strcmp instances with it
    
    And why isn't this a thing in glibc yet
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index e6b9921..ef03d3e 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -65,6 +65,9 @@
 #define TOUCH_MAX_SLOTS 15
 #define XORG_KEYCODE_OFFSET 8
 
+#define streq(a, b) (strcmp(a, b) == 0)
+#define strneq(a, b, n) (strncmp(a, b, n) == 0)
+
 /*
    libinput does not provide axis information for absolute devices, instead
    it scales into the screen dimensions provided. So we set up the axes with
@@ -259,7 +262,7 @@ xf86libinput_is_subdevice(InputInfoPtr pInfo)
 	BOOL is_subdevice;
 
 	source = xf86SetStrOption(pInfo->options, "_source", "");
-	is_subdevice = strcmp(source, "_driver/libinput") == 0;
+	is_subdevice = streq(source, "_driver/libinput");
 	free(source);
 
 	return is_subdevice;
@@ -1213,7 +1216,7 @@ is_libinput_device(InputInfoPtr pInfo)
 	BOOL rc;
 
 	driver = xf86CheckStrOption(pInfo->options, "driver", "");
-	rc = strcmp(driver, "libinput") == 0;
+	rc = streq(driver, "libinput");
 	free(driver);
 
 	return rc;
@@ -2187,7 +2190,7 @@ open_restricted(const char *path, int flags, void *data)
 	nt_list_for_each_entry(pInfo, xf86FirstLocalDevice(), next) {
 		char *device = xf86CheckStrOption(pInfo->options, "Device", NULL);
 
-		if (device != NULL && strcmp(path, device) == 0) {
+		if (device != NULL && streq(path, device)) {
 			free(device);
 			break;
 		}
@@ -2353,9 +2356,9 @@ xf86libinput_parse_tap_buttonmap_option(InputInfoPtr pInfo,
 			       "TappingButtonMap",
 			       NULL);
 	if (str) {
-		if (strcmp(str, "lmr") == 0)
+		if (streq(str, "lmr"))
 			map = LIBINPUT_CONFIG_TAP_MAP_LMR;
-		else if (strcmp(str, "lrm") == 0)
+		else if (streq(str, "lrm"))
 			map = LIBINPUT_CONFIG_TAP_MAP_LRM;
 		else
 			xf86IDrvMsg(pInfo, X_ERROR,
@@ -2468,11 +2471,11 @@ xf86libinput_parse_sendevents_option(InputInfoPtr pInfo,
 				   "SendEventsMode",
 				   NULL);
 	if (modestr) {
-		if (strcmp(modestr, "enabled") == 0)
+		if (streq(modestr, "enabled"))
 			mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
-		else if (strcmp(modestr, "disabled") == 0)
+		else if (streq(modestr, "disabled"))
 			mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
-		else if (strcmp(modestr, "disabled-on-external-mouse") == 0)
+		else if (streq(modestr, "disabled-on-external-mouse"))
 			mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
 		else
 			xf86IDrvMsg(pInfo, X_ERROR,
@@ -2866,7 +2869,7 @@ xf86libinput_parse_tablet_area_option(InputInfoPtr pInfo,
 	str = xf86SetStrOption(pInfo->options,
 			       "TabletToolAreaRatio",
 			       NULL);
-	if (!str || strcmp(str, "default") == 0)
+	if (!str || streq(str, "default"))
 		goto out;
 
 	rc = sscanf(str, "%d:%d", &area.x, &area.y);

commit 7c90f06d569b1b14d84075e7cea22bce06b925e6
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Feb 24 12:27:37 2017 +1000

    Update pad modes in a workproc, not during the input thread
    
    Updating the property directly causes us to send events from the input thread
    which has some "interesting" side effects like messing up the reply order or
    just crashing the server.
    
    Schedule a work proc instead and update it whenever the server is back in the
    main thread.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 703d872..e6b9921 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -3386,17 +3386,43 @@ static Atom prop_float;
 static Atom prop_device;
 static Atom prop_product_id;
 
-static inline void
-update_mode_prop(InputInfoPtr pInfo,
-		 struct libinput_event_tablet_pad *event)
-{
-	struct xf86libinput *driver_data = pInfo->private;
+struct mode_prop_state {
+	int deviceid;
+	InputInfoPtr pInfo;
+
 	struct libinput_tablet_pad_mode_group *group;
 	unsigned int mode;
 	unsigned int idx;
+};
+
+static Bool
+update_mode_prop_cb(ClientPtr client, pointer closure)
+{
+	struct mode_prop_state *state = closure;
+	InputInfoPtr pInfo = state->pInfo, tmp;
+	struct xf86libinput *driver_data = pInfo->private;
+	BOOL found = FALSE;
 	XIPropertyValuePtr val;
 	int rc;
 	unsigned char groups[4] = {0};
+	struct libinput_tablet_pad_mode_group *group = state->group;
+	unsigned int mode = state->mode;
+	unsigned int idx = state->idx;
+
+	if (idx >= ARRAY_SIZE(groups))
+		goto out;
+
+	/* The device may have gotten removed before the WorkProc was
+	 * scheduled. X reuses deviceids, but if the pointer value and
+	 * device ID are what we had before, we're good */
+	nt_list_for_each_entry(tmp, xf86FirstLocalDevice(), next) {
+		if (tmp->dev->id == state->deviceid && tmp == pInfo) {
+			found = TRUE;
+			break;
+		}
+	}
+	if (!found)
+		goto out;
 
 	rc = XIGetDeviceProperty(pInfo->dev,
 				 prop_mode_groups,
@@ -3404,18 +3430,12 @@ update_mode_prop(InputInfoPtr pInfo,
 	if (rc != Success ||
 	    val->format != 8 ||
 	    val->size <= 0)
-		return;
+		goto out;
 
 	memcpy(groups, (unsigned char*)val->data, val->size);
 
-	group = libinput_event_tablet_pad_get_mode_group(event);
-	mode = libinput_event_tablet_pad_get_mode(event);
-	idx = libinput_tablet_pad_mode_group_get_index(group);
-	if (idx >= ARRAY_SIZE(groups))
-		return;
-
 	if (groups[idx] == mode)
-		return;
+		goto out;
 
 	groups[idx] = mode;
 
@@ -3428,8 +3448,36 @@ update_mode_prop(InputInfoPtr pInfo,
 				    groups,
 				    TRUE);
 	driver_data->allow_mode_group_updates = false;
-	if (rc != Success)
+
+out:
+	libinput_tablet_pad_mode_group_unref(group);
+	free(state);
+	return TRUE;
+}
+
+static inline void
+update_mode_prop(InputInfoPtr pInfo,
+		 struct libinput_event_tablet_pad *event)
+{
+	struct libinput_tablet_pad_mode_group *group;
+	struct mode_prop_state *state;
+
+	state = calloc(1, sizeof(*state));
+	if (!state)
 		return;
+
+	state->deviceid = pInfo->dev->id;
+	state->pInfo = pInfo;
+
+	group = libinput_event_tablet_pad_get_mode_group(event);
+
+	state->group = libinput_tablet_pad_mode_group_ref(group);
+	state->mode = libinput_event_tablet_pad_get_mode(event);
+	state->idx = libinput_tablet_pad_mode_group_get_index(group);
+
+	/* Schedule a WorkProc so we don't update from within the input
+	   thread */
+	QueueWorkProc(update_mode_prop_cb, serverClient, state);
 }
 
 static inline BOOL

commit 65a246dcf2d3110889da1e06933de504e3f6163c
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Thu Feb 9 13:50:02 2017 +0200

    update changelog

diff --git a/debian/changelog b/debian/changelog
index 7d53c08..2fdd27b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xserver-xorg-input-libinput (0.24.0-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Timo Aaltonen <tjaalton@debian.org>  Thu, 09 Feb 2017 13:49:32 +0200
+
 xserver-xorg-input-libinput (0.23.0-2) unstable; urgency=medium
 
   [ Andreas Boll ]

commit 2eb5a2f0c08747df44eba6faff95cc9ce24b78ed
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Feb 9 16:16:34 2017 +1000

    xf86-input-libinput 0.24.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 7a1918b..d6d7d34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-libinput],
-        [0.23.0],
+        [0.24.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-libinput])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 19ceef972e76bc491438198659748786d9457668
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Jan 27 10:24:08 2017 +1000

    Drop unnecessary function declaration
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 55cfc0c..703d872 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2233,13 +2233,7 @@ const struct libinput_interface interface = {
     .close_restricted = close_restricted,
 };
 
-static void
-xf86libinput_log_handler(struct libinput *libinput,
-			 enum libinput_log_priority priority,
-			 const char *format,
-			 va_list args)
-	_X_ATTRIBUTE_PRINTF(3, 0);
-
+_X_ATTRIBUTE_PRINTF(3, 0)
 static void
 xf86libinput_log_handler(struct libinput *libinput,
 			 enum libinput_log_priority priority,

commit 07f30ea049303739bf6006d23ac924971a19d778
Author: Mihail Konev <k.mvc@ya.ru>
Date:   Thu Jan 26 14:00:21 2017 +1000

    autogen: add default patch prefix
    
    Signed-off-by: Mihail Konev <k.mvc@ya.ru>

diff --git a/autogen.sh b/autogen.sh
index 0006de8..421528e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,6 +9,9 @@ cd "$srcdir"
 autoreconf -v --install || exit 1
 cd "$ORIGDIR" || exit $?
 
+git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
+    git config --local format.subjectPrefix "PATCH xf86-input-libinput"
+
 if test -z "$NOCONFIGURE"; then
     exec "$srcdir"/configure "$@"
 fi

commit 6187ed0450e68aaf727779ad61b50b0b70a1122e
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Mon Mar 9 12:00:52 2015 +0000

    autogen.sh: use quoted string variables
    
    Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
    fall-outs, when they contain space.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/autogen.sh b/autogen.sh
index fd9c59a..0006de8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,14 +1,14 @@
 #! /bin/sh
 
-srcdir=`dirname $0`
+srcdir=`dirname "$0"`
 test -z "$srcdir" && srcdir=.
 
 ORIGDIR=`pwd`
-cd $srcdir
+cd "$srcdir"
 
 autoreconf -v --install || exit 1
-cd $ORIGDIR || exit $?
+cd "$ORIGDIR" || exit $?
 
 if test -z "$NOCONFIGURE"; then
-    exec $srcdir/configure "$@"
+    exec "$srcdir"/configure "$@"
 fi

commit 974ab6b62bd2af97e1556314df28fe9f3b816e54
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Oct 28 11:20:22 2016 +1000

    Add tablet tool area ratio property
    
    By default, the X server maps the tablet axes to the available screen area.
    When a tablet is mapped to the screen but has a different aspect ratio than
    the screen, input data is skewed. Expose an area ratio property to map the
    a subsection of the available tablet area into the desired ratio.
    
    Differences to the wacom driver: there the x/y min/max values must be
    specified manually and in device coordinates. For this driver we merely
    provide the area ratio (e.g. 4:3) and let the driver work out the rest.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>

diff --git a/include/libinput-properties.h b/include/libinput-properties.h
index f76500f..a701316 100644
--- a/include/libinput-properties.h
+++ b/include/libinput-properties.h
@@ -190,4 +190,7 @@
  */
 #define LIBINPUT_PROP_TABLET_TOOL_PRESSURECURVE "libinput Tablet Tool Pressurecurve"
 
+/* Tablet tool area ratio: CARD32, 2 values, w and h */
+#define LIBINPUT_PROP_TABLET_TOOL_AREA_RATIO "libinput Tablet Tool Area Ratio"
+
 #endif /* _LIBINPUT_PROPERTIES_H_ */
diff --git a/man/libinput.man b/man/libinput.man
index 88a0428..d717ff7 100644
--- a/man/libinput.man
+++ b/man/libinput.man
@@ -161,6 +161,14 @@ points. The respective x/y coordinate must be in the [0.0, 1.0] range. For
 more information see section
 .B TABLET STYLUS PRESSURE CURVE.
 .TP 7
+.BI "Option \*qTabletToolAreaRatio\*q \*q" "w:h" \*q
+Sets the area ratio for a tablet tool. The area always starts at the
+origin (0/0) and expands to the largest available area with the specified
+aspect ratio. Events outside this area are cropped to the area. The special
+value "default" is used for the default mapping (i.e. the device-native
+mapping). For more information see section
+.B TABLET TOOL AREA RATIO.
+.TP 7
 .BI "Option \*qTapping\*q \*q" bool \*q
 Enables or disables tap-to-click behavior.
 .TP 7
@@ -261,6 +269,11 @@ enabled on this device.
 .BI "libinput Tablet Tool Pressurecurve"
 4 32-bit float values [0.0 to 1.0]. See section
 .B TABLET TOOL PRESSURE CURVE
+.TP7
+.BI "libinput Tablet Tool Area Ratio"
+2 32-bit values, corresponding to width and height. Special value 0, 0
+resets to the default ratio. See section
+.B TABLET TOOL AREA RATIO
 for more information.
 .TP 7
 .BI "libinput Tapping Enabled"
@@ -343,6 +356,23 @@ curve (softer) might  be "0.0/0.0 0.0/0.05 0.95/1.0 1.0/1.0".
 .TP
 This feature is provided by this driver, not by libinput.
 
+.SH TABLET TOOL AREA RATIO
+By default, a tablet tool can access the whole sensor area and the tablet
+area is mapped to the available screen area. For external tablets like
+the Wacom Intuos series, the height:width ratio of the tablet may be
+different to that of the monitor, causing the skew of input data.
+.PP
+To avoid this skew of input data, an area ratio may be set to match the
+ratio of the screen device. For example, a ratio of 4:3 will reduce the
+available area of the tablet to the largest available area with a ratio of
+4:3. Events within this area will scale to the tablet's announced axis
+range, the area ratio is thus transparent to the X server. Any events
+outside this area will send events equal to the maximum value of that axis.
+The area always starts at the device's origin in it's current rotation, i.e.
+it takes left-handed-ness into account.
+.TP
+This feature is provided by this driver, not by libinput.
+
 .SH AUTHORS
 Peter Hutterer
 .SH "SEE ALSO"
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index d43f67f..55cfc0c 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -167,6 +167,9 @@ struct xf86libinput {
 
 		float rotation_angle;
 		struct bezier_control_point pressurecurve[4];
+		struct ratio {
+			int x, y;
+		} area;
 	} options;
 
 	struct draglock draglock;
@@ -184,6 +187,10 @@ struct xf86libinput {
 		int *values;
 		size_t sz;
 	} pressurecurve;
+
+	struct scale_factor {
+		double x, y;
+	} area_scale_factor;
 };
 
 enum event_handling {
@@ -418,6 +425,35 @@ xf86libinput_set_pressurecurve(struct xf86libinput *driver_data,
 			    driver_data->pressurecurve.sz);


Reply to: