[PATCH] winex11.drv: Handle button events without axes.

John Chadwick john at jchw.io
Mon Nov 18 23:39:22 CST 2019


Not all XInput events contain axes information. In particular, libinput
does not seem to provide axes information on button_event.

In effect, before this patch, with some configurations, wintab32 clients
would see a point at 0, 0 before and after each stroke.

Signed-off-by: John Chadwick <john at jchw.io>
---
 dlls/winex11.drv/wintab.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index fe3d4a8ff4..2a4af41af7 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -929,8 +929,13 @@ static BOOL button_event( HWND hwnd, XEvent *event )
     gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(button->time);
     gMsgPacket.pkSerialNumber = gSerial++;
     gMsgPacket.pkCursor = curnum;
-    gMsgPacket.pkX = button->axis_data[0];
-    gMsgPacket.pkY = button->axis_data[1];
+    if (button->axes_count > 0) {
+        gMsgPacket.pkX = button->axis_data[0];
+        gMsgPacket.pkY = button->axis_data[1];
+    } else {
+        gMsgPacket.pkX = last_packet.pkX;
+        gMsgPacket.pkY = last_packet.pkY;
+    }
     gMsgPacket.pkOrientation.orAzimuth = figure_deg(button->axis_data[3],button->axis_data[4]);
     gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max(abs(button->axis_data[3]),
                                                             abs(button->axis_data[4])))
-- 
2.23.0




More information about the wine-devel mailing list