From df6ad898af4f0181e1b7de41b837ee51d317e98a Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Mon, 18 Dec 2000 20:30:41 +0000 Subject: [PATCH] r=mkaply, a=blizzard Small porting change from jeffk to position frame windows correctly --- widget/src/os2/nsFrameWindow.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/widget/src/os2/nsFrameWindow.cpp b/widget/src/os2/nsFrameWindow.cpp index 02ae08f5deea..95123247d51e 100644 --- a/widget/src/os2/nsFrameWindow.cpp +++ b/widget/src/os2/nsFrameWindow.cpp @@ -80,7 +80,23 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent, nsIAppShell *aAppShell, nsWidgetInitData *aInitData, HWND hwndO) { - hwndP = aParent ? aParent->GetMainWindow() : NULLHANDLE; + nsRect rect; + if( aParent) // Offset rect by position of owner + { + nsRect clientRect; + aParent->GetBounds(rect); + aParent->GetClientBounds(clientRect); + rect.x += aRect.x + clientRect.x; + rect.y += aRect.y + clientRect.y; + rect.width = aRect.width; + rect.height = aRect.height; + hwndP = aParent->GetMainWindow(); + } + else // Use original rect, no owner window + { + rect = aRect; + hwndP = NULLHANDLE; + } #if DEBUG_sobotka printf("\nIn nsFrameWindow::RealDoCreate:\n"); @@ -124,7 +140,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent, // Frames have a minimum height based on the pieces they are created with, // such as titlebar, menubar, frame borders, etc. We need this minimum // height so we can correctly set the frame position (coordinate flipping). - nsRect frameRect = aRect; + nsRect frameRect = rect; long minheight; if ( fcd.flCreateFlags & FCF_SIZEBORDER) { @@ -226,8 +242,10 @@ void nsFrameWindow::UpdateClientSize() nsresult nsFrameWindow::GetClientBounds( nsRect &aRect) { - aRect.x = 0; - aRect.y = 0; + RECTL rcl = { 0, 0, mBounds.width, mBounds.height }; + WinCalcFrameRect( hwndFrame, &rcl, TRUE); // provided == frame rect + aRect.x = rcl.xLeft; + aRect.y = mBounds.height - rcl.yTop; aRect.width = mSizeClient.width; aRect.height = mSizeClient.height; return NS_OK;