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 <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
This commit is contained in:
Timur Pocheptsov 2015-11-04 12:48:31 +01:00
parent c8c39ecc37
commit 9cb92d106d
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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 <NSDraggingInfo>)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