summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-08-05 11:41:47 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-08-11 17:24:16 +0000
commit4c002a8343baa8453a5485ce7939569bfc5b3267 (patch)
tree2fa291eeab566b10016a39783f31260d113dc6a2 /src/plugins
parent23ea54d861be1b68e5df4264c75e0e8d0f5d3c04 (diff)
Cocoa: Update deprecated dragging session APIs
Change-Id: I06e2dd3861c4bc5d85421ac71daf188732279e77 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 784b1ca14b..c67bcfd23b 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1913,15 +1913,18 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
return target->mapFromGlobal(source->mapToGlobal(point));
}
-- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal
+- (NSDragOperation)draggingSession:(NSDraggingSession *)session
+ sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{
- Q_UNUSED(isLocal);
+ Q_UNUSED(session);
+ Q_UNUSED(context);
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions());
}
-- (BOOL) ignoreModifierKeysWhileDragging
+- (BOOL)ignoreModifierKeysForDraggingSession:(NSDraggingSession *)session
{
+ Q_UNUSED(session);
// According to the "Dragging Sources" chapter on Cocoa DnD Programming
// (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html),
// if the control, option, or command key is pressed, the source’s
@@ -2075,27 +2078,27 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
return response.isAccepted();
}
-- (void)draggedImage:(NSImage*) img endedAt:(NSPoint) point operation:(NSDragOperation) operation
+- (void)draggingSession:(NSDraggingSession *)session
+ endedAtPoint:(NSPoint)screenPoint
+ operation:(NSDragOperation)operation
{
- Q_UNUSED(img);
+ Q_UNUSED(session);
Q_UNUSED(operation);
QWindow *target = findEventTargetWindow(m_window);
if (!target)
return;
-// keep our state, and QGuiApplication state (buttons member) in-sync,
-// or future mouse events will be processed incorrectly
+ // keep our state, and QGuiApplication state (buttons member) in-sync,
+ // or future mouse events will be processed incorrectly
NSUInteger pmb = [NSEvent pressedMouseButtons];
for (int buttonNumber = 0; buttonNumber < 32; buttonNumber++) { // see cocoaButton2QtButton() for the 32 value
if (!(pmb & (1 << buttonNumber)))
m_buttons &= ~cocoaButton2QtButton(buttonNumber);
}
- NSPoint windowPoint = [self convertPoint: point fromView: nil];
+ NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin;
QPoint qtWindowPoint(windowPoint.x, windowPoint.y);
- NSWindow *window = [self window];
- NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(point.x, point.y, 0, 0)].origin;
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons);