Cocoa: move setting of drag accepted state

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 <morten.sorvig@qt.io>
This commit is contained in:
Morten Johan Sørvig 2017-12-14 12:22:52 +01:00
parent 9bd702a634
commit c223fdd917

View File

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