diff options
author | Andy Shaw <andy.shaw@nokia.com> | 2009-12-03 11:53:41 (GMT) |
---|---|---|
committer | Andy Shaw <andy.shaw@nokia.com> | 2009-12-03 11:54:36 (GMT) |
commit | ae87d2ac8f4ee62de5c9ec59ee575cf3678fa367 (patch) | |
tree | 64df6cbbe2dfcf2abf9bc39c6586ed3a0694ff02 /src/gui/kernel | |
parent | ad8e34ff448b4e261da65cc5210664f150736bba (diff) | |
download | Qt-ae87d2ac8f4ee62de5c9ec59ee575cf3678fa367.zip Qt-ae87d2ac8f4ee62de5c9ec59ee575cf3678fa367.tar.gz Qt-ae87d2ac8f4ee62de5c9ec59ee575cf3678fa367.tar.bz2 |
Ensure the button state is correct when creating a QWheelEvent on Mac.
On Mac when we receive a scrollWheel event on Carbon or Cocoa then
we need to use QApplication::mouseButtons() in order to ensure the
QWheelEvent has the right button states set. This is because the
buttons state information is not passed in the native event at all.
Reviewed-by: MortenS
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 22a0959..688e51f 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1687,7 +1687,10 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event UInt32 mac_buttons = 0; GetEventParameter(event, kEventParamMouseChord, typeUInt32, 0, sizeof(mac_buttons), 0, &mac_buttons); - buttons = qt_mac_get_buttons(mac_buttons); + if (ekind != kEventMouseWheelMoved) + buttons = qt_mac_get_buttons(mac_buttons); + else + buttons = QApplication::mouseButtons(); } int wheel_deltaX = 0; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 000f223..ddd8ca6 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -779,7 +779,7 @@ extern "C" { NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint qlocal = QPoint(localPoint.x, flipYCoordinate(localPoint.y)); QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y)); - Qt::MouseButton buttons = cocoaButton2QtButton([theEvent buttonNumber]); + Qt::MouseButtons buttons = QApplication::mouseButtons(); bool wheelOK = false; Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]); QWidget *widgetToGetMouse = qwidget; |