b=497498 use nsDragService::SetCanDrop instead of nsIDragSessionGTK::StartDragMotion to reset before NS_DRAGDROP_OVER r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 17 Apr 2012 13:00:25 +1200
changeset 91809 46b2bf54dd1e1de503f2b990a49ab63b02d1b953
parent 91808 3a94918698987fc1382e7a5cd4d45e4c42ac1dd4
child 91810 fadcc45f8fe80aa5a52c96cf1422efc31981faab
push id8402
push userktomlinson@mozilla.com
push dateTue, 17 Apr 2012 05:01:09 +0000
treeherdermozilla-inbound@96e8cc4b2b20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs497498
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=497498 use nsDragService::SetCanDrop instead of nsIDragSessionGTK::StartDragMotion to reset before NS_DRAGDROP_OVER r=roc
widget/gtk2/nsDragService.cpp
widget/gtk2/nsWindow.cpp
--- a/widget/gtk2/nsDragService.cpp
+++ b/widget/gtk2/nsDragService.cpp
@@ -983,18 +983,16 @@ nsDragService::TargetSetLastContext(GtkW
     mTargetDragContext = aContext;
     mTargetTime = aTime;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDragService::TargetStartDragMotion(void)
 {
-    PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetStartDragMotion"));
-    mCanDrop = false;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDragService::TargetEndDragMotion(GtkWidget      *aWidget,
                                    GdkDragContext *aContext,
                                    guint           aTime)
 {
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -3349,17 +3349,18 @@ nsWindow::OnDragMotionEvent(GtkWidget *a
         return TRUE;
       }
     }
 
     sIsDraggingOutOf = false;
 
     // get our drag context
     nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
-    nsCOMPtr<nsIDragSessionGTK> dragSessionGTK = do_QueryInterface(dragService);
+    nsDragService *dragServiceGTK =
+        static_cast<nsDragService*>(dragService.get());
 
     // first, figure out which internal widget this drag motion actually
     // happened on
     nscoord retx = 0;
     nscoord rety = 0;
 
     GdkWindow *innerWindow = get_inner_gdk_window(gtk_widget_get_window(aWidget), aX, aY,
                                                   &retx, &rety);
@@ -3373,38 +3374,39 @@ nsWindow::OnDragMotionEvent(GtkWidget *a
     if (mDragLeaveTimer) {
         mDragLeaveTimer->Cancel();
         mDragLeaveTimer = nsnull;
     }
 
     CheckNeedDragLeave(innerMostWidget, dragService, aDragContext, retx, rety);
 
     // update the drag context
-    dragSessionGTK->TargetSetLastContext(aWidget, aDragContext, aTime);
-    // notify the drag service that we are starting a drag motion.
-    dragSessionGTK->TargetStartDragMotion();
+    dragServiceGTK->TargetSetLastContext(aWidget, aDragContext, aTime);
+
+    dragServiceGTK->SetCanDrop(false);
 
     dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
 
     nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
 
     InitDragEvent(event);
 
     event.refPoint.x = retx;
     event.refPoint.y = rety;
     event.time = aTime;
 
     nsEventStatus status;
     innerMostWidget->DispatchEvent(&event, status);
 
-    // we're done with the drag motion event.  notify the drag service.
-    dragSessionGTK->TargetEndDragMotion(aWidget, aDragContext, aTime);
+    // Reply to tell the source whether we can drop and what action would be
+    // taken.
+    dragServiceGTK->TargetEndDragMotion(aWidget, aDragContext, aTime);
 
     // and unset our context
-    dragSessionGTK->TargetSetLastContext(0, 0, 0);
+    dragServiceGTK->TargetSetLastContext(0, 0, 0);
 
     return TRUE;
 }
 
 void
 nsWindow::OnDragLeaveEvent(GtkWidget *aWidget,
                            GdkDragContext *aDragContext,
                            guint aTime,