From a6aecbbf37588445ecefdc01730b97980ec494d5 Mon Sep 17 00:00:00 2001 From: "ccarlen%netscape.com" Date: Fri, 28 Jun 2002 14:32:13 +0000 Subject: [PATCH] Bug 145827 - window.focus and window.blur not implemented in PPEmbed. r=adamlock/sr=sfraser --- .../powerplant/source/CBrowserChrome.cpp | 25 +++++++++++++++++-- .../powerplant/source/CBrowserChrome.h | 4 ++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/embedding/browser/powerplant/source/CBrowserChrome.cpp b/embedding/browser/powerplant/source/CBrowserChrome.cpp index 33d23cbd8f47..389f891fd52d 100644 --- a/embedding/browser/powerplant/source/CBrowserChrome.cpp +++ b/embedding/browser/powerplant/source/CBrowserChrome.cpp @@ -109,11 +109,12 @@ void CBrowserChrome::SetBrowserShell(CBrowserShell *aShell) // CBrowserChrome::nsISupports //***************************************************************************** -NS_IMPL_ISUPPORTS7(CBrowserChrome, +NS_IMPL_ISUPPORTS8(CBrowserChrome, nsIWebBrowserChrome, nsIInterfaceRequestor, nsIWebBrowserChromeFocus, nsIEmbeddingSiteWindow, + nsIEmbeddingSiteWindow2, nsIContextMenuListener, nsITooltipListener, nsISupportsWeakReference); @@ -340,7 +341,7 @@ NS_IMETHODIMP CBrowserChrome::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 NS_IMETHODIMP CBrowserChrome::SetFocus() { - // We're driving focus through CBrowserShell::BeTarget() + mBrowserWindow->Select(); return NS_OK; } @@ -416,6 +417,26 @@ NS_IMETHODIMP CBrowserChrome::GetSiteWindow(void * *aSiteWindow) } +//***************************************************************************** +// CBrowserChrome::nsIEmbeddingSiteWindow2 +//***************************************************************************** + +NS_IMETHODIMP CBrowserChrome::Blur(void) +{ + WindowPtr currWindow = ::GetWindowList(); + WindowPtr nextWindow; + + // Find the rearmost window and put ourselves behind it + while (currWindow && ((nextWindow = ::MacGetNextWindow(currWindow)) != nsnull)) + currWindow = nextWindow; + + WindowPtr ourWindow = mBrowserWindow->GetMacWindow(); + if (ourWindow != currWindow) + ::SendBehind(ourWindow, currWindow); + + return NS_OK; +} + //***************************************************************************** // CBrowserChrome::nsIContextMenuListener //***************************************************************************** diff --git a/embedding/browser/powerplant/source/CBrowserChrome.h b/embedding/browser/powerplant/source/CBrowserChrome.h index c5194b20081f..095fcc0234a4 100644 --- a/embedding/browser/powerplant/source/CBrowserChrome.h +++ b/embedding/browser/powerplant/source/CBrowserChrome.h @@ -48,6 +48,7 @@ #include "nsIWebBrowserChrome.h" #include "nsIWebBrowserChromeFocus.h" #include "nsIEmbeddingSiteWindow.h" +#include "nsIEmbeddingSiteWindow2.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIContextMenuListener.h" @@ -64,7 +65,7 @@ class CBrowserShell; class CBrowserChrome : public nsIWebBrowserChrome, public nsIWebBrowserChromeFocus, - public nsIEmbeddingSiteWindow, + public nsIEmbeddingSiteWindow2, public nsIInterfaceRequestor, public nsIContextMenuListener, public nsITooltipListener, @@ -78,6 +79,7 @@ public: NS_DECL_NSIWEBBROWSERCHROME NS_DECL_NSIWEBBROWSERCHROMEFOCUS NS_DECL_NSIEMBEDDINGSITEWINDOW + NS_DECL_NSIEMBEDDINGSITEWINDOW2 NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSICONTEXTMENULISTENER NS_DECL_NSITOOLTIPLISTENER