winex11.drv: Handle button events without axes.

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

Signed-off-by: John Chadwick <john@jchw.io>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
John Chadwick 2019-11-19 23:23:22 -08:00 committed by Alexandre Julliard
parent 7cc2806e0e
commit 4506b468d4
1 changed files with 14 additions and 7 deletions

View File

@ -929,6 +929,7 @@ static BOOL button_event( HWND hwnd, XEvent *event )
gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(button->time); gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(button->time);
gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkSerialNumber = gSerial++;
gMsgPacket.pkCursor = curnum; gMsgPacket.pkCursor = curnum;
if (button->axes_count > 0) {
gMsgPacket.pkX = button->axis_data[0]; gMsgPacket.pkX = button->axis_data[0];
gMsgPacket.pkY = button->axis_data[1]; gMsgPacket.pkY = button->axis_data[1];
gMsgPacket.pkOrientation.orAzimuth = figure_deg(button->axis_data[3],button->axis_data[4]); gMsgPacket.pkOrientation.orAzimuth = figure_deg(button->axis_data[3],button->axis_data[4]);
@ -936,6 +937,12 @@ static BOOL button_event( HWND hwnd, XEvent *event )
abs(button->axis_data[4]))) abs(button->axis_data[4])))
* (gMsgPacket.pkStatus & TPS_INVERT?-1:1)); * (gMsgPacket.pkStatus & TPS_INVERT?-1:1));
gMsgPacket.pkNormalPressure = button->axis_data[2]; gMsgPacket.pkNormalPressure = button->axis_data[2];
} else {
gMsgPacket.pkX = last_packet.pkX;
gMsgPacket.pkY = last_packet.pkY;
gMsgPacket.pkOrientation = last_packet.pkOrientation;
gMsgPacket.pkNormalPressure = last_packet.pkNormalPressure;
}
gMsgPacket.pkButtons = get_button_state(curnum); gMsgPacket.pkButtons = get_button_state(curnum);
gMsgPacket.pkChanged = get_changed_state(&gMsgPacket); gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd); SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);