Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 323)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 324)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.8 1999-07-17 15:23:38 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.9 1999-07-17 18:30:51 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -42,4 +42,6 @@
  HWND  hwndClient;
  RECTL rectl;
+
+  dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle, pszName));
 
   if(pszName && *pszName == 0) {
@@ -181,8 +183,5 @@
 
   if(fl & SWP_MOVE) {
-        hwndParent = WinQueryWindow(hwnd, QW_PARENT);
-        if(WinQueryWindowRect(hwnd, &rectl)) {
-                y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
-	}
+	y = MapOS2ToWin32Y(hwnd, y);
   }
   return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
@@ -297,3 +296,58 @@
 //******************************************************************************
 //******************************************************************************
-
+inline ULONG OS2TOWIN32POINT(RECTL *parent, RECTL *child, ULONG y)
+{
+  return (parent->yTop - parent->yBottom - (child->yTop - child->yBottom) - y - 1);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG MapOS2ToWin32Y(HWND hwndChild)
+{
+ HWND  hwndParent;
+ RECTL rectParent = {0}, rectChild = {0};
+
+   WinQueryWindowRect(hwndChild, &rectChild);
+   hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
+   WinQueryWindowRect(hwndParent, &rectParent);
+   return OS2TOWIN32POINT(&rectParent, &rectChild, rectChild.yBottom);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG y)
+{
+ HWND  hwndParent;
+ RECTL rectParent = {0}, rectChild = {0};
+
+   WinQueryWindowRect(hwndChild, &rectChild);
+   hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
+   WinQueryWindowRect(hwndParent, &rectParent);
+   return OS2TOWIN32POINT(&rectParent, &rectChild, y);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG MapOS2ToWin32Y(PRECTL rectParent, PRECTL rectChild, ULONG y)
+{
+   return OS2TOWIN32POINT(rectParent, rectChild, y);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG MapOS2ToWin32Y(PRECTL rectParent, HWND hwndChild, ULONG y)
+{
+ RECTL rectChild = {0};
+
+   WinQueryWindowRect(hwndChild, &rectChild);
+   return OS2TOWIN32POINT(rectParent, &rectChild, y);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG MapOS2ToWin32Y(HWND hwndChild, PRECTL rectChild, ULONG y)
+{
+ HWND  hwndParent;
+ RECTL rectParent = {0};
+
+   hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
+   WinQueryWindowRect(hwndParent, &rectParent);
+   return OS2TOWIN32POINT(&rectParent, rectChild, y);
+}
+//******************************************************************************
+//******************************************************************************
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 323)
+++ trunk/src/user32/new/oslibwin.h	(revision 324)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.8 1999-07-17 18:30:51 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -12,6 +12,4 @@
 #ifndef __OSLIBWIN_H__
 #define __OSLIBWIN_H__
-
-#define OS2TOWIN32POINT(height, y)      (height - y)
 
 #define OSLIB_HWND_DESKTOP      0
@@ -92,3 +90,10 @@
 BOOL  OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode = FALSE);
 
+
+ULONG MapOS2ToWin32Y(HWND hwndChild);
+ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG y);
+ULONG MapOS2ToWin32Y(PRECTL rectParent, PRECTL rectChild, ULONG y);
+ULONG MapOS2ToWin32Y(PRECTL rectParent, HWND hwndChild, ULONG y);
+ULONG MapOS2ToWin32Y(HWND hwndChild, PRECTL rectChild, ULONG y);
+
 #endif //__OSLIBWIN_H__
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 323)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 324)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.6 1999-07-17 15:23:38 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.7 1999-07-17 18:30:51 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -164,54 +164,17 @@
     case WM_MOVE:
     {
-     RECTL  rectl, rectl2;
-     POINTL point;
-     HWND   hwndParent;
-     ULONG  xScreen, yScreen, yParent, xParent;
+      RECTL rectChild;
+      ULONG xParent, yParent;
 
 	dprintf(("OS2: WM_MOVE %x", hwnd));
-        rc = WinQueryWindowRect(hwnd, &rectl);
-        if(rc == TRUE) {
-                point.x = rectl.xLeft;
-                point.y = rectl.yBottom;
-
-                //If the window has a parent, calculate position relative to that window
-                if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) {
-                        rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1);
-                        if(rc == FALSE) {
-                                dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!"));
-                                break;
-                        }
-                        rc = WinQueryWindowRect(hwndParent, &rectl2);
-                        if(rc == FALSE) {
-                                dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
-                                break;
-                        }
-                        xParent = point.x;
-                        yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);
-                }
-                else    xParent = yParent = -1;
-
-                point.x = rectl.xLeft;
-                point.y = rectl.yBottom;
-
-                rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1);
-                if(rc == FALSE) {
-                        dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!"));
-                        break;
-                }
-                rc = WinQueryWindowRect(HWND_DESKTOP, &rectl);
-                if(rc == FALSE) {
-                        dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
-                        break;
-                }
-                xScreen = point.x;
-                yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y);
-
-                if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) {
-                        goto RunDefWndProc;
-                }
-        }
-        else {
-                dprintf(("WM_MOVE: WinQueryWindowRect failed!"));
+
+	WinQueryWindowRect(hwnd, &rectChild);
+
+        //Calculate position relative to parent window (real window or desktop)
+        xParent = rectChild.xLeft;
+        yParent = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
+
+       	if(win32wnd->MsgMove(xParent, yParent)) {
+           	goto RunDefWndProc;
         }
         break;
@@ -266,5 +229,4 @@
                 goto RunDefWndProc;
         }
-
         break;
     }
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 323)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 324)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
+/* $Id: win32wnd.cpp,v 1.8 1999-07-17 18:30:51 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -27,4 +27,5 @@
 #include "hooks.h"
 #include <oslibwin.h>
+#include <oslibutil.h>
 
 #define HAS_DLGFRAME(style,exStyle) \
@@ -662,5 +663,5 @@
 //******************************************************************************
 //******************************************************************************
-ULONG Win32Window::MsgMove(ULONG xScreen, ULONG yScreen, ULONG xParent, ULONG yParent)
+ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent)
 {
   return 0;
@@ -731,5 +732,5 @@
                 return 1;
   }
-  return SendMessageA(win32msg, 0, MAKELONG(x, OS2TOWIN32POINT(height, y)));
+  return SendMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y)));
 }
 //******************************************************************************
Index: trunk/src/user32/new/win32wnd.h
===================================================================
--- trunk/src/user32/new/win32wnd.h	(revision 323)
+++ trunk/src/user32/new/win32wnd.h	(revision 324)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.6 1999-07-17 11:52:23 sandervl Exp $ */
+/* $Id: win32wnd.h,v 1.7 1999-07-17 18:30:52 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -58,5 +58,5 @@
 	 ULONG  MsgEnable(BOOL fEnable);
 	 ULONG  MsgShow(BOOL fShow);
-	 ULONG  MsgMove(ULONG xScreen, ULONG yScreen, ULONG xParent, ULONG yParent);
+	 ULONG  MsgMove(ULONG xParent, ULONG yParent);
 	 ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
          ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
