From df8447dcf2407d84a68818d3c994bf8e1c19f037 Mon Sep 17 00:00:00 2001 From: "hyatt@netscape.com" Date: Thu, 1 Jul 1999 02:50:53 +0000 Subject: [PATCH] Implementing borderless top level windows. --- xpfe/appshell/src/nsAppShellService.cpp | 10 +++++-- xpfe/appshell/src/nsWebShellWindow.cpp | 35 ++++++++++++++++++------- xpfe/appshell/src/nsWebShellWindow.h | 3 ++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 3f553a6f03df..742541ab9ead 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -493,9 +493,12 @@ nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent, } else { // temporarily disabling parentage because non-Windows platforms // seem to be interpreting it in unexpected ways. + nsWidgetInitData widgetInitData; + widgetInitData.mBorderStyle = eBorderStyle_window; + rv = window->Initialize((nsIWebShellWindow *) nsnull, mAppShell, aUrl, anObserver, aCallbacks, - aInitialWidth, aInitialHeight); + aInitialWidth, aInitialHeight, widgetInitData); if (NS_SUCCEEDED(rv)) { // this does the AddRef of the return value @@ -541,9 +544,12 @@ nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent, } else { // temporarily disabling parentage because non-Windows platforms // seem to be interpreting it in unexpected ways. + nsWidgetInitData widgetInitData; + widgetInitData.mBorderStyle = eBorderStyle_window; + rv = window->Initialize((nsIWebShellWindow *) nsnull, mAppShell, aUrl, anObserver, aCallbacks, - aInitialWidth, aInitialHeight); + aInitialWidth, aInitialHeight, widgetInitData); if (NS_SUCCEEDED(rv)) { rv = window->QueryInterface(kIWebShellWindowIID, (void **) aResult); RegisterTopLevelWindow(window); diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 3f4d55f2c370..20e9405efdf8 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -289,7 +289,8 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, nsIAppShell* aShell, nsIURI* aUrl, nsIStreamObserver* anObserver, nsIXULWindowCallbacks *aCallbacks, - PRInt32 aInitialWidth, PRInt32 aInitialHeight) + PRInt32 aInitialWidth, PRInt32 aInitialHeight, + nsWidgetInitData& widgetInitData) { nsresult rv; @@ -299,8 +300,6 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, // Doesn't come from prefs... will come from CSS/XUL/RDF nsRect r(0, 0, aInitialWidth, aInitialHeight); - nsWidgetInitData initData; - // Create top level window rv = nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID, (void**)&mWindow); @@ -308,8 +307,6 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, return rv; } - initData.mBorderStyle = eBorderStyle_window; - if (!aParent || NS_FAILED(aParent->GetWidget(parentWidget))) parentWidget = nsnull; @@ -320,7 +317,7 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, nsnull, // Device context aShell, // Application shell nsnull, // nsIToolkit - &initData); // Widget initialization data + &widgetInitData); // Widget initialization data mWindow->GetClientBounds(r); mWindow->SetBackgroundColor(NS_RGB(192,192,192)); @@ -1144,8 +1141,25 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont return rv; nsCOMPtr newWindow; - appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, getter_AddRefs(newWindow), - nsnull, nsnull, 200, 300); + + nsWebShellWindow* window = new nsWebShellWindow(); + if (nsnull == window) { + return NS_ERROR_OUT_OF_MEMORY; + } + // temporarily disabling parentage because non-Windows platforms + // seem to be interpreting it in unexpected ways. + nsWidgetInitData widgetInitData; + widgetInitData.mBorderStyle = eBorderStyle_BorderlessTopLevel; + + rv = window->Initialize((nsIWebShellWindow *) nsnull, nsnull, nsnull, + nsnull, nsnull, + 200, 300, widgetInitData); + + if (NS_FAILED(rv)) + return rv; + + newWindow = window; + // Move the window to aXPos and aYPos nsCOMPtr browserWindow = do_QueryInterface(newWindow); browserWindow->MoveTo(aXPos, aYPos); @@ -2500,8 +2514,11 @@ NS_IMETHODIMP nsWebShellWindow::Init(nsIAppShell* aAppShell, // Note: null nsIStreamObserver means this window won't be able to answer FE_callback-type // questions from netlib. Observers are generally appcores. We'll have to supply // a generic browser appcore here someday. + nsWidgetInitData widgetInitData; + widgetInitData.mBorderStyle = eBorderStyle_window; + rv = Initialize(nsnull, aAppShell, urlObj, - nsnull, nsnull, aBounds.width, aBounds.height); + nsnull, nsnull, aBounds.width, aBounds.height, widgetInitData); mChromeMask = aChromeMask; if (NS_SUCCEEDED(rv)) MoveTo(aBounds.x, aBounds.y); diff --git a/xpfe/appshell/src/nsWebShellWindow.h b/xpfe/appshell/src/nsWebShellWindow.h index 15c50c6640df..40e16c80e5d6 100644 --- a/xpfe/appshell/src/nsWebShellWindow.h +++ b/xpfe/appshell/src/nsWebShellWindow.h @@ -121,7 +121,8 @@ public: nsresult Initialize(nsIWebShellWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl, nsIStreamObserver* anObserver, nsIXULWindowCallbacks *aCallbacks, - PRInt32 aInitialWidth, PRInt32 aInitialHeight); + PRInt32 aInitialWidth, PRInt32 aInitialHeight, + nsWidgetInitData& widgetInitData); nsIWidget* GetWidget(void) { return mWindow; } void DoContextMenu(