summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2010-12-09 12:55:32 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-01-17 15:54:52 (GMT)
commitbdebd3a3c1f66f7e6a7e0b33f21573f07d31946a (patch)
treea4de7bf4f98a03a227a029df7f4dcc7fcaf25640 /src/gui
parent77a034bcba5b2c98ee5cf1b575086950a66203b3 (diff)
downloadQt-bdebd3a3c1f66f7e6a7e0b33f21573f07d31946a.zip
Qt-bdebd3a3c1f66f7e6a7e0b33f21573f07d31946a.tar.gz
Qt-bdebd3a3c1f66f7e6a7e0b33f21573f07d31946a.tar.bz2
Fix double click event on Mac OS X.
Fix an issue where the double click would be triggered even with different mouse buttons. Task-number: QTBUG-8222 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 4ea4bcc2ddea6fc6899c14bb50b22f58b51bf7ca)
Diffstat (limited to 'src/gui')
-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 462b30b..3820bfc 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -994,6 +994,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
NSInteger clickCount = [theEvent clickCount];
Qt::MouseButtons buttons = 0;
+ static Qt::MouseButton previousButton = Qt::NoButton;
{
UInt32 mac_buttons;
if (GetEventParameter(carbonEvent, kEventParamMouseChord, typeUInt32, 0,
@@ -1012,7 +1013,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
#ifndef QT_NAMESPACE
Q_ASSERT(clickCount > 0);
#endif
- if (clickCount % 2 == 0 && buttons == button)
+ if (clickCount % 2 == 0 && (previousButton == Qt::NoButton || previousButton == button))
eventType = QEvent::MouseButtonDblClick;
if (button == Qt::LeftButton && (keyMods & Qt::MetaModifier)) {
button = Qt::RightButton;
@@ -1046,6 +1047,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
QContextMenuEvent qcme(QContextMenuEvent::Mouse, qlocalPoint, qglobalPoint, keyMods);
qt_sendSpontaneousEvent(widgetToGetMouse, &qcme);
}
+ previousButton = button;
return true;
#endif
}