diff --git a/widget/src/gtk/nsDragService.cpp b/widget/src/gtk/nsDragService.cpp index 5e4fbb8109d..dce70b2052a 100644 --- a/widget/src/gtk/nsDragService.cpp +++ b/widget/src/gtk/nsDragService.cpp @@ -28,6 +28,7 @@ #include "nsVoidArray.h" #include "nsXPIDLString.h" #include "nsPrimitiveHelpers.h" +#include "nsWidget.h" #include #include @@ -144,6 +145,9 @@ nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, gdk_event.button.x_root = 0; gdk_event.button.y_root = 0; + // before we start our drag, give the widget code a chance to + // clean up any state. + nsWidget::DragStarted(); // start our drag. GdkDragContext *context = gtk_drag_begin(mHiddenWidget, sourceList, diff --git a/widget/src/gtk/nsWidget.cpp b/widget/src/gtk/nsWidget.cpp index 85f66e362c8..98f516c63f0 100644 --- a/widget/src/gtk/nsWidget.cpp +++ b/widget/src/gtk/nsWidget.cpp @@ -117,6 +117,18 @@ void nsWidget::GetLastEventTime(guint32 *aTime) *aTime = sLastEventTime; } +void nsWidget::DragStarted(void) +{ + if (sButtonMotionTarget) + { + sButtonMotionTarget = nsnull; + sButtonMotionRootX = -1; + sButtonMotionRootY = -1; + sButtonMotionWidgetX = -1; + sButtonMotionWidgetY = -1; + } +} + #ifdef USE_XIM nsresult nsWidget::KillICSpotTimer () { diff --git a/widget/src/gtk/nsWidget.h b/widget/src/gtk/nsWidget.h index 50567f72d14..d544f4cefe3 100644 --- a/widget/src/gtk/nsWidget.h +++ b/widget/src/gtk/nsWidget.h @@ -206,6 +206,11 @@ public: // the event handling code needs to let us know the time of the last event static void SetLastEventTime(guint32 aTime); static void GetLastEventTime(guint32 *aTime); + + // inform the widget code that we are about to do a drag - it must + // release the sButtonMotionTarget if it is set. + static void DragStarted(void); + protected: virtual void InitCallbacks(char * aName = nsnull);