From c39a944e7489f18dc6da27c4b751bedc51072786 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 17 Dec 2024 06:50:55 +0100 Subject: [PATCH] Revert "qnsview_drag: only ignore key modifier while dragging 'within the application'" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4332cb313469de1525afe3cddd792d7bc7e08a14. The original idea of distinguishing between context (outside/within application) is not working anymore - it's always outside (except the moment when a mouse pressed inside the window, which is immediately followed by 'outside application' context). So in fact we never ignore key modifiers. Fixes: QTBUG-132091 Pick-to: 6.8 Change-Id: I560a48ccf8f8ee1a55f812be6af18b1dd7e25c78 Reviewed-by: Tor Arne Vestbø (cherry picked from commit 7740ac36d27740ff9204cc2626f58620b7e214cb) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnsview.mm | 2 -- src/plugins/platforms/cocoa/qnsview_dragging.mm | 11 +++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 560cada5fb4..83a5ded1207 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -128,7 +128,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper); // Text QString m_composingText; QPointer m_composingFocusObject; - NSDraggingContext m_lastSeenContext; } @synthesize colorSpace = m_colorSpace; @@ -159,7 +158,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper); m_lastKeyDead = false; m_sendKeyEvent = false; m_currentlyInterpretedKeyEvent = nil; - m_lastSeenContext = NSDraggingContextWithinApplication; self.menuHelper = [[[QNSViewMenuHelper alloc] initWithView:self] autorelease]; } diff --git a/src/plugins/platforms/cocoa/qnsview_dragging.mm b/src/plugins/platforms/cocoa/qnsview_dragging.mm index 4f7d35a0d64..b4c82ddc0d8 100644 --- a/src/plugins/platforms/cocoa/qnsview_dragging.mm +++ b/src/plugins/platforms/cocoa/qnsview_dragging.mm @@ -45,8 +45,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { Q_UNUSED(session); + Q_UNUSED(context); - m_lastSeenContext = context; QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions()); } @@ -61,11 +61,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // // Since Qt already takes care of tracking the keyboard modifiers, we // don't need (or want) Cocoa to filter anything. Instead, we'll let - // the application do the actual filtering. But only while dragging - // within application, otherwise ignored modifiers may end up in a - // wrong drop operation executed. - - return m_lastSeenContext == NSDraggingContextWithinApplication; + // the application do the actual filtering. + return YES; } - (BOOL)wantsPeriodicDraggingUpdates @@ -253,8 +250,6 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Q_UNUSED(screenPoint); Q_UNUSED(operation); - m_lastSeenContext = NSDraggingContextWithinApplication; - if (!m_platformWindow) return;