From c223fdd9171999cb84b00fc3972f5bfb0c2bf71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 14 Dec 2017 12:22:52 +0100 Subject: [PATCH] Cocoa: move setting of drag accepted state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit performDragOperation:sender is called when an application window receives a drop, either from an application sourced drag or from a foreign drag. draggingSession:endedAtPoint:operation is called when an application sourced drag ends, either on an application window or on a foreign window. Update the drag accepted state when the session ends in order to handle DnD from the application to a non-application window. Task-number: QTBUG-63794 Change-Id: If3e16ed6a086c5d051e7390e3ecf16ea210221ad Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 32f73759c2..af16ed103e 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -2004,10 +2004,6 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QCocoaDropData mimeData([sender draggingPasteboard]); response = QWindowSystemInterface::handleDrop(target, &mimeData, mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); } - if (response.isAccepted()) { - QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); - nativeDrag->setAcceptedAction(response.acceptedAction()); - } return response.isAccepted(); } @@ -2025,6 +2021,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin if (!target) return; + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation)); + // keep our state, and QGuiApplication state (buttons member) in-sync, // or future mouse events will be processed incorrectly NSUInteger pmb = [NSEvent pressedMouseButtons];