diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-04-07 07:43:36 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-04-07 10:35:57 (GMT) |
commit | bb718c6a6e626b5b353884525223de5d7a178c2d (patch) | |
tree | 984633c407dfda98f5fb89aeb0cc4325395c834e | |
parent | d3ae1a9386a85475ba685cfc9a3009f119cad895 (diff) | |
download | Qt-bb718c6a6e626b5b353884525223de5d7a178c2d.zip Qt-bb718c6a6e626b5b353884525223de5d7a178c2d.tar.gz Qt-bb718c6a6e626b5b353884525223de5d7a178c2d.tar.bz2 |
Cocoa: mouse release event reports wrong button state
If you release the mouse over a non-client area, the following
mouse up event contains the mouse button that was released in the
'buttons' state. This is wrong, according to the documentation
(and the native events auto test!)
Reviewed-by: msorvig
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index b1e4c94..a05c7d5 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -882,7 +882,15 @@ void qt_mac_dispatchNCMouseMessage(void * /* NSWindow* */eventWindow, void * /* } } - QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, button, keyMods); + Qt::MouseButtons buttons = 0; + { + UInt32 mac_buttons; + if (GetEventParameter((EventRef)[event eventRef], kEventParamMouseChord, typeUInt32, 0, + sizeof(mac_buttons), 0, &mac_buttons) == noErr) + buttons = qt_mac_get_buttons(mac_buttons); + } + + QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, buttons, keyMods); qt_sendSpontaneousEvent(widgetToGetEvent, &qme); // We don't need to set the implicit grab widget here because we won't |