From 020b10e8288c981bffe1a6470ece25ec6c532b73 Mon Sep 17 00:00:00 2001
From: Prasanth Ullattil <prasanth.ullattil@nokia.com>
Date: Mon, 21 Dec 2009 13:45:18 +0100
Subject: Drag and drop icon not updated correctly in Cocoa.

QDragMoveEvent is compressed using the answer rect in QCocoaView. The
result of the last sendEvent is saved, so that we dont have to generate
a new event always. This saved result was not updated correctly when the
event was ignored.

Task-number: QTBUG-5186
Reviewed-by: Richard Moe Gustavsen
---
 src/gui/kernel/qcocoaview_mac.mm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 6c06746..3352dbd 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -349,7 +349,9 @@ extern "C" {
             // since we accepted the drag enter event, the widget expects
             // future drage move events.
             // ### check if we need to treat this like the drag enter event.
-            nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction());
+            nsActions = NSDragOperationNone;
+            // Save as ignored in the answer rect.
+            qDMEvent.setDropAction(Qt::IgnoreAction);
         } else {
             nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
         }
@@ -357,7 +359,6 @@ extern "C" {
         return nsActions;
     }
  }
-
 - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
 {
     NSPoint windowPoint = [sender draggingLocation];
@@ -402,13 +403,15 @@ extern "C" {
     qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
     qDMEvent.accept();
     QApplication::sendEvent(qwidget, &qDMEvent);
-    qt_mac_copy_answer_rect(qDMEvent);
 
     NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction());
     if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) {
         // ignore this event (we will still receive further notifications)
         operation = NSDragOperationNone;
+        // Save as ignored in the answer rect.
+        qDMEvent.setDropAction(Qt::IgnoreAction);
     }
+    qt_mac_copy_answer_rect(qDMEvent);
     return operation;
 }
 
-- 
cgit v0.12