diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-29 13:44:08 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-29 15:52:54 (GMT) |
commit | 520a67e50ed7717518d3072f8568de00b791f20a (patch) | |
tree | 758f87ed34d6819bd1f6f91b9e16374555ddf7a2 /src/gui | |
parent | c4b9bccbecddbeeefc8ac9db91421ddaa2193858 (diff) | |
download | Qt-520a67e50ed7717518d3072f8568de00b791f20a.zip Qt-520a67e50ed7717518d3072f8568de00b791f20a.tar.gz Qt-520a67e50ed7717518d3072f8568de00b791f20a.tar.bz2 |
Use a widget attribute to keep track of whether or not TouchBegin has been accepted
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 12 |
3 files changed, 6 insertions, 8 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4e61f66..bc9b827 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4013,6 +4013,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = widget->testAttribute(Qt::WA_AcceptTouchEvents) && d->notify_helper(widget, touchEvent); eventAccepted = touchEvent->isAccepted(); + widget->setAttribute(Qt::WA_AcceptedTouchBeginEvent, res && eventAccepted); touchEvent->spont = false; if (res && eventAccepted) { // the first widget to accept the TouchBegin gets an implicit grab. diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 91857ec..ce7110d 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -429,7 +429,6 @@ 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 7e07104..f1fb0a4 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -4000,7 +4000,6 @@ void QApplicationPrivate::initializeMultitouch() CloseTouchInputHandle = static_cast<qt_CloseTouchInputHandlePtr>(library.resolve("CloseTouchInputHandle")); currentMultitouchWidget = 0; - currentMultitouchWidgetAcceptedTouchBegin = false; touchInputIDToTouchPointID.clear(); allTouchPoints.clear(); currentTouchPoints.clear(); @@ -4106,7 +4105,7 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) 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; + currentMultitouchWidget->setAttribute(Qt::WA_AcceptedTouchBeginEvent); } } @@ -4133,11 +4132,10 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) updateTouchPointsForWidget(widget, &touchEvent); if (sendTouchBegin) { - bool res = QApplication::sendSpontaneousEvent(widget, &touchEvent); - qt_tabletChokeMouse - = currentMultitouchWidgetAcceptedTouchBegin - = (res && touchEvent.isAccepted()); - } else if (currentMultitouchWidgetAcceptedTouchBegin) { + bool res = QApplication::sendSpontaneousEvent(widget, &touchEvent) + && touchEvent.isAccepted(); + qt_tabletChokeMouse = res; + } else if (widget->testAttribute(Qt::WA_AcceptedTouchBeginEvent)) { (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); qt_tabletChokeMouse = true; } else { |