diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index aff93dd133..b8f0fc3cce 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; @@ -919,14 +935,11 @@ static QTouchDevice *touchDevice = 0; NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers]; NSString *characters = [nsevent characters]; - // [from Qt 4 impl] There is no way to get the scan code from carbon. But we cannot + // There is no way to get the scan code from carbon/cocoa. But we cannot // use the value 0, since it indicates that the event originates from somewhere // else than the keyboard. quint32 nativeScanCode = 1; - - UInt32 nativeVirtualKey = 0; - EventRef eventRef = EventRef([nsevent eventRef]); - GetEventParameter(eventRef, kEventParamKeyCode, typeUInt32, 0, sizeof(nativeVirtualKey), 0, &nativeVirtualKey); + quint32 nativeVirtualKey = [nsevent keyCode]; QChar ch = QChar::ReplacementCharacter; int keyCode = Qt::Key_unknown; |