diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-08-05 13:42:51 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-09 13:39:42 +0200 |
commit | 652d51eda6eaf8a06268e4e4cdf078e8771ad6ab (patch) | |
tree | f65474eba86690241b15e43cc5c0bf3aed4dba31 /src/plugins | |
parent | a1527fd8e6afc42701e217314f7b3772e638e2a1 (diff) |
Cocoa: support QWheelEvent::Phase
The started & ended phases are required for implementing correctly
behaving transient scrollbars (ie. they become and stay visible when
touching the pad with two fingers).
Change-Id: I718d991ba6fd7e949cf9790f3bae285000fce576
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 288d4b4742..285e4aeb9f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -876,7 +876,23 @@ static QTouchDevice *touchDevice = 0; currentWheelModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]]; } - QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers); + QWheelEvent::Phase ph = QWheelEvent::Changed; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 + if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { + // On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin. + if (phase == NSEventPhaseMayBegin) + ph = QWheelEvent::Started; + } else +#endif + if (phase == NSEventPhaseBegan) { + // On 10.7, MayBegin will not happen, so Began is the actual beginning. + ph = QWheelEvent::Started; + } + if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) { + ph = QWheelEvent::Ended; + } + + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph); if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) { currentWheelModifiers = Qt::NoModifier; |