Cocoa: Update deprecated dragging session APIs
Change-Id: I06e2dd3861c4bc5d85421ac71daf188732279e77 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
parent
23ea54d861
commit
4c002a8343
@ -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,9 +2078,11 @@ 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)
|
||||
@ -2091,11 +2096,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user