diff options
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index ce7110d..91857ec 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -429,6 +429,7 @@ public: #endif QPointer<QWidget> currentMultitouchWidget; + bool currentMultitouchWidgetAcceptedTouchBegin; static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); #if defined(Q_WS_WIN) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 4878ea7..5a4efd6 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -4003,6 +4003,7 @@ void QApplicationPrivate::initializeMultitouch() CloseTouchInputHandle = static_cast<qt_CloseTouchInputHandlePtr>(library.resolve("CloseTouchInputHandle")); currentMultitouchWidget = 0; + currentMultitouchWidgetAcceptedTouchBegin = false; touchInputIDToTouchPointID.clear(); allTouchPoints.clear(); currentTouchPoints.clear(); @@ -4106,6 +4107,9 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) if (!child) child = window; currentMultitouchWidget = child; + // if the TouchBegin handler recurses, we assume that means the event + // has been implicitly accepted and continue to send touch events + currentMultitouchWidgetAcceptedTouchBegin = true; } } @@ -4131,8 +4135,19 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) q->keyboardModifiers(), activeTouchPoints); updateTouchPointsForWidget(widget, &touchEvent); - bool res = QApplication::sendSpontaneousEvent(widget, &touchEvent); - return (qt_tabletChokeMouse = res && touchEvent.isAccepted()); + if (sendTouchBegin) { + bool res = QApplication::sendSpontaneousEvent(widget, &touchEvent); + qt_tabletChokeMouse + = currentMultitouchWidgetAcceptedTouchBegin + = (res && touchEvent.isAccepted()); + } else if (currentMultitouchWidgetAcceptedTouchBegin) { + (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); + qt_tabletChokeMouse = true; + } else { + qt_tabletChokeMouse = false; + } + + return qt_tabletChokeMouse; } return false; |