From 9cb92d106d9de92d25aa29423a59658f152f5791 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 4 Nov 2015 12:48:31 +0100 Subject: Cocoa integration - do not send move events while in -draggingUpdated: Looks like it's not a good idea to send constant 'fake' mouse move events while mouse is actually moving (mouseDragged/rightMouseDragged) + we're receiving -dragginUpdated:. Change-Id: Ibed5def3d8f06b764dea6c2cd196e37ca19ce967 Task-number: QTBUG-49204 Reviewed-by: Gabriel de Dietrich Reviewed-by: Filipe Azevedo --- src/plugins/platforms/cocoa/qnsview.h | 1 + src/plugins/platforms/cocoa/qnsview.mm | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index de28b8d74a..bad67f2516 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -75,6 +75,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper; bool m_resendKeyEvent; bool m_scrolling; + bool m_updatingDrag; bool m_exposedOnMoveToWindow; NSEvent *m_currentlyInterpretedKeyEvent; bool m_isMenuView; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index faa048874f..aac50e7833 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -153,6 +153,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; m_resendKeyEvent = false; m_scrolling = false; + m_updatingDrag = false; m_currentlyInterpretedKeyEvent = 0; if (!touchDevice) { @@ -1917,6 +1918,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // Make sure the cursor is updated correctly if the mouse does not move and window is under cursor // by creating a fake move event + if (m_updatingDrag) + return; + const QPoint mousePos(QCursor::pos()); CGEventRef moveEvent(CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, @@ -1934,7 +1938,11 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (NSDragOperation)draggingUpdated:(id )sender { - return [self handleDrag : sender]; + m_updatingDrag = true; + const NSDragOperation ret([self handleDrag : sender]); + m_updatingDrag = false; + + return ret; } // Sends drag update to Qt, return the action -- cgit v1.2.3