From d6681f6c63da170ba804c80818e9322da46b1299 Mon Sep 17 00:00:00 2001 From: "saari%netscape.com" Date: Wed, 8 Mar 2000 04:41:12 +0000 Subject: [PATCH] windows fix for 26834, windows need sanity checks to keep them on screen. r=hyatt, a=jar git-svn-id: svn://10.0.0.236/trunk@62379 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsWindow.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index f688da09d9e..c9926bcbeeb 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -1121,6 +1121,23 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) mBounds.y = aY; if (mWnd) { + // Make sure this window is actually on the screen before we move it + // XXX: Needs multiple monitor support + HDC dc = ::GetDC(mWnd); + if(dc) { + if (::GetDeviceCaps(dc, TECHNOLOGY) == DT_RASDISPLAY) + { + RECT workArea; + ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); + if(mBounds.x >= workArea.right) + aX = mBounds.x = workArea.left; + + if(mBounds.y >= workArea.bottom) + aY = mBounds.y = workArea.top; + } + ::ReleaseDC(mWnd, dc); + } + nsIWidget *par = GetParent(); HDWP deferrer = NULL;