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>
bb10
J-P Nurmi 2013-08-05 13:42:51 +02:00 committed by The Qt Project
parent a1527fd8e6
commit 652d51eda6
1 changed files with 17 additions and 1 deletions

View File

@ -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;