diff --git a/gfx/src/beos/nsDeviceContextSpecB.cpp b/gfx/src/beos/nsDeviceContextSpecB.cpp index 14fd7d5a3827..a003344583e5 100644 --- a/gfx/src/beos/nsDeviceContextSpecB.cpp +++ b/gfx/src/beos/nsDeviceContextSpecB.cpp @@ -33,6 +33,7 @@ #include "nsIDialogParamBlock.h" #include "nsISupportsPrimitives.h" #include "nsIWindowWatcher.h" +#include "nsIDOMWindowInternal.h" //#include "prmem.h" //#include "plstr.h" @@ -129,8 +130,16 @@ NS_IMETHODIMP nsDeviceContextSpecBeOS :: Init(PRBool aQuiet) nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); if (wwatch) { + + nsCOMPtr parent; + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + if (active) { + active->QueryInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(parent)); + } + nsCOMPtr newWindow; - rv = wwatch->OpenWindow(0, "chrome://global/content/printdialog.xul", + rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", "_blank", "chrome,modal", paramBlockWrapper, getter_AddRefs(newWindow)); } diff --git a/gfx/src/gtk/nsDeviceContextSpecG.cpp b/gfx/src/gtk/nsDeviceContextSpecG.cpp index 4e7e9dffceb9..19980a74aa4e 100644 --- a/gfx/src/gtk/nsDeviceContextSpecG.cpp +++ b/gfx/src/gtk/nsDeviceContextSpecG.cpp @@ -37,6 +37,7 @@ #include "nsIDialogParamBlock.h" #include "nsISupportsPrimitives.h" #include "nsIWindowWatcher.h" +#include "nsIDOMWindowInternal.h" static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); @@ -181,8 +182,16 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet) nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); if (wwatch) { + + nsCOMPtr parent; + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + if (active) { + active->QueryInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(parent)); + } + nsCOMPtr newWindow; - rv = wwatch->OpenWindow(0, "chrome://global/content/printdialog.xul", + rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", "_blank", "chrome,modal", paramBlockWrapper, getter_AddRefs(newWindow)); } diff --git a/gfx/src/qt/nsDeviceContextSpecQT.cpp b/gfx/src/qt/nsDeviceContextSpecQT.cpp index 32fd7452f93e..4be4f638c71e 100644 --- a/gfx/src/qt/nsDeviceContextSpecQT.cpp +++ b/gfx/src/qt/nsDeviceContextSpecQT.cpp @@ -162,8 +162,16 @@ NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet) nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); if (wwatch) { + + nsCOMPtr parent; + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + if (active) { + active->QueryInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(parent)); + } + nsCOMPtr newWindow; - rv = wwatch->OpenWindow(0, "chrome://global/content/printdialog.xul", + rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", "_blank", "chrome,modal", paramBlockWrapper, getter_AddRefs(newWindow)); } diff --git a/gfx/src/xlib/nsDeviceContextSpecXlib.cpp b/gfx/src/xlib/nsDeviceContextSpecXlib.cpp index c6a763abe944..deaa5c91e4e9 100644 --- a/gfx/src/xlib/nsDeviceContextSpecXlib.cpp +++ b/gfx/src/xlib/nsDeviceContextSpecXlib.cpp @@ -169,8 +169,16 @@ NS_IMETHODIMP nsDeviceContextSpecXlib::Init(PRBool aQuiet) nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); if (wwatch) { + + nsCOMPtr parent; + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + if (active) { + active->QueryInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(parent)); + } + nsCOMPtr newWindow; - rv = wwatch->OpenWindow(0, "chrome://global/content/printdialog.xul", + rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", "_blank", "chrome,modal", paramBlockWrapper, getter_AddRefs(newWindow)); }