diff --git a/widget/src/gtk/nsWindow.cpp b/widget/src/gtk/nsWindow.cpp index 741f518e3260..b328cb9487c7 100644 --- a/widget/src/gtk/nsWindow.cpp +++ b/widget/src/gtk/nsWindow.cpp @@ -3014,6 +3014,22 @@ void nsWindow::StoreProperty(char *property, unsigned char *data) } // These are all of our drag and drop operations + +void +nsWindow::InitDragEvent (nsMouseEvent &aEvent) +{ + // set everything to zero + memset(&aEvent, 0, sizeof(nsMouseEvent)); + // set the keyboard modifiers + gint x, y; + GdkModifierType state = (GdkModifierType)0; + gdk_window_get_pointer(NULL, &x, &y, &state); + aEvent.isShift = (state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE; + aEvent.isControl = (state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE; + aEvent.isAlt = (state & GDK_MOD1_MASK) ? PR_TRUE : PR_FALSE; + aEvent.isMeta = PR_FALSE; // GTK+ doesn't support the meta key +} + /* static */ gint nsWindow::DragMotionSignal (GtkWidget * aWidget, @@ -3091,6 +3107,8 @@ gint nsWindow::OnDragMotionSignal (GtkWidget * aWidget, nsMouseEvent event; + InitDragEvent(event); + event.message = NS_DRAGDROP_OVER; event.eventStructType = NS_DRAGDROP_EVENT; @@ -3224,6 +3242,8 @@ nsWindow::OnDragDropSignal (GtkWidget *aWidget, nsMouseEvent event; + InitDragEvent(event); + event.message = NS_DRAGDROP_OVER; event.eventStructType = NS_DRAGDROP_EVENT; event.widget = innerMostWidget; @@ -3232,6 +3252,8 @@ nsWindow::OnDragDropSignal (GtkWidget *aWidget, innerMostWidget->DispatchMouseEvent(event); + InitDragEvent(event); + event.message = NS_DRAGDROP_DROP; event.eventStructType = NS_DRAGDROP_EVENT; event.widget = innerMostWidget; diff --git a/widget/src/gtk/nsWindow.h b/widget/src/gtk/nsWindow.h index fa2567ec6737..9871df81019d 100644 --- a/widget/src/gtk/nsWindow.h +++ b/widget/src/gtk/nsWindow.h @@ -221,6 +221,8 @@ protected: static nsWindow *mLastDragMotionWindow; static nsWindow *mLastLeaveWindow; + void InitDragEvent(nsMouseEvent &aEvent); + // DragBegin not needed ? // always returns TRUE static gint DragMotionSignal (GtkWidget * aWidget,