don't move or resize windows that belong to embedding apps

This commit is contained in:
pierre%netscape.com 1999-02-03 02:04:15 +00:00
parent 8489e73f9b
commit 8ab85d5e8a

View File

@ -238,33 +238,36 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsMacWindow::Move(PRUint32 aX, PRUint32 aY) NS_IMETHODIMP nsMacWindow::Move(PRUint32 aX, PRUint32 aY)
{ {
Rect screenRect = (**::GetGrayRgn()).rgnBBox; if (mWindowMadeHere)
{
Rect screenRect = (**::GetGrayRgn()).rgnBBox;
short windowWidth = mWindowPtr->portRect.right - mWindowPtr->portRect.left; short windowWidth = mWindowPtr->portRect.right - mWindowPtr->portRect.left;
if (((PRInt32)aX) < screenRect.left - windowWidth) if (((PRInt32)aX) < screenRect.left - windowWidth)
aX = screenRect.left - windowWidth; aX = screenRect.left - windowWidth;
else if (((PRInt32)aX) > screenRect.right) else if (((PRInt32)aX) > screenRect.right)
aX = screenRect.right; aX = screenRect.right;
if (((PRInt32)aY) < screenRect.top) if (((PRInt32)aY) < screenRect.top)
aY = screenRect.top; aY = screenRect.top;
else if (((PRInt32)aY) > screenRect.bottom) else if (((PRInt32)aY) > screenRect.bottom)
aY = screenRect.bottom; aY = screenRect.bottom;
// propagate the event in global coordinates // propagate the event in global coordinates
nsWindow::Move(aX, aY); nsWindow::Move(aX, aY);
// reset the coordinates to (0,0) because it's the top level widget // reset the coordinates to (0,0) because it's the top level widget
mBounds.x = 0; mBounds.x = 0;
mBounds.y = 0; mBounds.y = 0;
// move the window if it has not been moved yet // move the window if it has not been moved yet
// (ie. if this function isn't called in response to a DragWindow event) // (ie. if this function isn't called in response to a DragWindow event)
Point macPoint; Point macPoint;
macPoint = topLeft(mWindowPtr->portRect); macPoint = topLeft(mWindowPtr->portRect);
::LocalToGlobal(&macPoint); ::LocalToGlobal(&macPoint);
if ((macPoint.h != aX) || (macPoint.v != aY)) { if ((macPoint.h != aX) || (macPoint.v != aY)) {
::MoveWindow(mWindowPtr, aX, aY, false); ::MoveWindow(mWindowPtr, aX, aY, false);
}
} }
return NS_OK; return NS_OK;
} }
@ -276,21 +279,22 @@ NS_IMETHODIMP nsMacWindow::Move(PRUint32 aX, PRUint32 aY)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsMacWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) NS_IMETHODIMP nsMacWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
{ {
// move the window if it has not been moved yet if (mWindowMadeHere)
// (ie. if this function isn't called in response to a GrowWindow event)
Rect macRect = mWindowPtr->portRect;
#ifdef WINDOW_SIZE_TWEAKING
macRect.right ++;
macRect.bottom ++;
#endif
if (((macRect.right - macRect.left) != aWidth)
|| ((macRect.bottom - macRect.top) != aHeight))
{ {
Rect macRect = mWindowPtr->portRect;
#ifdef WINDOW_SIZE_TWEAKING #ifdef WINDOW_SIZE_TWEAKING
::SizeWindow(mWindowPtr, aWidth - 1, aHeight - 1, aRepaint); macRect.right ++;
#else macRect.bottom ++;
::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
#endif #endif
if (((macRect.right - macRect.left) != aWidth)
|| ((macRect.bottom - macRect.top) != aHeight))
{
#ifdef WINDOW_SIZE_TWEAKING
::SizeWindow(mWindowPtr, aWidth - 1, aHeight - 1, aRepaint);
#else
::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
#endif
}
} }
nsWindow::Resize(aWidth, aHeight, aRepaint); nsWindow::Resize(aWidth, aHeight, aRepaint);
return NS_OK; return NS_OK;