diff --git a/widget/src/gtk/nsGtkEventHandler.cpp b/widget/src/gtk/nsGtkEventHandler.cpp index c8da743037c..2a9ae31f6e5 100644 --- a/widget/src/gtk/nsGtkEventHandler.cpp +++ b/widget/src/gtk/nsGtkEventHandler.cpp @@ -843,6 +843,9 @@ handle_gdk_event (GdkEvent *event, gpointer data) nsWindow *window = (nsWindow *)gtk_object_get_data (object, "nsWindow"); GtkWidget *current_grab = gtk_grab_get_current(); + if (window->GrabInProgress()) { + goto handle_as_superwin; + } if (current_grab) { // walk up the list of our parents looking for the widget. diff --git a/widget/src/gtk/nsWindow.cpp b/widget/src/gtk/nsWindow.cpp index 535901d1454..d652df7fd63 100644 --- a/widget/src/gtk/nsWindow.cpp +++ b/widget/src/gtk/nsWindow.cpp @@ -59,6 +59,8 @@ gint handle_toplevel_focus_out( // this is the nsWindow with the focus nsWindow *nsWindow::focusWindow = NULL; +// are we grabbing? +PRBool nsWindow::mIsGrabbing = PR_FALSE; //------------------------------------------------------------------------- // @@ -390,11 +392,12 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, } else { - int ret = gdk_pointer_grab (GDK_SUPERWIN(mSuperWin)->bin_window, PR_TRUE,(GdkEventMask) - (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_POINTER_MOTION_MASK), - (GdkWindow*)NULL, cursor, GDK_CURRENT_TIME); + mIsGrabbing = PR_TRUE; + int ret = gdk_pointer_grab (GDK_SUPERWIN(mSuperWin)->bin_window, PR_TRUE,(GdkEventMask) + (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | + GDK_POINTER_MOTION_MASK), + (GdkWindow*)NULL, cursor, GDK_CURRENT_TIME); #ifdef DEBUG_pavlov printf("pointer grab returned %i\n", ret); #endif @@ -406,6 +409,7 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, #ifdef DEBUG_pavlov printf("ungrabbing widget\n"); #endif + mIsGrabbing = PR_FALSE; gdk_pointer_ungrab(GDK_CURRENT_TIME); // gtk_grab_remove(grabWidget); } @@ -1775,7 +1779,7 @@ NS_IMETHODIMP nsWindow::Show(PRBool bState) { gtk_widget_hide(mShell); gtk_widget_hide(mMozArea); - gtk_widget_unmap(mShell); + //gtk_widget_unmap(mShell); } // For some strange reason, gtk_widget_hide() does not seem to @@ -1783,8 +1787,6 @@ NS_IMETHODIMP nsWindow::Show(PRBool bState) // gtk_widget_unmap(mWidget); } - mShown = bState; - return NS_OK; } @@ -2497,6 +2499,11 @@ nsWindow::GetMozArea() return (GtkWidget *)mMozAreaClosestParent; } +PRBool +nsWindow::GrabInProgress(void) +{ + return nsWindow::mIsGrabbing; +} /* virtual */ GdkWindow * nsWindow::GetRenderWindow(GtkObject * aGtkObject) diff --git a/widget/src/gtk/nsWindow.h b/widget/src/gtk/nsWindow.h index aa67c97003b..65db2f03e9b 100644 --- a/widget/src/gtk/nsWindow.h +++ b/widget/src/gtk/nsWindow.h @@ -135,6 +135,9 @@ public: // Return the Gdk window used for rendering virtual GdkWindow * GetRenderWindow(GtkObject * aGtkWidget); + + // grab in progress + PRBool GrabInProgress(void); // XXX Chris - fix these // virtual void OnButtonPressSignal(GdkEventButton * aGdkButtonEvent); @@ -187,6 +190,8 @@ protected: GtkWidget *mMozAreaClosestParent; nsIMenuBar *mMenuBar; + // are we doing a grab? + static PRBool mIsGrabbing; private: nsresult SetIcon(GdkPixmap *window_pixmap, GdkBitmap *window_mask);