r=pedemont, sr=blizzard (platform specific code)
OS/2 only - don't let Mozilla windows cover up the Warpcenter
This commit is contained in:
mkaply%us.ibm.com 2002-07-09 22:59:52 +00:00
Родитель c89ebf5e36
Коммит 2b69b45218
2 изменённых файлов: 41 добавлений и 16 удалений

Просмотреть файл

@ -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) {
/* If "Show on top of maximized windows is checked" */
if (lWorkAreaHeight != *outHeight) {
SWP swp;
WinQueryWindowPos( hwndWarpCenter, &swp );
if (swp.y != 0) {
/* WarpCenter at top */
*outTop += swp.cy;
} /* endif */
} /* endif */
/* WarpCenter is at the top */
*outTop += (*outHeight - lWorkAreaHeight);
}
*outHeight = lWorkAreaHeight;
}
}
return NS_OK;

Просмотреть файл

@ -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;