From: John Chadwick Subject: [PATCH] winex11.drv: Handle button events without axes. Message-Id: <20191119053922.7198-1-john@jchw.io> Date: Mon, 18 Nov 2019 21:39:22 -0800 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 --- 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