Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 56616)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 56617)
@@ -99,4 +99,13 @@
 /* Other includes: */
 #include <math.h>
+
+
+#ifdef DEBUG_andy
+/* Macro for debugging drag and drop actions which usually would
+ * go to Main's logging group. */
+# define DNDDEBUG(x) LogRel(x)
+#else
+# define DNDDEBUG(x)
+#endif
 
 
@@ -1430,5 +1439,4 @@
 #endif
                  && machine().GetDnDMode() != KDnDMode_Disabled;
-    LogRelFunc(("fAccept=%RTbool\n", fAccept));
     return fAccept;
 }
@@ -1444,21 +1452,24 @@
     AssertPtrReturnVoid(pEvent);
 
-    if (!dragAndDropCanAccept())
-        return;
-
-    /* Get mouse-pointer location. */
-    const QPoint &cpnt = viewportToContents(pEvent->pos());
-
-    /* Ask the target for starting a DnD event. */
-    Qt::DropAction result = m_pDnDHandler->dragEnter(screenId(),
-                                                     frameBuffer()->convertHostXTo(cpnt.x()),
-                                                     frameBuffer()->convertHostYTo(cpnt.y()),
-                                                     pEvent->proposedAction(),
-                                                     pEvent->possibleActions(),
-                                                     pEvent->mimeData());
-
-    /* Set the DnD action returned by the guest. */
-    pEvent->setDropAction(result);
-    pEvent->accept();
+    int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED;
+    if (RT_SUCCESS(rc))
+    {
+        /* Get mouse-pointer location. */
+        const QPoint &cpnt = viewportToContents(pEvent->pos());
+
+        /* Ask the target for starting a DnD event. */
+        Qt::DropAction result = m_pDnDHandler->dragEnter(screenId(),
+                                                         frameBuffer()->convertHostXTo(cpnt.x()),
+                                                         frameBuffer()->convertHostYTo(cpnt.y()),
+                                                         pEvent->proposedAction(),
+                                                         pEvent->possibleActions(),
+                                                         pEvent->mimeData());
+
+        /* Set the DnD action returned by the guest. */
+        pEvent->setDropAction(result);
+        pEvent->accept();
+    }
+
+    DNDDEBUG(("DnD: dragEnterEvent ended with rc=%Rrc\n", rc));
 }
 
@@ -1467,21 +1478,24 @@
     AssertPtrReturnVoid(pEvent);
 
-    if (!dragAndDropCanAccept())
-        return;
-
-    /* Get mouse-pointer location. */
-    const QPoint &cpnt = viewportToContents(pEvent->pos());
-
-    /* Ask the guest for moving the drop cursor. */
-    Qt::DropAction result = m_pDnDHandler->dragMove(screenId(),
-                                                    frameBuffer()->convertHostXTo(cpnt.x()),
-                                                    frameBuffer()->convertHostYTo(cpnt.y()),
-                                                    pEvent->proposedAction(),
-                                                    pEvent->possibleActions(),
-                                                    pEvent->mimeData());
-
-    /* Set the DnD action returned by the guest. */
-    pEvent->setDropAction(result);
-    pEvent->accept();
+    int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED;
+    if (RT_SUCCESS(rc))
+    {
+        /* Get mouse-pointer location. */
+        const QPoint &cpnt = viewportToContents(pEvent->pos());
+
+        /* Ask the guest for moving the drop cursor. */
+        Qt::DropAction result = m_pDnDHandler->dragMove(screenId(),
+                                                        frameBuffer()->convertHostXTo(cpnt.x()),
+                                                        frameBuffer()->convertHostYTo(cpnt.y()),
+                                                        pEvent->proposedAction(),
+                                                        pEvent->possibleActions(),
+                                                        pEvent->mimeData());
+
+        /* Set the DnD action returned by the guest. */
+        pEvent->setDropAction(result);
+        pEvent->accept();
+    }
+
+    DNDDEBUG(("DnD: dragMoveEvent ended with rc=%Rrc\n", rc));
 }
 
@@ -1490,10 +1504,13 @@
     AssertPtrReturnVoid(pEvent);
 
-    if (!dragAndDropCanAccept())
-        return;
-
-    m_pDnDHandler->dragLeave(screenId());
-
-    pEvent->accept();
+    int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED;
+    if (RT_SUCCESS(rc))
+    {
+        m_pDnDHandler->dragLeave(screenId());
+
+        pEvent->accept();
+    }
+
+    DNDDEBUG(("DnD: dragLeaveEvent ended with rc=%Rrc\n", rc));
 }
 
@@ -1519,5 +1536,5 @@
 #endif
 
-    LogRel3(("DnD: dragCheckPending ended with rc=%Rrc\n", rc));
+    DNDDEBUG(("DnD: dragCheckPending ended with rc=%Rrc\n", rc));
     return rc;
 }
@@ -1544,5 +1561,5 @@
 #endif
 
-    LogRel3(("DnD: dragStart ended with rc=%Rrc\n", rc));
+    DNDDEBUG(("DnD: dragStart ended with rc=%Rrc\n", rc));
     return rc;
 }
@@ -1563,5 +1580,5 @@
 #endif
 
-    LogRel3(("DnD: dragStop ended with rc=%Rrc\n", rc));
+    DNDDEBUG(("DnD: dragStop ended with rc=%Rrc\n", rc));
     return rc;
 }
@@ -1571,21 +1588,24 @@
     AssertPtrReturnVoid(pEvent);
 
-    if (!dragAndDropCanAccept())
-        return;
-
-    /* Get mouse-pointer location. */
-    const QPoint &cpnt = viewportToContents(pEvent->pos());
-
-    /* Ask the guest for dropping data. */
-    Qt::DropAction result = m_pDnDHandler->dragDrop(screenId(),
-                                                    frameBuffer()->convertHostXTo(cpnt.x()),
-                                                    frameBuffer()->convertHostYTo(cpnt.y()),
-                                                    pEvent->proposedAction(),
-                                                    pEvent->possibleActions(),
-                                                    pEvent->mimeData());
-
-    /* Set the DnD action returned by the guest. */
-    pEvent->setDropAction(result);
-    pEvent->accept();
+    int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED;
+    if (RT_SUCCESS(rc))
+    {
+        /* Get mouse-pointer location. */
+        const QPoint &cpnt = viewportToContents(pEvent->pos());
+
+        /* Ask the guest for dropping data. */
+        Qt::DropAction result = m_pDnDHandler->dragDrop(screenId(),
+                                                        frameBuffer()->convertHostXTo(cpnt.x()),
+                                                        frameBuffer()->convertHostYTo(cpnt.y()),
+                                                        pEvent->proposedAction(),
+                                                        pEvent->possibleActions(),
+                                                        pEvent->mimeData());
+
+        /* Set the DnD action returned by the guest. */
+        pEvent->setDropAction(result);
+        pEvent->accept();
+    }
+
+    DNDDEBUG(("DnD: dropEvent ended with rc=%Rrc\n", rc));
 }
 #endif /* VBOX_WITH_DRAG_AND_DROP */
