xcb: send QTabletEvent before QMouseEvent

It was a regression: drawing applications which can handle both mouse
and tablet events should not need to wait to see whether a mouse event
will be followed by a corresponding tablet event.  The tablet event is
preferred because it has all the tablet parameters (pressure etc.)
Also, show the timestamp of each mouse event in the log message,
which helps to verify the correspondence.

Task-number: QTBUG-47702
Change-Id: I9e832c19de935ec1243138eb4c1484284f61cbfc
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
bb10
Shawn Rutledge 2015-08-19 15:22:53 +02:00 committed by Shawn Rutledge
parent 6a57a260fc
commit cc6a06632b
2 changed files with 13 additions and 12 deletions

View File

@ -971,15 +971,6 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q
xXIGenericDeviceEvent *xiEvent = static_cast<xXIGenericDeviceEvent *>(event);
xXIDeviceEvent *xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(xiEvent);
#ifdef XCB_USE_XINPUT22
// Synthesize mouse events since otherwise there are no mouse events from
// the pen on the XI 2.2+ path.
if (xi2MouseEvents() && eventListener)
eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event));
#else
Q_UNUSED(eventListener);
#endif
switch (xiEvent->evtype) {
case XI_ButtonPress: {
Qt::MouseButton b = xiToQtMouseButton(xiDeviceEvent->detail);
@ -1064,6 +1055,16 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q
handled = false;
break;
}
#ifdef XCB_USE_XINPUT22
// Synthesize mouse events since otherwise there are no mouse events from
// the pen on the XI 2.2+ path.
if (xi2MouseEvents() && eventListener)
eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event));
#else
Q_UNUSED(eventListener);
#endif
return handled;
}

View File

@ -2249,17 +2249,17 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event)
switch (ev->evtype) {
case XI_ButtonPress:
qCDebug(lcQpaXInput, "XI2 mouse press, button %d", button);
qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d", button, ev->time);
conn->setButton(button, true);
handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time);
break;
case XI_ButtonRelease:
qCDebug(lcQpaXInput, "XI2 mouse release, button %d", button);
qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d", button, ev->time);
conn->setButton(button, false);
handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time);
break;
case XI_Motion:
qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d", event_x, event_y);
qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d", event_x, event_y, ev->time);
handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time);
break;
default: