diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2016-05-19 16:49:45 -0700 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-05-24 06:13:11 +0000 |
commit | b092f681cf571a1c3068007d1a46633e5ab8b52f (patch) | |
tree | 1a6e641b598cb226ad3c4ae34596fb0d41256436 /src | |
parent | a324194b5965b4232b01e38c32741eadc130e8d1 (diff) |
QNSView: Reset the internal buttons state after dragging ends
We only track left and right mouse buttons when dragging. But
some applications may do this with other mouse buttons.
In this case, instead of tracking which button was pressed and
which one was released, we just ask Cocoa for the current state.
Change-Id: I0df7799b7ae6d7816377f881bc0ede867737d245
Task-number: QTBUG-53374
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 0d58faa5bf..6117e3f2e9 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -2070,7 +2070,11 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // keep our state, and QGuiApplication state (buttons member) in-sync, // or future mouse events will be processed incorrectly - m_buttons &= ~(m_sendUpAsRightButton ? Qt::RightButton : Qt::LeftButton); + NSUInteger pmb = [NSEvent pressedMouseButtons]; + for (int buttonNumber = 0; buttonNumber < 32; buttonNumber++) { // see cocoaButton2QtButton() for the 32 value + if (!(pmb & (1 << buttonNumber))) + m_buttons &= ~cocoaButton2QtButton(buttonNumber); + } NSPoint windowPoint = [self convertPoint: point fromView: nil]; QPoint qtWindowPoint(windowPoint.x, windowPoint.y); |