Revert "qnsview_drag: only ignore key modifier while dragging 'within the application'"

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ø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7740ac36d27740ff9204cc2626f58620b7e214cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Timur Pocheptsov 2024-12-17 06:50:55 +01:00 committed by Qt Cherry-pick Bot
parent cc2213ab27
commit c39a944e74
2 changed files with 3 additions and 10 deletions

View File

@ -128,7 +128,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper);
// Text // Text
QString m_composingText; QString m_composingText;
QPointer<QObject> m_composingFocusObject; QPointer<QObject> m_composingFocusObject;
NSDraggingContext m_lastSeenContext;
} }
@synthesize colorSpace = m_colorSpace; @synthesize colorSpace = m_colorSpace;
@ -159,7 +158,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper);
m_lastKeyDead = false; m_lastKeyDead = false;
m_sendKeyEvent = false; m_sendKeyEvent = false;
m_currentlyInterpretedKeyEvent = nil; m_currentlyInterpretedKeyEvent = nil;
m_lastSeenContext = NSDraggingContextWithinApplication;
self.menuHelper = [[[QNSViewMenuHelper alloc] initWithView:self] autorelease]; self.menuHelper = [[[QNSViewMenuHelper alloc] initWithView:self] autorelease];
} }

View File

@ -45,8 +45,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context - (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{ {
Q_UNUSED(session); Q_UNUSED(session);
Q_UNUSED(context);
m_lastSeenContext = context;
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions()); 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 // Since Qt already takes care of tracking the keyboard modifiers, we
// don't need (or want) Cocoa to filter anything. Instead, we'll let // don't need (or want) Cocoa to filter anything. Instead, we'll let
// the application do the actual filtering. But only while dragging // the application do the actual filtering.
// within application, otherwise ignored modifiers may end up in a return YES;
// wrong drop operation executed.
return m_lastSeenContext == NSDraggingContextWithinApplication;
} }
- (BOOL)wantsPeriodicDraggingUpdates - (BOOL)wantsPeriodicDraggingUpdates
@ -253,8 +250,6 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
Q_UNUSED(screenPoint); Q_UNUSED(screenPoint);
Q_UNUSED(operation); Q_UNUSED(operation);
m_lastSeenContext = NSDraggingContextWithinApplication;
if (!m_platformWindow) if (!m_platformWindow)
return; return;