summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qt_cocoa_helpers_mac.mm
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2012-06-07 17:04:13 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-04 01:47:06 +0200
commit4bc2550e657ef1029919a15448f6f045354eeb96 (patch)
tree8405684abe4d8786c71abdca32396185ddc2fc2e /src/gui/kernel/qt_cocoa_helpers_mac.mm
parentca89c49fa2c5cbb3945897046f33eed9f7da846c (diff)
Ensure the mouse buttons are preserved when entering a widget
On Mac we have to fake the QEvent::Enter event when entering a widget so we need to ensure the buttons held down are set as part of that event otherwise it causes problems with graphicsview which will update the grabbed item based on this event. Task-number: QTBUG-19353 Change-Id: I89252a46b5edd0d82b6b1a0cf2592f72b472e5cc Reviewed-by: Nils Jeisecke <jeisecke@saltation.de> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui/kernel/qt_cocoa_helpers_mac.mm')
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index f1db0e3586..4e9d55721c 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1174,7 +1174,7 @@ static inline void qt_mac_checkEnterLeaveForNativeWidgets(QWidget *maybeEnterWid
}
}
-bool qt_mac_handleMouseEvent(NSEvent *event, QEvent::Type eventType, Qt::MouseButton button, QWidget *nativeWidget)
+bool qt_mac_handleMouseEvent(NSEvent *event, QEvent::Type eventType, Qt::MouseButton button, QWidget *nativeWidget, bool fakeEvent)
{
// Give the Input Manager a chance to process the mouse events.
NSInputManager *currentIManager = [NSInputManager currentInputManager];
@@ -1222,6 +1222,8 @@ bool qt_mac_handleMouseEvent(NSEvent *event, QEvent::Type eventType, Qt::MouseBu
if (GetEventParameter(carbonEvent, kEventParamMouseChord, typeUInt32, 0,
sizeof(mac_buttons), 0, &mac_buttons) == noErr)
buttons = qt_mac_get_buttons(mac_buttons);
+ if (fakeEvent && buttons == 0)
+ buttons = qt_mac_get_buttons(QApplication::mouseButtons());
}
// Send enter/leave events for the cases when QApplicationPrivate::sendMouseEvent do not: