From 2b69b452180ffe15fddda34125d9b309593941c1 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 9 Jul 2002 22:59:52 +0000 Subject: [PATCH] #67913 r=pedemont, sr=blizzard (platform specific code) OS/2 only - don't let Mozilla windows cover up the Warpcenter --- gfx/src/os2/nsScreenOS2.cpp | 50 +++++++++++++++++++++++++++---------- widget/src/os2/nsWindow.cpp | 7 +++--- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/gfx/src/os2/nsScreenOS2.cpp b/gfx/src/os2/nsScreenOS2.cpp index 2d9f5c49b31..d1a7816d780 100644 --- a/gfx/src/os2/nsScreenOS2.cpp +++ b/gfx/src/os2/nsScreenOS2.cpp @@ -66,15 +66,14 @@ nsScreenOS2 :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRI HPS hps = ::WinGetScreenPS( HWND_DESKTOP); HDC hdc = GFX (::GpiQueryDevice (hps), HDC_ERROR); - ::DevQueryCaps(hdc, CAPS_WIDTH, 2, alArray); + ::WinReleasePS(hps); *outTop = 0; *outLeft = 0; *outWidth = alArray[0]; *outHeight = alArray[1]; - ::WinReleasePS(hps); return NS_OK; @@ -84,20 +83,45 @@ nsScreenOS2 :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRI NS_IMETHODIMP nsScreenOS2 :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight) { - *outTop = 0; - *outLeft = 0; - *outWidth = ::WinQuerySysValue( HWND_DESKTOP, SV_CXFULLSCREEN ); - *outHeight = ::WinQuerySysValue( HWND_DESKTOP, SV_CYFULLSCREEN ); + static APIRET rc = 0; + static BOOL (APIENTRY * pfnQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = NULL; + + GetRect(outLeft, outTop, outWidth, outHeight); + + // This height is different based on whether or not + // "Show on top of maximed windows" is checked + LONG lWorkAreaHeight = *outHeight; + + if ( !rc && !pfnQueryDesktopWorkArea ) + { + HMODULE hmod = 0; + rc = DosLoadModule( NULL, 0, "PMMERGE", &hmod ); + if ( !rc ) + { + rc = DosQueryProcAddr( hmod, 5469, NULL, (PFN*) &pfnQueryDesktopWorkArea ); // WinQueryDesktopWorkArea + DosFreeModule(hmod); + } + } + if ( pfnQueryDesktopWorkArea && !rc ) + { + RECTL rectl; + pfnQueryDesktopWorkArea( HWND_DESKTOP, &rectl ); + lWorkAreaHeight = rectl.yTop - rectl.yBottom; + } HWND hwndWarpCenter = WinWindowFromID( HWND_DESKTOP, 0x555 ); if (hwndWarpCenter) { - SWP swp; - WinQueryWindowPos( hwndWarpCenter, &swp ); - if (swp.y != 0) { - /* WarpCenter at top */ - *outTop += swp.cy; - } /* endif */ - } /* endif */ + /* If "Show on top of maximized windows is checked" */ + if (lWorkAreaHeight != *outHeight) { + SWP swp; + WinQueryWindowPos( hwndWarpCenter, &swp ); + if (swp.y != 0) { + /* WarpCenter is at the top */ + *outTop += (*outHeight - lWorkAreaHeight); + } + *outHeight = lWorkAreaHeight; + } + } return NS_OK; diff --git a/widget/src/os2/nsWindow.cpp b/widget/src/os2/nsWindow.cpp index 834df2cca18..7c69c58cc45 100644 --- a/widget/src/os2/nsWindow.cpp +++ b/widget/src/os2/nsWindow.cpp @@ -63,7 +63,6 @@ static int WINDOWCOUNT = 0; #endif -#define kWindowPositionSlop 20 static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1"; // HWNDs are mapped to nsWindow objects using a custom presentation parameter, @@ -1249,6 +1248,8 @@ NS_METHOD nsWindow::ConstrainPosition(PRBool aAllowSlop, } } +#define kWindowPositionSlop 100 + if (doConstrain) { if (aAllowSlop) { if (*aX < screenRect.xLeft - mBounds.width + kWindowPositionSlop) @@ -1256,8 +1257,8 @@ NS_METHOD nsWindow::ConstrainPosition(PRBool aAllowSlop, else if (*aX >= screenRect.xRight - kWindowPositionSlop) *aX = screenRect.xRight - kWindowPositionSlop; - if (*aY < screenRect.yTop - mBounds.height + kWindowPositionSlop) - *aY = screenRect.yTop - mBounds.height + kWindowPositionSlop; + if (*aY < screenRect.yTop) + *aY = screenRect.yTop; else if (*aY >= screenRect.yBottom - kWindowPositionSlop) *aY = screenRect.yBottom - kWindowPositionSlop;