summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-04-23 15:57:46 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-04-23 15:57:46 (GMT)
commitec2d71f0e4af0e0c286f0027d0242f456fdb2bb6 (patch)
treeb14bead28cdc879b52e4bf180788a939ba1ed71f
parent66ed5fc90fe44554e852a6f8dca4548154da781c (diff)
downloadQt-ec2d71f0e4af0e0c286f0027d0242f456fdb2bb6.zip
Qt-ec2d71f0e4af0e0c286f0027d0242f456fdb2bb6.tar.gz
Qt-ec2d71f0e4af0e0c286f0027d0242f456fdb2bb6.tar.bz2
Fix tests/manual/qtouchevent by choking mouse events even for ignored TouchUpdate and TouchEnd events.
The behavior we want is that no mouse events are sent if the widget accepts the TouchBegin.
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qapplication_win.cpp19
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;