Misalignment inside XChangeDeviceProperty.
This patch should be a no-op, but it causes significant changes for me.
cheako@mx1:~/src/deb/xfce4-settings-4.16.0$ cat debian/patches/fix_xchangedeviceproperty.patch
--- a/xfsettingsd/pointers.c
+++ b/xfsettingsd/pointers.c
@@ -53,6 +53,8 @@
#define DEVICE_ENABLED "Device Enabled"
#endif /* XI_PROP_ENABLED */
+#include <X11/extensions/XInput2.h>
+
static void xfce_pointers_helper_finalize (GObject *object);
static void xfce_pointers_helper_syndaemon_stop (XfcePointersHelper *helper);
static void xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper);
@@ -877,7 +879,8 @@
if (n_succeeds == n_items)
{
gdk_x11_display_error_trap_push (gdk_display_get_default ());
- XChangeDeviceProperty (xdisplay, device, prop, type, format,
+ XIChangeProperty (xdisplay, device->deviceid,
+ prop, type, format,
PropModeReplace, data.c, n_items);
XSync (xdisplay, FALSE);
if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()))
cheako@mx1:~$ # Show what a 'good' config looks like.
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
cheako@mx1:~$ xfconf-query -c pointers -p /HUION_H420_Pen_Pen_0/Properties/Coordinate_Transformation_Matrix -n -t double -s -1.1 -t double -s 0.2 -t double -s 1.3 -t double -s 0.4 -t double -s -1.5 -t double -s 1.6 -t double -s 0.7 -t double -s 0.8 -t double -s 1.9
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.100000, 1.300000, -1.500000, 0.700000, 1.900000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
cheako@mx1:~$ xinput set-prop "HUION H420 Pen Pen (0)" --type=float 'Coordinate Transformation Matrix' -1.1 0.2 1.3 0.4 -1.5 1.6 0.7 0.8 1.9
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.100000, 0.200000, 1.300000, 0.400000, -1.500000, 1.600000, 0.700000, 0.800000, 1.900000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
cheako@mx1:~$ xinput set-prop "HUION H420 Pen Pen (0)" --type=float 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
Strange, right?
I then used gdb to confirm the contents of data.c in both applications. Unsurprisingly, xinput uses much the same variable names. The parameters being passed are basically identical, so the only difference is the function used. So I applied the above patch and all is well.
cheako@mx1:~$ # Set the params how I'd like them.
cheako@mx1:~$ xfconf-query -c pointers -p /HUION_H420_Pen_Pen_0/Properties/Coordinate_Transformation_Matrix -n -t double -s -1 -t double -s 0 -t double -s 1 -t double -s 0 -t double -s -1 -t double -s 1 -t double -s 0 -t double -s 0 -t double -s 1
cheako@mx1:~$ # Look for that strange patern from b4.
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.000000, 1.000000, -1.000000, 0.000000, 1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
cheako@mx1:~$ # Just as you'd expect, broken like from the tests above.
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
unable to find device HUION H420 Pen Pen (0)
cheako@mx1:~$ xinput list-props "HUION H420 Pen Pen (0)"
Device 'HUION H420 Pen Pen (0)':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
Device Node (278): "/dev/input/event23"
Device Product ID (279): 9580, 110
libinput Tablet Tool Pressurecurve (779): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
Then working, after replacing the daemon with the patched one. It's kinda hard to show because I was using multiple terminals, but you'll just have to trust me.
I've tried just passing 18 parameters, but there is a sanity check that fails because 18 != 9.