From cc0fe5279fac093d7ec51bac5959aa473afb957b Mon Sep 17 00:00:00 2001 From: "mozilla@weilbacher.org" Date: Tue, 18 Mar 2008 02:35:49 -0700 Subject: [PATCH] [OS/2] Bug 353011: make bookmark tooltips and popups appear in front of the bookmarks menu, p=mz@scntt.de, r=me --- widget/src/os2/nsWindow.cpp | 49 +++++++++++++++++++++++++------------ widget/src/os2/nsWindow.h | 1 + 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/widget/src/os2/nsWindow.cpp b/widget/src/os2/nsWindow.cpp index 30051a93312..a38f5557b2e 100644 --- a/widget/src/os2/nsWindow.cpp +++ b/widget/src/os2/nsWindow.cpp @@ -1188,22 +1188,24 @@ void nsWindow::NS2PM( RECTL &rcl) //------------------------------------------------------------------------- NS_METHOD nsWindow::Show(PRBool bState) { - // doesn't seem to require a message queue. - if( mWnd) - { - HWND hwnd = GetMainWindow(); - if( bState == PR_TRUE) - { - // don't try to show new windows (e.g. the Bookmark menu) - // during a native dragover because they'll remain invisible; - if (CheckDragStatus(ACTION_SHOW, 0)) - WinShowWindow( hwnd, TRUE); + // doesn't seem to require a message queue. + if (mWnd) { + if (bState) { + // don't try to show new windows (e.g. the Bookmark menu) + // during a native dragover because they'll remain invisible; + if (CheckDragStatus(ACTION_SHOW, 0)) { + PRBool bVisible; + IsVisible(bVisible); + if (!bVisible) + PlaceBehind(eZPlacementTop, NULL, PR_FALSE); + WinShowWindow(mWnd, PR_TRUE); } - else - WinShowWindow( hwnd, FALSE); - } + } else { + WinShowWindow(mWnd, PR_FALSE); + } + } - return NS_OK; + return NS_OK; } //------------------------------------------------------------------------- @@ -1226,7 +1228,11 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState) NS_METHOD nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, PRBool aActivate) { - HWND behind = aWidget ? (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW) : HWND_TOP; + HWND behind = HWND_TOP; + if (aPlacement == eZPlacementBottom) + behind = HWND_BOTTOM; + else if (aPlacement == eZPlacementBelow && aWidget) + behind = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW); UINT flags = SWP_ZORDER; if (aActivate) flags |= SWP_ACTIVATE; @@ -1235,6 +1241,19 @@ NS_METHOD nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, return NS_OK; } +//------------------------------------------------------------------------- +// +// Sets widget's position within its parent child list. +// +//------------------------------------------------------------------------- +NS_METHOD nsWindow::SetZIndex(PRInt32 aZIndex) +{ + // nsBaseWidget::SetZIndex() never has done anything sensible but has + // randomly placed widgets behind others (see bug 117730#c25). + // To get bug #353011 solved simply override it here to do nothing. + return NS_OK; +} + //------------------------------------------------------------------------- // // Maximize, minimize or restore the window. diff --git a/widget/src/os2/nsWindow.h b/widget/src/os2/nsWindow.h index 22e8921f0a1..feec003c281 100644 --- a/widget/src/os2/nsWindow.h +++ b/widget/src/os2/nsWindow.h @@ -151,6 +151,7 @@ class nsWindow : public nsBaseWidget, NS_IMETHOD IsVisible( PRBool &aState); NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD SetZIndex(PRInt32 aZIndex); NS_IMETHOD CaptureMouse(PRBool aCapture);