Windows QPA: Fix handling of mouse messages synthesized by the OS
The old handler only marked mouse events associated with mouse messages synthesized by the OS with Qt::MouseEventSynthesizedBySystem when these messages resulted from touch screen, not tablet input. Quick seems to depend on this behavior. Fixes: QTBUG-76617 Change-Id: Ib863d73ae9325f9a19d8a175817fef4e82f7df0b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
de8bd9ec6b
commit
786c588171
@ -80,13 +80,12 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q
|
||||
*result = 0;
|
||||
const quint32 pointerId = GET_POINTERID_WPARAM(msg.wParam);
|
||||
|
||||
POINTER_INPUT_TYPE pointerType;
|
||||
if (!QWindowsContext::user32dll.getPointerType(pointerId, &pointerType)) {
|
||||
if (!QWindowsContext::user32dll.getPointerType(pointerId, &m_pointerType)) {
|
||||
qWarning() << "GetPointerType() failed:" << qt_error_string();
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pointerType) {
|
||||
switch (m_pointerType) {
|
||||
case QT_PT_POINTER:
|
||||
case QT_PT_MOUSE:
|
||||
case QT_PT_TOUCHPAD: {
|
||||
@ -728,7 +727,11 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window,
|
||||
}
|
||||
|
||||
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
|
||||
if (isMouseEventSynthesizedFromPenOrTouch()) {
|
||||
// Following the logic of the old mouse handler, only events synthesized
|
||||
// for touch screen are marked as such. On some systems, using the bit 7 of
|
||||
// the extra msg info for checking if synthesized for touch does not work,
|
||||
// so we use the pointer type of the last pointer message.
|
||||
if (isMouseEventSynthesizedFromPenOrTouch() && m_pointerType == QT_PT_TOUCH) {
|
||||
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)
|
||||
return false;
|
||||
source = Qt::MouseEventSynthesizedBySystem;
|
||||
|
@ -82,6 +82,7 @@ private:
|
||||
bool m_needsEnterOnPointerUpdate = false;
|
||||
QEvent::Type m_lastEventType = QEvent::None;
|
||||
Qt::MouseButton m_lastEventButton = Qt::NoButton;
|
||||
DWORD m_pointerType = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user