From ceda10fe85e98fb9bf916c40504e72268c4aea54 Mon Sep 17 00:00:00 2001 From: "davidm%netscape.com" Date: Tue, 22 Jun 1999 03:04:11 +0000 Subject: [PATCH] Update to new nsIWindowMediator API git-svn-id: svn://10.0.0.236/trunk@36204 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/appshell/src/nsWebShellWindow.cpp | 54 ++++++++++++------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 62337238bc4..e0af10703f9 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -266,11 +266,13 @@ nsWebShellWindow::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kIBrowserWindowIID)) { + if ( aIID.Equals(kIBrowserWindowIID) ) { *aInstancePtr = (void*) (nsIBrowserWindow*) this; NS_ADDREF_THIS(); return NS_OK; } + + if (aIID.Equals(kISupportsIID)) { *aInstancePtr = (void*)(nsISupports*)(nsIWebShellContainer*)this; NS_ADDREF_THIS(); @@ -1429,6 +1431,13 @@ nsWebShellWindow::Show(PRBool aShow) { mWebShell->Show(); // crimminy -- it doesn't take a parameter! mWindow->Show(aShow); + + nsresult rv; + NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); + if ( NS_SUCCEEDED(rv) ) + { + windowMediator->UpdateWindowTimeStamp( this ); + } return NS_OK; } @@ -2417,28 +2426,37 @@ NS_IMETHODIMP nsWebShellWindow::SetTitle(const PRUnichar* aTitle) nsCOMPtr webshellNode = GetDOMNodeFromWebShell(mWebShell); nsCOMPtr webshellElement; nsString windowTitleModifier; - + nsString windowSeparator; if (webshellNode) webshellElement = do_QueryInterface(webshellNode); if (webshellElement ) - webshellElement->GetAttribute("titlemodifier", windowTitleModifier ); - nsString title( aTitle ); - title += windowTitleModifier; - - if (windowWidget) - windowWidget->SetTitle(title); - - // Tell the window mediator that a title has changed - #if 1 { - nsIWindowMediator* service; - if (NS_FAILED(nsServiceManager::GetService(kWindowMediatorCID, kIWindowMediatorIID, (nsISupports**) &service ) ) ) - return NS_OK; - service->UpdateWindowTitle( this, title ); - nsServiceManager::ReleaseService(kWindowMediatorCID, service); + webshellElement->GetAttribute("titlemodifier", windowTitleModifier ); + webshellElement->GetAttribute("titleseperator", windowSeparator ); } - #endif // Window Mediation - return NS_OK; + nsString title( aTitle ); + + if( title.Length() > 0 ) + title += windowSeparator+windowTitleModifier; + else + title = windowTitleModifier; + if (windowWidget) + windowWidget->SetTitle(title); + + + + // Tell the window mediator that a title has changed + #if 1 + { + nsIWindowMediator* service; + if (NS_FAILED(nsServiceManager::GetService(kWindowMediatorCID, kIWindowMediatorIID, (nsISupports**) &service ) ) ) + return NS_OK; + service->UpdateWindowTitle( this, title.GetUnicode() ); + nsServiceManager::ReleaseService(kWindowMediatorCID, service); + } + #endif // Window Mediation + return NS_OK; + } NS_IMETHODIMP nsWebShellWindow::GetTitle(const PRUnichar** aResult)