Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
6.2.1
Description
On ubuntu 20.04, if I keep my finger on the screen and then tap the screen with pen. All subsequent touch interactions only have touch update events.
I debugged the QT source and found the root cause.
In QXcbConnection::xi2ProcessTouch, if xiDeviceEvent->event_type is XCB_INPUT_TOUCH_BEGIN, dev will add 1 touchPoints. The touchPoints added when xiDeviceEvent->event_type is XCB_INPUT_TOUCH_END will be removed. There is no problem with this logic.
But ubuntu20.04 has a bug, if touch is on the screen and tap the screen with pen, the touch will be interrupted. At this time, the touch end event will not be received. So dev's touchPoints will not be deleted. The next time qt receives XCB_INPUT_TOUCH_BEGIN, dev's touchPoints will be added by 1, for a total of 2. The event types are Stationary and Pressed.
In QWindowSystemInterfacePrivate::fromNativeTouchPoints, because points contains 2 points and the types are Stationary and Pressed, states are QEventPoint::State::Pressed|QEventPoint::State::Stationary. So type will not be set to QEvent::TouchBegin and QEvent::TouchEnd. So all touch interactions only have touch update events. It can only be restored by restarting the app.
This problem does not reproduce in ubuntu 18.04. Although I don't think it's a Qt bug. But I don't know how to fix it. If anyone knows how to fix it please let me know. thanks.