Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 713)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 715)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.24 1999-08-25 15:08:50 dengert Exp $ */
+/* $Id: oslibwin.cpp,v 1.25 1999-08-27 17:50:56 dengert Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -64,5 +64,5 @@
                 dwFrameStyle |= FCF_TITLEBAR;
 
-        dwFrameStyle |= FCF_TASKLIST;
+        dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER | FCF_NOBYTEALIGN;
         *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
                                        &dwFrameStyle, WIN32_STDCLASS,
@@ -403,5 +403,5 @@
 //******************************************************************************
 //******************************************************************************
-void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, ULONG parentHeight)
+void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
 {
    HWND hWindow            = pswp->hwnd;
@@ -412,4 +412,5 @@
    long cy                 = pswp->cy;
    UINT fuFlags            = (UINT)pswp->fl;
+   ULONG parentHeight;
 
    HWND  hWinAfter;
@@ -457,4 +458,28 @@
    if ( fuFlags & (SWP_MOVE | SWP_SIZE) )
    {
+      if (hParent == NULLHANDLE)
+      {
+        ULONG Offset;
+        POINTL pt = {0, 0};
+
+        Offset = OSLibGetWindowHeight(hFrame) - cy;
+        parentHeight = ScreenHeight;
+
+        cx += 2 * x;
+        cy += Offset;
+        WinMapWindowPoints (hFrame, HWND_DESKTOP, &pt, 1);
+        x = pt.x;
+        y = pt.y;
+
+        pswpOld->cx += 2 * pswpOld->x;
+        pswpOld->cy += Offset;
+        pswpOld->x   = pt.x;
+        pswpOld->y   = pt.y;
+      }
+      else
+      {
+        parentHeight = OSLibGetWindowHeight(hParent);
+      }
+
       if (fuFlags & SWP_SIZE)
       {
@@ -485,7 +510,6 @@
       // relative to top left of parent.
       //********************************************************
-      y = parentHeight - y - cy;
-
-      LONG oldY = parentHeight - pswpOld->y - pswpOld->cy;
+      y          = parentHeight - y - cy;
+      LONG oldY  = parentHeight - pswpOld->y - pswpOld->cy;
 
       // Set the SWP_NOMOVE_W flag if the window has not moved in windows
@@ -498,4 +522,19 @@
          flags |= SWP_NOSIZE_W;
    }
+
+   if (hParent == NULLHANDLE)
+   {
+       pswpOld->x  = x + pswp->x;
+       pswpOld->y  = y + cy - pswp->y - pswp->cy;
+   }
+   else {
+       pswpOld->x  = pswp->x;
+       pswpOld->y  = parentHeight - pswp->y - cy;
+   }
+   pswpOld->cx = pswp->cx;
+   pswpOld->cy = pswp->cy;
+
+dprintf(("window (%d,%d)(%d,%d)  client (%d,%d)(%d,%d)",
+         x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
 
    // Fill in the WINDOWPOS structure with the now calculated PM values.
@@ -510,5 +549,5 @@
 //******************************************************************************
 //******************************************************************************
-void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, ULONG parentHeight)
+void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
 {
    HWND hWnd              = pwpos->hwnd;
@@ -519,4 +558,5 @@
    long cy                = pwpos->cy;
    UINT fuFlags           = pwpos->flags;
+   ULONG parentHeight;
 
    HWND  hWinAfter;
@@ -571,4 +611,9 @@
    if ( flags & (SWP_MOVE | SWP_SIZE) )
    {
+      if (hParent == NULLHANDLE)
+        parentHeight = ScreenHeight;
+      else
+        parentHeight = OSLibGetWindowHeight(hParent);
+
       //**********************************************************
       // We'll need both a y and cy for the Y inversion code.
@@ -617,5 +662,5 @@
    }
 
-   // Fill in the WINDOWPOS structure with the now calculated PM values.
+   // Fill in the SWP structure with the now calculated PM values.
    pswp->fl               = flags;
    pswp->cy               = cy;
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 713)
+++ trunk/src/user32/new/oslibwin.h	(revision 715)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
+/* $Id: oslibwin.h,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -234,6 +234,6 @@
 
 BOOL  OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp);
-void  OSLibMapSWPtoWINDOWPOS(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, ULONG parentHeight);
-void  OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, ULONG parentHeight);
+void  OSLibMapSWPtoWINDOWPOS(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame);
+void  OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame);
 
 #endif //__OSLIBWIN_H__
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 713)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 715)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
+/* $Id: pmwindow.cpp,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -179,15 +179,20 @@
       WINDOWPOS wp;
       ULONG    parentHeight = 0;
+      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
 
         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
 
+        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
+
         WinQueryWindowPos(hwnd, &swpOld);
 
         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
-            parentHeight = (win32wnd->isChild()) ?
-                OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
-              : OSLibQueryScreenHeight();
-        }
-        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, parentHeight);
+            if (win32wnd->isChild())
+                hParent = win32wnd->getParent()->getOS2WindowHandle();
+            else
+                hFrame = win32wnd->getOS2FrameWindowHandle();
+        }
+        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
+
         wp.hwnd = win32wnd->getWindowHandle();
         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
@@ -202,15 +207,25 @@
     case WM_WINDOWPOSCHANGED:
     {
-      PSWP      pswp = (PSWP)mp1;
+      PSWP      pswp  = (PSWP)mp1;
+      PSWP      pswpo = pswp + 1;
       WINDOWPOS wp;
       ULONG     parentHeight = 0;
+      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
 
         dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+
+        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
+
         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
-            parentHeight = (win32wnd->isChild()) ?
-                OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
-              : OSLibQueryScreenHeight();
-        }
-        OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswp+1, parentHeight);
+            if (win32wnd->isChild())
+                hParent = win32wnd->getParent()->getOS2WindowHandle();
+            else
+                hFrame = win32wnd->getOS2FrameWindowHandle();
+        }
+        OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
+
+        win32wnd->setWindowRect(wp.x, wp.y, wp.x + wp.cx, wp.y + wp.cy);
+        win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
+
         wp.hwnd = win32wnd->getWindowHandle();
         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 713)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 715)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.30 1999-08-25 15:08:50 dengert Exp $ */
+/* $Id: win32wnd.cpp,v 1.31 1999-08-27 17:50:56 dengert Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -256,4 +256,10 @@
   {
         SetParent(cs->hwndParent);
+        owner = GetWindowFromHandle(cs->hwndParent);
+        if(owner == NULL)
+        {
+            dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
+            return FALSE;
+        }
   }
   else
@@ -367,5 +373,5 @@
   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
-                                 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
+                                 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
                                  &OS2HwndFrame);
@@ -1068,5 +1074,5 @@
 
         if (!(wpos->flags & SWP_NOCLIENTMOVE))
-            SendMessageA(WM_MOVE, 0, MAKELONG(wpos->x, wpos->y));
+            SendMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
 
         if (!(wpos->flags & SWP_NOCLIENTSIZE))
@@ -1075,5 +1081,6 @@
             else if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
 
-            SendMessageA(WM_SIZE, wp, MAKELONG(wpos->cx,wpos->cy));
+           SendMessageA(WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
+                                              rectClient.bottom - rectClient.top));
         }
         return 0;
@@ -1469,4 +1476,5 @@
    BOOL rc = FALSE;
    Win32Window *window;
+   HWND hParent = 0;
 
    dprintf (("SetWindowPos %x %x (%d,%d)(%d,%d) %x", Win32Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
@@ -1484,5 +1492,4 @@
    WINDOWPOS wpos;
    SWP swp, swpOld;
-   ULONG parentHeight;
 
    //****************************
@@ -1501,10 +1508,12 @@
    //**********************************************
    if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE)) {
-       OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
-       parentHeight = isChild() ?
-           OSLibGetWindowHeight(getParent()->getOS2WindowHandle())
-         : OSLibQueryScreenHeight();
+       if (isChild())
+       {
+           hParent = getParent()->getOS2WindowHandle();
+           OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
+       } else
+           OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
    }
-   OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, parentHeight);
+   OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame);
 
    /* MapSWP can clear the SWP_MOVE and SWP_SIZE flags if the window is not
Index: trunk/src/user32/new/win32wnd.h
===================================================================
--- trunk/src/user32/new/win32wnd.h	(revision 713)
+++ trunk/src/user32/new/win32wnd.h	(revision 715)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.25 1999-08-25 15:08:51 dengert Exp $ */
+/* $Id: win32wnd.h,v 1.26 1999-08-27 17:50:57 dengert Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -102,4 +102,13 @@
          PRECT  getClientRect()                 { return &rectClient; };
          PRECT  getWindowRect()                 { return &rectWindow; };
+void   setClientRect(LONG left, LONG top, LONG right, LONG bottom)
+{ rectClient.left  = left;  rectClient.top    = top;
+  rectClient.right = right; rectClient.bottom = bottom;
+};
+void   setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
+{ rectWindow.left  = left;  rectWindow.top    = top;
+  rectWindow.right = right; rectWindow.bottom = bottom;
+};
+         void   setWindowRect(PRECT rect)       { rectWindow = *rect; };
 
          DWORD  getFlags()                      { return flags; };
