diff --git a/mozilla/widget/public/nsIWidget.h b/mozilla/widget/public/nsIWidget.h index 99979c7080b..eab1b1129cd 100644 --- a/mozilla/widget/public/nsIWidget.h +++ b/mozilla/widget/public/nsIWidget.h @@ -253,6 +253,14 @@ class nsIWidget : public nsISupports { */ NS_IMETHOD Show(PRBool aState) = 0; + /** + * Make the window modal + * + * + * + */ + NS_IMETHOD SetModal(void) = 0; + /** * Returns whether the window is visible * diff --git a/mozilla/widget/src/gtk/nsWidget.cpp b/mozilla/widget/src/gtk/nsWidget.cpp index 7e523e5fa21..258cb45eb11 100644 --- a/mozilla/widget/src/gtk/nsWidget.cpp +++ b/mozilla/widget/src/gtk/nsWidget.cpp @@ -248,6 +248,19 @@ NS_METHOD nsWidget::Show(PRBool bState) return NS_OK; } +NS_METHOD nsWidget::SetModal(void) +{ + GtkWindow *toplevel; + + if (!mWidget) + return NS_ERROR_FAILURE; + toplevel = (GtkWindow *) ::gtk_widget_get_toplevel( mWidget ); + if ( !toplevel ) + return NS_ERROR_FAILURE; + ::gtk_window_set_modal(toplevel, PR_TRUE); + return NS_OK; +} + NS_METHOD nsWidget::IsVisible(PRBool &aState) { if (mWidget) { diff --git a/mozilla/widget/src/gtk/nsWidget.h b/mozilla/widget/src/gtk/nsWidget.h index 472ca4c7fb4..b7df228a6bd 100644 --- a/mozilla/widget/src/gtk/nsWidget.h +++ b/mozilla/widget/src/gtk/nsWidget.h @@ -64,6 +64,7 @@ class nsWidget : public nsBaseWidget NS_IMETHOD Destroy(void); nsIWidget* GetParent(void); + NS_IMETHOD SetModal(void); NS_IMETHOD Show(PRBool state); NS_IMETHOD IsVisible(PRBool &aState); diff --git a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp index c0f89e9b305..bcc466892ab 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp @@ -784,3 +784,7 @@ NS_METHOD nsBaseWidget::EnableFileDrop(PRBool aEnable) return NS_OK; } +NS_METHOD nsBaseWidget::SetModal(void) +{ + return NS_ERROR_FAILURE; +} diff --git a/mozilla/widget/src/xpwidgets/nsBaseWidget.h b/mozilla/widget/src/xpwidgets/nsBaseWidget.h index 1d8fe871d51..499fd4e8b51 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseWidget.h +++ b/mozilla/widget/src/xpwidgets/nsBaseWidget.h @@ -74,6 +74,7 @@ public: virtual nsIDeviceContext* GetDeviceContext(); virtual nsIAppShell * GetAppShell(); virtual nsIToolkit* GetToolkit(); + NS_IMETHOD SetModal(void); NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle); NS_IMETHOD SetTitle(const nsString& aTitle); NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index a61ea25bee9..0dbc6166a49 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1380,6 +1380,7 @@ nsWebShellWindow::ShowModalInternal() subshell->Spinup(); nsIWidget *window = GetWidget(); + window->SetModal(); NS_ADDREF(window); mContinueModalLoop = PR_TRUE; while (NS_SUCCEEDED(rv) && mContinueModalLoop == PR_TRUE) {