From 08de984f0ed5b6e13cd802256df859778f842bbd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 4 Dec 2009 11:35:14 +0100 Subject: Cocoa: amend dnd optimization: 067cab5af A couple of minutes after commiting 067cab5af, I realized I need to act a bit more nice to native NSViews that also might exist in the window: Let NSWindow handle the dnd drop if the view is not a QWidget (and not also if it is a QWidget, but not subscribing to dnd) Task-number: QT-1586 --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index 8dd03aa..cc5839c 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -293,21 +293,27 @@ QT_END_NAMESPACE - (void)draggingExited:(id < NSDraggingInfo >)sender { - if (*currentDragTarget()) + QWidget *target = [self dragTargetHitTest:sender]; + if (!target) + return [super draggingExited:sender]; + + if (*currentDragTarget()) { [reinterpret_cast((*currentDragTarget())->winId()) draggingExited:sender]; - else - [super draggingExited:sender]; - *currentDragTarget() = 0; + *currentDragTarget() = 0; + } } - (BOOL)performDragOperation:(id < NSDraggingInfo >)sender { - BOOL dropAccepted = NO; - if (*currentDragTarget()) - dropAccepted = [reinterpret_cast((*currentDragTarget())->winId()) performDragOperation:sender]; - else + QWidget *target = [self dragTargetHitTest:sender]; + if (!target) return [super performDragOperation:sender]; - *currentDragTarget() = 0; - return dropAccepted; + + BOOL dropResult = NO; + if (*currentDragTarget()) { + dropResult = [reinterpret_cast((*currentDragTarget())->winId()) performDragOperation:sender]; + *currentDragTarget() = 0; + } + return dropResult; } -- cgit v0.12