Index: trunk/src/user32/listbox.cpp
===================================================================
--- trunk/src/user32/listbox.cpp	(revision 1296)
+++ trunk/src/user32/listbox.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: listbox.cpp,v 1.5 1999-10-14 09:22:39 sandervl Exp $ */
+/* $Id: listbox.cpp,v 1.6 1999-10-14 18:27:55 sandervl Exp $ */
 /*
  * Listbox controls
@@ -322,7 +322,10 @@
 static void LISTBOX_UpdateSize( HWND hwnd, LB_DESCR *descr )
 {
-    RECT rect;
-
+    RECT rect, rectWindow;
+
+    GetWindowRect( hwnd, &rectWindow );
+    OffsetRect(&rectWindow, -rectWindow.left, -rectWindow.top);
     GetClientRect( hwnd, &rect );
+
     descr->width  = rect.right - rect.left;
     descr->height = rect.bottom - rect.top;
@@ -336,6 +339,6 @@
                     descr->height - descr->height%descr->item_height));
             SetWindowPos( hwnd, 0, 0, 0,
-                            descr->width,
-                            descr->height -
+                            rectWindow.right - rectWindow.left,
+                            rectWindow.bottom - rectWindow.top -
                                 (descr->height % descr->item_height),
                             SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE );
Index: trunk/src/user32/oslibgdi.cpp
===================================================================
--- trunk/src/user32/oslibgdi.cpp	(revision 1296)
+++ trunk/src/user32/oslibgdi.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: oslibgdi.cpp,v 1.2 1999-09-26 10:09:59 sandervl Exp $ */
+/* $Id: oslibgdi.cpp,v 1.3 1999-10-14 18:27:57 sandervl Exp $ */
 /*
  * Window GDI wrapper functions for OS/2
@@ -74,4 +74,6 @@
 {
  RECTLOS2 rectParent = {0};
+ Win32BaseWindow *window;
+ LONG height;
 
     if(hwndParent == OSLIB_HWND_DESKTOP) {
@@ -83,8 +85,15 @@
     }
 
-    ULONG length = rectOS2->yTop - rectOS2->yBottom;
-
-    rectWin32->bottom = length - rectOS2->yBottom;
-    rectWin32->top    = length - rectOS2->yTop;
+    if(hwndParent != HWND_DESKTOP) 
+    {
+	 window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndParent);
+	 if(window == NULL)
+		return FALSE;
+	 height = window->getWindowHeight();
+    }
+    else height = OSLibQueryScreenHeight();
+
+    rectWin32->bottom = height - rectOS2->yBottom;
+    rectWin32->top    = height - rectOS2->yTop;
     rectWin32->left   = rectOS2->xLeft;
     rectWin32->right  = rectOS2->xRight;
Index: trunk/src/user32/oslibwin.cpp
===================================================================
--- trunk/src/user32/oslibwin.cpp	(revision 1296)
+++ trunk/src/user32/oslibwin.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.27 1999-10-14 09:22:40 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.28 1999-10-14 18:27:57 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -43,6 +43,13 @@
 //******************************************************************************
 //******************************************************************************
+BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
+{
+  return WinSetOwner(hwnd, hwndOwner);
+}
+//******************************************************************************
+//******************************************************************************
 HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
-                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
+                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
+                          ULONG id)
 {
  HWND  hwndClient;
@@ -73,5 +80,5 @@
         *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
                                        &dwFrameStyle, WIN32_STDCLASS,
-                                       "", dwClientStyle, 0, 0, &hwndClient);
+                                       "", dwClientStyle, 0, id, &hwndClient);
         if(*hwndFrame) {
                 if(pszName) {
@@ -320,5 +327,5 @@
 BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
 {
- BOOL rc;
+ BOOL rc = 1;
 
   if(fl & SWP_SHOW) {
Index: trunk/src/user32/oslibwin.h
===================================================================
--- trunk/src/user32/oslibwin.h	(revision 1296)
+++ trunk/src/user32/oslibwin.h	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.15 1999-10-13 14:24:25 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.16 1999-10-14 18:27:57 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -34,8 +34,10 @@
 
 BOOL  OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw = TRUE);
+BOOL  OSLibWinSetOwner(HWND hwnd, HWND hwndOwner);
 
 
 HWND  OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
-                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
+                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 
+                           HWND *hwndFrame, ULONG id);
 
 BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight);
Index: trunk/src/user32/pmframe.cpp
===================================================================
--- trunk/src/user32/pmframe.cpp	(revision 1296)
+++ trunk/src/user32/pmframe.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.4 1999-10-11 16:04:51 cbratschi Exp $ */
+/* $Id: pmframe.cpp,v 1.5 1999-10-14 18:27:58 sandervl Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -177,4 +177,33 @@
   switch(msg)
   {
+    case WM_ADJUSTWINDOWPOS:
+    {
+      PSWP     pswp = (PSWP)mp1;
+      Win32BaseWindow *wndchild;
+
+      wndchild = Win32BaseWindow::GetWindowFromOS2FrameHandle(pswp->hwnd);
+      if(wndchild && wndchild->isChild()) {
+      	dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+      	RestoreOS2TIB();
+      	return (MRESULT)0;
+      }
+      goto RunDefFrameProc;
+    }
+#if 0
+    case WM_WINDOWPOSCHANGED:
+    {
+      PSWP      pswp  = (PSWP)mp1;
+      dprintf(("PMFRAME: WM_WINDOWPOSCHANGED %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+      goto RunDefFrameProc;
+    }
+
+    case WM_FORMATFRAME:
+    {
+      PSWP      pswp  = (PSWP)mp1;
+      dprintf(("PMFRAME: WM_FORMATFRAME %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+      goto RunDefFrameProc;
+    }
+#endif
+
     case WM_DESTROY:
       #ifdef PMFRAMELOG
Index: trunk/src/user32/pmwindow.cpp
===================================================================
--- trunk/src/user32/pmwindow.cpp	(revision 1296)
+++ trunk/src/user32/pmwindow.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.26 1999-10-14 09:22:40 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.27 1999-10-14 18:27:58 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -241,5 +241,5 @@
 
     case WM_SHOW:
-        dprintf(("OS2: WM_SHOW %x", hwnd));
+        dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1));
         if(win32wnd->MsgShow((ULONG)mp1)) {
                 goto RunDefWndProc;
@@ -306,11 +306,11 @@
         dprintf(("WINDOWPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), win32wnd->getOS2FrameWindowHandle(),
                          swpFrame.fl,swpFrame.x, swpFrame.y, swpFrame.cx, swpFrame.cy));
-
-	RECTL rect;
-        WinQueryWindowRect(win32wnd->getOS2FrameWindowHandle(), &rect);
-        dprintf(("WINDOWPOSCHANGE %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), win32wnd->getOS2FrameWindowHandle(),
-                         rect.xLeft, rect.yBottom, rect.xRight, rect.yTop));
-
-        win32wnd->setWindowRect(wp.x, wp.y, wp.x + wp.cx, wp.y + wp.cy);
+	POINTL point;
+	point.x = swpFrame.x;
+	point.y = swpFrame.y;
+	WinMapWindowPoints(win32wnd->getOS2FrameWindowHandle(), HWND_DESKTOP,
+                           &point, 1);
+
+        win32wnd->setWindowRect(point.x, point.y, point.x+swpFrame.cx, point.y+swpFrame.cy);
         win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
 
@@ -342,6 +342,6 @@
 #ifdef DEBUG
                 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
-                dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d)", (window) ? window->getWindowHandle() : hwnd,
-                         yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy));
+                dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
+                         yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
 #endif
 
@@ -349,5 +349,5 @@
                     //child window at offset <> 0 from client area -> offset now changes
                     swp[i].y  += yDelta;
-                    swp[i].fl &= ~SWP_NOREDRAW;
+                    swp[i].fl &= ~(SWP_NOREDRAW);
                 }
                 //else child window with the same start coorindates as the client area
@@ -387,4 +387,5 @@
     case WM_ERASEBACKGROUND:
     {
+	dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
         if (!win32wnd->isSupressErase()) {
             BOOL erased = sendEraseBkgnd (win32wnd);
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 1296)
+++ trunk/src/user32/win32wbase.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.41 1999-10-14 09:22:42 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.42 1999-10-14 18:27:59 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -454,8 +454,4 @@
   dwExStyle = cs->dwExStyle;
 
-  //SvL: Add bordersize
-  cs->cy += 2*borderHeight;
-  cs->cx += 2*borderWidth;
-
   rectWindow.left   = cs->x;
   rectWindow.top    = cs->y;
@@ -489,5 +485,5 @@
                                  (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
-                                 &OS2HwndFrame);
+                                 &OS2HwndFrame, 0);
 
   if(OS2Hwnd == 0) {
@@ -548,4 +544,6 @@
 #endif
 
+  OSLibWinSetOwner(OS2Hwnd, OS2HwndFrame);
+
   if (dwStyle & WS_HSCROLL)
   {
@@ -585,10 +583,10 @@
 
   //Subclass frame
-  if(isFrameWindow() && (HAS_3DFRAME(dwExStyle) ||
-     (!HAS_DLGFRAME(dwStyle, dwExStyle) && (dwStyle & (WS_DLGFRAME|WS_BORDER|WS_THICKFRAME)) == WS_BORDER)))
-  {
+//  if(isFrameWindow() && (HAS_3DFRAME(dwExStyle) ||
+//     (!HAS_DLGFRAME(dwStyle, dwExStyle) && (dwStyle & (WS_DLGFRAME|WS_BORDER|WS_THICKFRAME)) == WS_BORDER)))
+//  {
         pOldFrameProc = FrameSubclassFrameWindow(this);
         if (isChild()) FrameSetBorderSize(this,TRUE);
-  }
+//  }
 
   /* Send the WM_CREATE message
@@ -617,5 +615,5 @@
         SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
 
-        OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
+//        OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
         dprintf(("Sending WM_CREATE"));
         if( (SendMessageA(WM_CREATE, 0, (LPARAM)cs )) != -1 )
@@ -686,4 +684,13 @@
 ULONG Win32BaseWindow::MsgShow(BOOL fShow)
 {
+    if(fNoSizeMsg) {
+        return 1;
+    }
+
+    if(fShow) {
+            setStyle(getStyle() | WS_VISIBLE);
+    }
+    else    setStyle(getStyle() & ~WS_VISIBLE);
+
     return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
 }
@@ -692,5 +699,4 @@
 ULONG Win32BaseWindow::MsgPosChanging(LPARAM lp)
 {
-    dprintf(("MsgPosChanging"));
     if(fNoSizeMsg)
         return 1;
@@ -702,5 +708,4 @@
 ULONG Win32BaseWindow::MsgPosChanged(LPARAM lp)
 {
-    dprintf(("MsgPosChanged"));
     if(fNoSizeMsg)
         return 1;
@@ -1969,32 +1974,28 @@
    HWND hParent = 0;
 
-   dprintf (("SetWindowPos %x %x (%d,%d)(%d,%d) %x", Win32Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
-
-   if (fuFlags &
+    dprintf (("SetWindowPos %x %x (%d,%d)(%d,%d) %x", Win32Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
+
+    if (fuFlags &
        ~(SWP_NOSIZE     | SWP_NOMOVE     | SWP_NOZORDER     |
          SWP_NOREDRAW   | SWP_NOACTIVATE | SWP_FRAMECHANGED |
          SWP_SHOWWINDOW | SWP_HIDEWINDOW | SWP_NOCOPYBITS   |
          SWP_NOOWNERZORDER))
-   {
-      return FALSE;
-   }
-
-   WINDOWPOS wpos;
-   SWP swp, swpOld;
-
-   wpos.flags            = fuFlags;
-   wpos.cy               = cy;
-   wpos.cx               = cx;
-   wpos.x                = x;
-   wpos.y                = y;
-   wpos.hwndInsertAfter  = hwndInsertAfter;
-   wpos.hwnd             = getWindowHandle();
-
-   //SvL: Add bordersize
-   wpos.cy              += 2*borderHeight;
-   wpos.cx              += 2*borderWidth;
-
-   if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE))
-   {
+    {
+        return FALSE;
+    }
+
+    WINDOWPOS wpos;
+    SWP swp, swpOld;
+
+    wpos.flags            = fuFlags;
+    wpos.cy               = cy;
+    wpos.cx               = cx;
+    wpos.x                = x;
+    wpos.y                = y;
+    wpos.hwndInsertAfter  = hwndInsertAfter;
+    wpos.hwnd             = getWindowHandle();
+
+    if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE))
+    {
        if (isChild())
        {
@@ -2002,13 +2003,13 @@
        }
        OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
-   }
-
-   OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame);
-   if (swp.fl == 0)
+    }
+
+    OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame);
+    if (swp.fl == 0)
       return TRUE;
 
 //   if ((swp.fl & SWPOS_ZORDER) && (swp.hwndInsertBehind > HWNDOS_BOTTOM))
-   if ((swp.hwndInsertBehind > HWNDOS_BOTTOM))
-   {
+    if ((swp.hwndInsertBehind > HWNDOS_BOTTOM))
+    {
         Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind);
         if(wndBehind) {
@@ -2019,8 +2020,8 @@
             swp.hwndInsertBehind = 0;
         }
-   }
+    }
 #if 0
-   if (isFrameWindow())
-   {
+    if (isFrameWindow())
+    {
       if (!isChild())
       {
@@ -2035,24 +2036,24 @@
       }
       swp.hwnd = OS2HwndFrame;
-   }
-   else
+    }
+    else
 #endif
       swp.hwnd = OS2HwndFrame;
 
-   dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
-
-   rc = OSLibWinSetMultWindowPos(&swp, 1);
-
-   if (rc == FALSE)
-   {
+    dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
+
+    rc = OSLibWinSetMultWindowPos(&swp, 1);
+
+    if (rc == FALSE)
+    {
         dprintf(("OSLibWinSetMultWindowPos failed!"));
-   }
-   else
-   {
-      if (fuFlags & SWP_FRAMECHANGED_W)
-         OSLibSendMessage (OS2HwndFrame, 0x42 /*WM_UPDATEFRAME*/, -1, 0);
-   }
-
-   return (rc);
+    }
+    else
+    {
+        if (fuFlags & SWP_FRAMECHANGED_W)
+            OSLibSendMessage (OS2HwndFrame, 0x42 /*WM_UPDATEFRAME*/, -1, 0);
+    }
+
+    return (rc);
 }
 //******************************************************************************
@@ -2061,5 +2062,5 @@
 BOOL Win32BaseWindow::DestroyWindow()
 {
-  return OSLibWinDestroyWindow(OS2HwndFrame);
+    return OSLibWinDestroyWindow(OS2HwndFrame);
 }
 //******************************************************************************
@@ -2349,5 +2350,5 @@
 BOOL Win32BaseWindow::GetWindowRect(PRECT pRect)
 {
-    return OSLibWinQueryWindowRect(OS2Hwnd, pRect, RELATIVE_TO_SCREEN);
+    return OSLibWinQueryWindowRect(OS2HwndFrame, pRect, RELATIVE_TO_SCREEN);
 }
 //******************************************************************************
Index: trunk/src/user32/window.cpp
===================================================================
--- trunk/src/user32/window.cpp	(revision 1296)
+++ trunk/src/user32/window.cpp	(revision 1297)
@@ -1,3 +1,3 @@
-/* $Id: window.cpp,v 1.14 1999-10-12 14:47:24 sandervl Exp $ */
+/* $Id: window.cpp,v 1.15 1999-10-14 18:27:59 sandervl Exp $ */
 /*
  * Win32 window apis for OS/2
@@ -617,5 +617,6 @@
 BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
 {
-   Win32BaseWindow *window;
+  Win32BaseWindow *window;
+  BOOL rc;
 
     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
@@ -625,6 +626,7 @@
         return 0;
     }
-    dprintf(("GetWindowRect %x", hwnd));
-    return window->GetWindowRect(pRect);
+    rc = window->GetWindowRect(pRect);
+    dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
+    return rc;
 }
 //******************************************************************************
