Index: trunk/src/user32/new/makefile
===================================================================
--- trunk/src/user32/new/makefile	(revision 691)
+++ trunk/src/user32/new/makefile	(revision 693)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.32 1999-08-24 19:15:54 phaller Exp $
+# $Id: makefile,v 1.33 1999-08-25 15:08:50 dengert Exp $
 
 #
@@ -99,5 +99,5 @@
 windlgmsg.obj: windlgmsg.cpp win32class.h win32wnd.h win32dlg.h win32wndchild.h
 
-pmwindow.obj:   pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h  oslibgdi.h
+pmwindow.obj:   pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h oslibgdi.h oslibwin.h
 win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
 win32wnd.obj:   win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h
Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 691)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 693)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.23 1999-08-22 18:29:37 dengert Exp $ */
+/* $Id: oslibwin.cpp,v 1.24 1999-08-25 15:08:50 dengert Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -5,4 +5,5 @@
  *
  * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
+ * Copyright 1999 Daniela Engert (dani@ngrt.de)
  *
  *
@@ -18,4 +19,5 @@
 
 #include <misc.h>
+#include "win32type.h"
 #include <winconst.h>
 #include "oslibwin.h"
@@ -31,5 +33,5 @@
   if(hwndParent == OSLIB_HWND_DESKTOP)
   {
-	hwndParent = HWND_DESKTOP;
+        hwndParent = HWND_DESKTOP;
   }
 
@@ -39,5 +41,5 @@
 //******************************************************************************
 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)
 {
  HWND  hwndClient;
@@ -46,36 +48,36 @@
 
   if(pszName && *pszName == 0) {
-	pszName = NULL;
+        pszName = NULL;
   }
   if(hwndParent == OSLIB_HWND_DESKTOP) {
-	hwndParent = HWND_DESKTOP;
+        hwndParent = HWND_DESKTOP;
   }
   if(Owner == OSLIB_HWND_DESKTOP) {
-	Owner = HWND_DESKTOP;
+        Owner = HWND_DESKTOP;
   }
 
   if(dwFrameStyle) {
-	ULONG dwClientStyle;
-
-	dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
-	if(pszName)
-		dwFrameStyle |= FCF_TITLEBAR;
-
-	dwFrameStyle |= FCF_TASKLIST;
-	*hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
-				       &dwFrameStyle, WIN32_STDCLASS,
-				       "", dwClientStyle, 0, 0, &hwndClient);
-	if(*hwndFrame) {
-		if(pszName) {
-			WinSetWindowText(*hwndFrame, pszName);
-		}
-		return hwndClient;
-	}
-	dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
-	return 0;
+        ULONG dwClientStyle;
+
+        dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
+        if(pszName)
+                dwFrameStyle |= FCF_TITLEBAR;
+
+        dwFrameStyle |= FCF_TASKLIST;
+        *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
+                                       &dwFrameStyle, WIN32_STDCLASS,
+                                       "", dwClientStyle, 0, 0, &hwndClient);
+        if(*hwndFrame) {
+                if(pszName) {
+                        WinSetWindowText(*hwndFrame, pszName);
+                }
+                return hwndClient;
+        }
+        dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
+        return 0;
   }
   hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, 0, 0, 0, 0,
-			       Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
-			       NULL);
+                               Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
+                               NULL);
   *hwndFrame = hwndClient;
   return hwndClient;
@@ -85,51 +87,51 @@
 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
 {
-  *OSWinStyle	= 0;
+  *OSWinStyle   = 0;
   *OSFrameStyle = 0;
 
   /* Window styles */
   if(dwStyle & WS_MINIMIZE_W)
-	*OSWinStyle |= WS_MINIMIZED;
+        *OSWinStyle |= WS_MINIMIZED;
 //Done explicitely in CreateWindowExA
 #if 0
   if(dwStyle & WS_VISIBLE_W)
-	*OSWinStyle |= WS_VISIBLE;
+        *OSWinStyle |= WS_VISIBLE;
 #endif
   if(dwStyle & WS_DISABLED_W)
-	*OSWinStyle |= WS_DISABLED;
+        *OSWinStyle |= WS_DISABLED;
   if(dwStyle & WS_CLIPSIBLINGS_W)
-	*OSWinStyle |= WS_CLIPSIBLINGS;
+        *OSWinStyle |= WS_CLIPSIBLINGS;
   if(dwStyle & WS_CLIPCHILDREN_W)
-	*OSWinStyle |= WS_CLIPCHILDREN;
+        *OSWinStyle |= WS_CLIPCHILDREN;
   if(dwStyle & WS_MAXIMIZE_W)
-	*OSWinStyle |= WS_MAXIMIZED;
+        *OSWinStyle |= WS_MAXIMIZED;
   if(dwStyle & WS_GROUP_W)
-	*OSWinStyle |= WS_GROUP;
+        *OSWinStyle |= WS_GROUP;
   if(dwStyle & WS_TABSTOP_W)
-	*OSWinStyle |= WS_TABSTOP;
+        *OSWinStyle |= WS_TABSTOP;
 
   if(dwStyle & WS_CAPTION_W)
-	*OSFrameStyle |= FCF_TITLEBAR;
+        *OSFrameStyle |= FCF_TITLEBAR;
   if(dwStyle & WS_DLGFRAME_W)
-	*OSFrameStyle |= FCF_DLGBORDER;
+        *OSFrameStyle |= FCF_DLGBORDER;
   else
   if(dwStyle & WS_BORDER_W)
-	*OSFrameStyle |= FCF_BORDER;
+        *OSFrameStyle |= FCF_BORDER;
 
   if(dwStyle & WS_VSCROLL_W)
-	*OSFrameStyle |= FCF_VERTSCROLL;
+        *OSFrameStyle |= FCF_VERTSCROLL;
   if(dwStyle & WS_HSCROLL_W)
-	*OSFrameStyle |= FCF_HORZSCROLL;
+        *OSFrameStyle |= FCF_HORZSCROLL;
   if(dwStyle & WS_SYSMENU_W)
-	*OSFrameStyle |= FCF_SYSMENU;
+        *OSFrameStyle |= FCF_SYSMENU;
   if(dwStyle & WS_THICKFRAME_W)
-	*OSFrameStyle |= FCF_SIZEBORDER;	//??
+        *OSFrameStyle |= FCF_SIZEBORDER;        //??
   if(dwStyle & WS_MINIMIZEBOX_W)
-	*OSFrameStyle |= FCF_MINBUTTON;
+        *OSFrameStyle |= FCF_MINBUTTON;
   if(dwStyle & WS_MAXIMIZEBOX_W)
-	*OSFrameStyle |= FCF_MAXBUTTON;
+        *OSFrameStyle |= FCF_MAXBUTTON;
 
   if(dwExStyle & WS_EX_DLGMODALFRAME_W)
-	*OSFrameStyle |= FCF_DLGBORDER;
+        *OSFrameStyle |= FCF_DLGBORDER;
 
   return TRUE;
@@ -226,5 +228,5 @@
 //******************************************************************************
 BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx,
-			  LONG cy, ULONG fl)
+                          LONG cy, ULONG fl)
 {
  HWND hwndParent = hwndInsertBehind;
@@ -232,12 +234,12 @@
 
     if(fl & SWP_MOVE) {
-	switch(hwndParent)
-	{
-	    case HWNDOS_TOP:
-	    case HWNDOS_BOTTOM:
-		hwndParent = HWND_DESKTOP;
-		break;
-	}
-	y = MapOS2ToWin32Y(hwndParent, cy, y);
+        switch(hwndParent)
+        {
+            case HWNDOS_TOP:
+            case HWNDOS_BOTTOM:
+                hwndParent = HWND_DESKTOP;
+                break;
+        }
+        y = MapOS2ToWin32Y(hwndParent, cy, y);
     }
     rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
@@ -247,4 +249,10 @@
 //******************************************************************************
 //******************************************************************************
+BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
+{
+    return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
+}
+//******************************************************************************
+//******************************************************************************
 BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
 {
@@ -252,11 +260,11 @@
 
   if(fl & SWP_SHOW) {
-	 rc = WinShowWindow(hwnd, TRUE);
+         rc = WinShowWindow(hwnd, TRUE);
   }
   if(rc == 0)
-	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
   rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl);
   if(rc == 0)
-	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
   return rc;
 }
@@ -271,15 +279,15 @@
 BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
 {
- BOOL	  rc;
+ BOOL     rc;
  RECTLOS2 rectl;
 
   rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
   if(rc) {
-	if(RelativeTo == RELATIVE_TO_SCREEN) {
-		MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
-	}
-	else	MapOS2ToWin32Rectl(&rectl, pRect);
-  }
-  else	memset(pRect, 0, sizeof(RECT));
+        if(RelativeTo == RELATIVE_TO_SCREEN) {
+                MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
+        }
+        else    MapOS2ToWin32Rectl(&rectl, pRect);
+  }
+  else  memset(pRect, 0, sizeof(RECT));
   return rc;
 }
@@ -293,11 +301,11 @@
   rc = WinQueryWindowPos(hwnd, &swp);
   if(rc == FALSE) {
-	dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
-	return FALSE;
+        dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
+        return FALSE;
   }
 
   if(swp.fl & SWP_MINIMIZE)
-	return TRUE;
-  else	return FALSE;
+        return TRUE;
+  else  return FALSE;
 }
 //******************************************************************************
@@ -389,3 +397,236 @@
 //******************************************************************************
 //******************************************************************************
-
+BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
+{
+  return WinQueryWindowPos(hwnd, pswp);
+}
+//******************************************************************************
+//******************************************************************************
+void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, ULONG parentHeight)
+{
+   HWND hWindow            = pswp->hwnd;
+   HWND hWndInsertAfter    = pswp->hwndInsertBehind;
+   long x                  = pswp->x;
+   long y                  = pswp->y;
+   long cx                 = pswp->cx;
+   long cy                 = pswp->cy;
+   UINT fuFlags            = (UINT)pswp->fl;
+
+   HWND  hWinAfter;
+   ULONG flags = 0;
+
+   //***************************************************
+   // Map constant HWNDs (e.g. HWND_DESKTOP, HWND_TOP)
+   //***************************************************
+   HWND  hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
+
+   if ( hWndInsertAfter == HWND_TOP )
+      hWinAfter = HWND_TOP_W;
+   else if ( hWndInsertAfter == HWND_BOTTOM )
+      hWinAfter = HWND_BOTTOM_W;
+   else
+      hWinAfter = (HWND) hWndInsertAfter;
+
+   //***********************************
+   // convert PM flags to Windows flags
+   //***********************************
+   if (!(fuFlags & SWP_SIZE))       flags |= SWP_NOSIZE_W;
+   if (!(fuFlags & SWP_MOVE))       flags |= SWP_NOMOVE_W;
+   if (!(fuFlags & SWP_ZORDER))     flags |= SWP_NOZORDER_W;
+   if (  fuFlags & SWP_NOREDRAW)    flags |= SWP_NOREDRAW_W;
+   if (!(fuFlags & SWP_ACTIVATE))   flags |= SWP_NOACTIVATE_W;
+   if (  fuFlags & SWP_SHOW)        flags |= SWP_SHOWWINDOW_W;
+   if (  fuFlags & SWP_HIDE)        flags |= SWP_HIDEWINDOW_W;
+
+   //**************************************************************************
+   // When moving or sizing we'll have to do some calculations for Y inversion.
+   //
+   // If moving - invert Y coord.
+   //
+   // If sizing - if the height is changing, have to move the window to
+   //             maintain correct windows position.  If we just size then the
+   //             TR corner will extend.  The Windows behaviour should be to
+   //             extend the BR corner.
+   //
+   // If this is a child window then we'll have to move within the client
+   // area of the parent.
+   //
+   // If this is an overlapped or popup window we'll have to move around
+   // within the desktop.
+   //**************************************************************************
+   if ( fuFlags & (SWP_MOVE | SWP_SIZE) )
+   {
+      if (fuFlags & SWP_SIZE)
+      {
+         // If height is changing we MUST move to maintain top-left alignment
+         if (cy != pswpOld->cy)
+         {
+            flags &= ~SWP_NOMOVE_W;
+         }
+      }
+      else
+      {
+         cx = pswpOld->cx;
+         cy = pswpOld->cy;
+      }
+
+      //**********************************************************
+      // We'll need both a y and cy for the Y inversion code.
+      // If either wasn't passed in, calculate the current value.
+      //**********************************************************
+      if ((fuFlags & SWP_MOVE) == 0)
+      {
+         x = pswpOld->x;
+         y = pswpOld->y;
+      }
+
+      //********************************************************
+      // Y inversion here... old Y is top left corner of window
+      // relative to top left of parent.
+      //********************************************************
+      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
+      // coordinates.
+      if ( ( pswpOld->x == x ) && ( oldY == y ) )
+         flags |= SWP_NOMOVE_W;
+
+      // Set the SWP_NOSIZE_W flag if the window is not really being sized.
+      if ( ( pswpOld->cx == cx ) && ( pswpOld->cy == cy ) )
+         flags |= SWP_NOSIZE_W;
+   }
+
+   // Fill in the WINDOWPOS structure with the now calculated PM values.
+   pwpos->flags            = (UINT)flags;
+   pwpos->cy               = (int)cy;
+   pwpos->cx               = (int)cx;
+   pwpos->x                = (int)x;
+   pwpos->y                = (int)y;
+   pwpos->hwndInsertAfter  = hWinAfter;
+   pwpos->hwnd             = hWindow;
+}
+//******************************************************************************
+//******************************************************************************
+void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, ULONG parentHeight)
+{
+   HWND hWnd              = pwpos->hwnd;
+   HWND hWndInsertAfter   = pwpos->hwndInsertAfter;
+   long x                 = pwpos->x;
+   long y                 = pwpos->y;
+   long cx                = pwpos->cx;
+   long cy                = pwpos->cy;
+   UINT fuFlags           = pwpos->flags;
+
+   HWND  hWinAfter;
+   ULONG flags = 0;
+
+   //***************************************************
+   // Map constant HWNDs (e.g. HWND_DESKTOP, HWND_TOP)
+   //***************************************************
+   HWND  hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
+
+   if ( hWndInsertAfter == HWND_TOPMOST_W )
+//      hWinAfter = HWND_TOPMOST;
+      hWinAfter = HWND_TOP;
+   else if ( hWndInsertAfter == HWND_NOTOPMOST_W )
+//      hWinAfter = HWND_NOTOPMOST;
+      hWinAfter = HWND_TOP;
+   else if ( hWndInsertAfter == HWND_TOP_W )
+      hWinAfter = HWND_TOP;
+   else if ( hWndInsertAfter == HWND_BOTTOM_W )
+      hWinAfter = HWND_BOTTOM;
+   else
+      hWinAfter = (HWND) hWndInsertAfter;
+
+   //***********************************
+   // convert Windows flags to PM flags
+   //***********************************
+   if ( ! ( fuFlags & SWP_NOSIZE_W     ) ) flags |= SWP_SIZE;
+   if ( ! ( fuFlags & SWP_NOMOVE_W     ) ) flags |= SWP_MOVE;
+   if ( ! ( fuFlags & SWP_NOZORDER_W   ) ) flags |= SWP_ZORDER;
+   if (     fuFlags & SWP_NOREDRAW_W   )   flags |= SWP_NOREDRAW;
+   if ( ! ( fuFlags & SWP_NOACTIVATE_W ) ) flags |= SWP_ACTIVATE;
+   if (     fuFlags & SWP_SHOWWINDOW_W )   flags |= SWP_SHOW;
+   if (     fuFlags & SWP_HIDEWINDOW_W )   flags |= SWP_HIDE;
+   /* no PM equivalent for SWP_FRAMECHANGED_W, SWP_NOCOPYBITS_W and SWP_NOOWNERZORDER_W */
+
+   //**************************************************************************
+   // When moving or sizing we'll have to do some calculations for Y inversion.
+   //
+   // If moving - invert Y coord.
+   //
+   // If sizing - if the height is changing, have to move the window to
+   //             maintain correct windows position.  If we just size then the
+   //             TR corner will extend.  The Windows behaviour should be to
+   //             extend the BR corner.
+   //
+   // If this is a child window then we'll have to move within the client
+   // area of the parent.
+   //
+   // If this is an overlapped or popup window we'll have to move around
+   // within the desktop.
+   //**************************************************************************
+   if ( flags & (SWP_MOVE | SWP_SIZE) )
+   {
+      //**********************************************************
+      // We'll need both a y and cy for the Y inversion code.
+      // If either wasn't passed in, calculate the current value.
+      //**********************************************************
+      if ((flags & SWP_MOVE) == 0)
+      {
+         x = pswpOld->x;
+         y = pswpOld->y;
+
+         // If the window is at (x,0) with a height of zero then this calculation
+         // won't quite work.  Instead of calculating the Windows y coord, we set
+         // it at (x,0).
+         if (!(y == 0 && pswpOld->cy == 0))
+         {
+            // convert Y coordinate back to Windows's for later conversion with new size
+            y = parentHeight - y - pswpOld->cy;
+         }
+      }
+
+      if (flags & SWP_SIZE)
+      {
+         // If height is changing we MUST move to maintain top-left alignment
+         if (cy != pswpOld->cy)
+            flags |= SWP_MOVE;
+      }
+      else
+      {
+         cx = pswpOld->cx;
+         cy = pswpOld->cy;
+      }
+
+      //********************************************************
+      // Y inversion here... old Y is top left corner of window
+      // relative to top left of parent.
+      //********************************************************
+      y = parentHeight - y - cy;
+
+      // Clear the SWP_MOVE flag if the window is not really being moved.
+      if ( ( pswpOld->x == x ) && ( pswpOld->y == y ) )
+         flags &= ~SWP_MOVE;
+
+      // Clear the SWP_SIZE flag if the window is not really being sized.
+      if ( ( pswpOld->cx == cx ) && ( pswpOld->cy == cy ) )
+         flags &= ~SWP_SIZE;
+   }
+
+   // Fill in the WINDOWPOS structure with the now calculated PM values.
+   pswp->fl               = flags;
+   pswp->cy               = cy;
+   pswp->cx               = cx;
+   pswp->x                = x;
+   pswp->y                = y;
+   pswp->hwndInsertBehind = hWinAfter;
+   pswp->hwnd             = hWindow;
+   pswp->ulReserved1      = 0;
+   pswp->ulReserved2      = 0;
+}
+//******************************************************************************
+//******************************************************************************
+
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 691)
+++ trunk/src/user32/new/oslibwin.h	(revision 693)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.20 1999-08-20 20:09:51 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -5,4 +5,5 @@
  *
  * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
+ * Copyright 1999      Daniela Engert (dani@ngrt.de)
  *
  *
@@ -13,4 +14,19 @@
 #define __OSLIBWIN_H__
 #include <oslibgdi.h>
+
+#ifndef WIN_INCLUDED
+typedef struct _SWP    /* swp */
+{
+   ULONG   fl;
+   LONG    cy;
+   LONG    cx;
+   LONG    y;
+   LONG    x;
+   HWND    hwndInsertBehind;
+   HWND    hwnd;
+   ULONG   ulReserved1;
+   ULONG   ulReserved2;
+} SWP, *PSWP;
+#endif
 
 #define OSLIB_HWND_DESKTOP      0
@@ -39,4 +55,7 @@
 BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus);
 ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation
+
+extern ULONG ScreenHeight;
+inline ULONG OSLibQueryScreenHeight(void) { return (ScreenHeight); }
 
 //reserved deleted
@@ -168,4 +187,5 @@
 
 BOOL  OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl);
+BOOL  OSLibWinSetMultWindowPos(struct _SWP *pswp, ULONG num);
 BOOL  OSLibWinShowWindow(HWND hwnd, ULONG fl);
 
@@ -213,3 +233,7 @@
 BOOL  OSLibWinSetIcon(HWND hwnd, HANDLE hIcon);
 
+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);
+
 #endif //__OSLIBWIN_H__
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 691)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 693)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.20 1999-08-23 15:34:46 dengert Exp $ */
+/* $Id: pmwindow.cpp,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -13,8 +13,9 @@
 #define INCL_GPI
 
-#include <os2.h>			/* PM header file		*/
+#include <os2.h>                        /* PM header file               */
 #include <os2wrap.h>
 #include <stdlib.h>
 #include "win32type.h"
+#include <winconst.h>
 #include <wprocess.h>
 #include <misc.h>
@@ -27,8 +28,10 @@
 #include "oslibmsg.h"
 
-HMQ  hmq = 0;				  /* Message queue handle	  */
+HMQ  hmq = 0;                             /* Message queue handle         */
 HAB  hab = 0;
 
 RECTL desktopRectl = {0};
+ULONG ScreenWidth  = 0;
+ULONG ScreenHeight = 0;
 
 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
@@ -45,23 +48,23 @@
   if(!hab || !hmq)
   {
-	UINT error;
-	//CB: only fail on real error
-	error = WinGetLastError(hab) & 0xFFFF; //error code
-	if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
-	{
-	    dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
-	    dprintf((" Error = %x",error));
-	    return(FALSE);
-	}
+        UINT error;
+        //CB: only fail on real error
+        error = WinGetLastError(hab) & 0xFFFF; //error code
+        if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
+        {
+            dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
+            dprintf((" Error = %x",error));
+            return(FALSE);
+        }
     else
-	{
-	if(!hab) {
-		hab = WinQueryAnchorBlock(HWND_DESKTOP);
-	    dprintf(("WinQueryAnchorBlock returned %x", hab));
-	}
-	if(!hmq) {
-	    hmq = HMQ_CURRENT;
-	}
-	}
+        {
+        if(!hab) {
+                hab = WinQueryAnchorBlock(HWND_DESKTOP);
+            dprintf(("WinQueryAnchorBlock returned %x", hab));
+        }
+        if(!hmq) {
+            hmq = HMQ_CURRENT;
+        }
+        }
   }
   SetThreadHAB(hab);
@@ -69,16 +72,19 @@
   SetThreadMessageQueue(hmq);
 
-  if(!WinRegisterClass( 		/* Register window class	*/
-     hab,				/* Anchor block handle		*/
-     (PSZ)WIN32_STDCLASS,		/* Window class name		*/
-     (PFNWP)Win32WindowProc,		/* Address of window procedure	*/
+  if(!WinRegisterClass(                 /* Register window class        */
+     hab,                               /* Anchor block handle          */
+     (PSZ)WIN32_STDCLASS,               /* Window class name            */
+     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
      CS_SIZEREDRAW | CS_HITTEST,
      8)) {
-	dprintf(("WinRegisterClass Win32Window failed"));
-	return(FALSE);
+        dprintf(("WinRegisterClass Win32Window failed"));
+        return(FALSE);
    }
 
    WinQueryWindowRect(HWND_DESKTOP, &desktopRectl);
-   dprintf(("InitPM: Desktop (%d,%d)", desktopRectl.xRight, desktopRectl.yTop));
+   ScreenWidth  = desktopRectl.xRight;
+   ScreenHeight = desktopRectl.yTop;
+
+   dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight));
    return OSLibInitMsgQueue();
 } /* End of main */
@@ -89,7 +95,7 @@
 {
  POSTMSG_PACKET *postmsg;
- OSLIBPOINT	 point, ClientPoint;
- Win32Window	*win32wnd;
- APIRET 	 rc;
+ OSLIBPOINT      point, ClientPoint;
+ Win32Window    *win32wnd;
+ APIRET          rc;
 
   //Restore our FS selector
@@ -99,6 +105,6 @@
 
   if(msg != WM_CREATE && win32wnd == NULL) {
-	dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
-	goto RunDefWndProc;
+        dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
+        goto RunDefWndProc;
   }
   switch( msg )
@@ -106,106 +112,118 @@
     //internal messages
     case WM_WIN32_POSTMESSAGEA:
-	postmsg = (POSTMSG_PACKET *)mp1;
-	if(postmsg == NULL) {
-	    dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
-	    break;
-	}
-	win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
-	free(postmsg);
-	break;
+        postmsg = (POSTMSG_PACKET *)mp1;
+        if(postmsg == NULL) {
+            dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
+            break;
+        }
+        win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
+        free(postmsg);
+        break;
 
     case WM_WIN32_POSTMESSAGEW:
-	postmsg = (POSTMSG_PACKET *)mp1;
-	if(postmsg == NULL) {
-	    dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
-	    break;
-	}
-	win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
-	free(postmsg);
-	break;
+        postmsg = (POSTMSG_PACKET *)mp1;
+        if(postmsg == NULL) {
+            dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
+            break;
+        }
+        win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
+        free(postmsg);
+        break;
 
     //OS/2 msgs
     case WM_CREATE:
-	//Processing is done in after WinCreateWindow returns
-	dprintf(("OS2: WM_CREATE %x", hwnd));
-	RestoreOS2TIB();
-	return (MRESULT)FALSE;
+        //Processing is done in after WinCreateWindow returns
+        dprintf(("OS2: WM_CREATE %x", hwnd));
+        RestoreOS2TIB();
+        return (MRESULT)FALSE;
 
     case WM_QUIT:
-	dprintf(("OS2: WM_QUIT %x", hwnd));
-	if(win32wnd->MsgQuit()) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_QUIT %x", hwnd));
+        if(win32wnd->MsgQuit()) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_CLOSE:
-	dprintf(("OS2: WM_CLOSE %x", hwnd));
-	if(win32wnd->MsgClose()) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_CLOSE %x", hwnd));
+        if(win32wnd->MsgClose()) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_DESTROY:
-	dprintf(("OS2: WM_DESTROY %x", hwnd));
-	if(win32wnd->MsgDestroy()) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_DESTROY %x", hwnd));
+        if(win32wnd->MsgDestroy()) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_ENABLE:
-	dprintf(("OS2: WM_ENABLE %x", hwnd));
-	if(win32wnd->MsgEnable((ULONG)mp1)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_ENABLE %x", hwnd));
+        if(win32wnd->MsgEnable((ULONG)mp1)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_SHOW:
-	dprintf(("OS2: WM_SHOW %x", hwnd));
-	if(win32wnd->MsgShow((ULONG)mp1)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_SHOW %x", hwnd));
+        if(win32wnd->MsgShow((ULONG)mp1)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_ADJUSTWINDOWPOS:
     {
-      ULONG    x, y;
       PSWP     pswp = (PSWP)mp1;
-
-	dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
-
-	if(pswp->fl & SWP_MOVE) {
-	    if(win32wnd->isChild()) {
-		x = pswp->x;
-		y = pswp->cy - y - 1;
-	    }
-	    else {
-		OSLIBPOINT point;
-
-		point.x = pswp->x;
-		point.y = pswp->y;
-
-		MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-		x = point.x;
-		y = point.y;
-	    }
-	    if(win32wnd->MsgMove(x, y)) {
-		goto RunDefWndProc;
-	    }
-	    break;
-	}
-	goto RunDefWndProc;
+      SWP      swpOld;
+      WINDOWPOS wp;
+      ULONG    parentHeight = 0;
+
+        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+
+        WinQueryWindowPos(hwnd, &swpOld);
+
+        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
+            parentHeight = (win32wnd->isChild()) ?
+                OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
+              : OSLibQueryScreenHeight();
+        }
+        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, parentHeight);
+        wp.hwnd = win32wnd->getWindowHandle();
+        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
+        {
+           Win32Window *wndAfter = Win32Window::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
+           wp.hwndInsertAfter = wndAfter->getWindowHandle();
+        }
+        win32wnd->MsgPosChanging((LPARAM)&wp);
+        break;
     }
 
     case WM_WINDOWPOSCHANGED:
     {
-     PSWP pswp = (PSWP)mp1;
-
-	dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
-	goto RunDefWndProc;
+      PSWP      pswp = (PSWP)mp1;
+      WINDOWPOS wp;
+      ULONG     parentHeight = 0;
+
+        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_MOVE | SWP_SIZE)) {
+            parentHeight = (win32wnd->isChild()) ?
+                OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
+              : OSLibQueryScreenHeight();
+        }
+        OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswp+1, parentHeight);
+        wp.hwnd = win32wnd->getWindowHandle();
+        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
+        {
+           Win32Window *wndAfter = Win32Window::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
+           wp.hwndInsertAfter = wndAfter->getWindowHandle();
+        }
+        win32wnd->MsgPosChanged((LPARAM)&wp);
+        break;
     }
 
     case WM_ERASEBACKGROUND:
     {
-	return (MRESULT) FALSE;
+        return (MRESULT) FALSE;
     }
     case WM_SIZE:
@@ -213,17 +231,19 @@
      SWP swp;
 
-	rc = WinQueryWindowPos(hwnd, &swp);
-	if(rc == FALSE) {
-		dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
-		break;
-	}
-	dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)));
-	if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
-				(swp.fl & SWP_MINIMIZE) != 0,
-				(swp.fl & SWP_MAXIMIZE) != 0))
-	{
-		goto RunDefWndProc;
-	}
-	break;
+        rc = WinQueryWindowPos(hwnd, &swp);
+        if(rc == FALSE) {
+                dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
+                break;
+        }
+        dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)));
+#if 0
+        if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
+                                (swp.fl & SWP_MINIMIZE) != 0,
+                                (swp.fl & SWP_MAXIMIZE) != 0))
+        {
+                goto RunDefWndProc;
+        }
+#endif
+        break;
     }
 
@@ -232,18 +252,18 @@
       HWND hwndActivate = (HWND)mp1;
 
-	dprintf(("OS2: WM_ACTIVATE %x", hwnd));
-	if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
-		//another (non-win32) application's window
-		//set to NULL (allowed according to win32 SDK) to avoid problems
-		hwndActivate = NULL;
-	}
-	if(win32wnd->MsgActivate(1, hwndActivate)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_ACTIVATE %x", hwnd));
+        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
+                //another (non-win32) application's window
+                //set to NULL (allowed according to win32 SDK) to avoid problems
+                hwndActivate = NULL;
+        }
+        if(win32wnd->MsgActivate(1, hwndActivate)) {
+                goto RunDefWndProc;
+        }
+        break;
     }
     case WM_FOCUSCHANGE:
-	dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
-	goto RunDefWndProc;
+        dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
+        goto RunDefWndProc;
 
     case WM_SETFOCUS:
@@ -251,18 +271,18 @@
       HWND hwndFocus = (HWND)mp1;
 
-	dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
-	if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
-		//another (non-win32) application's window
-		//set to NULL (allowed according to win32 SDK) to avoid problems
-		hwndFocus = NULL;
-	}
-	if((ULONG)mp2 == TRUE) {
-		rc = win32wnd->MsgSetFocus(hwndFocus);
-	}
-	else	rc = win32wnd->MsgKillFocus(hwndFocus);
-	if(rc) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
+        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
+                //another (non-win32) application's window
+                //set to NULL (allowed according to win32 SDK) to avoid problems
+                hwndFocus = NULL;
+        }
+        if((ULONG)mp2 == TRUE) {
+                rc = win32wnd->MsgSetFocus(hwndFocus);
+        }
+        else    rc = win32wnd->MsgKillFocus(hwndFocus);
+        if(rc) {
+                goto RunDefWndProc;
+        }
+        break;
     }
     //**************************************************************************
@@ -270,96 +290,96 @@
     //**************************************************************************
     case WM_BUTTON1DOWN:
-	dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_BUTTON1UP:
-	dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON1DBLCLK:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2DOWN:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2UP:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2DBLCLK:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON3DOWN:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON3UP:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON3DBLCLK:
-	point.x = (*(POINTS *)&mp1).x;
-	point.y = (*(POINTS *)&mp1).y;
-	ClientPoint.x = point.x;
-	ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
-	MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
-	if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        point.x = (*(POINTS *)&mp1).x;
+        point.y = (*(POINTS *)&mp1).y;
+        ClientPoint.x = point.x;
+        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
+        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
+        if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_BUTTON2MOTIONSTART:
@@ -372,26 +392,26 @@
     case WM_BUTTON3MOTIONEND:
     case WM_BUTTON3CLICK:
-	goto RunDefWndProc;
+        goto RunDefWndProc;
 
     case WM_MOUSEMOVE:
     {
-	ULONG keystate = 0;
-	if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
-	    keystate |= WMMOVE_LBUTTON;
-	if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
-	    keystate |= WMMOVE_MBUTTON;
-	if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
-	    keystate |= WMMOVE_RBUTTON;
-	if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
-	    keystate |= WMMOVE_SHIFT;
-	if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
-	    keystate |= WMMOVE_CTRL;
-
-	//OS/2 Window coordinates -> Win32 Window coordinates
-	//TODO: What do windows apps that handle this messages return?
-	if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
-		goto RunDefWndProc;
-	}
-	break;
+        ULONG keystate = 0;
+        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
+            keystate |= WMMOVE_LBUTTON;
+        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
+            keystate |= WMMOVE_MBUTTON;
+        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
+            keystate |= WMMOVE_RBUTTON;
+        if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
+            keystate |= WMMOVE_SHIFT;
+        if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
+            keystate |= WMMOVE_CTRL;
+
+        //OS/2 Window coordinates -> Win32 Window coordinates
+        //TODO: What do windows apps that handle this messages return?
+        if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
+                goto RunDefWndProc;
+        }
+        break;
     }
 
@@ -405,12 +425,12 @@
 
     case WM_COMMAND:
-	if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
-	    win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
-	}
-	if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
-	    win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
-	}
-	//todo controls + accelerators
-	break;
+        if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
+            win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
+        }
+        if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
+            win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
+        }
+        //todo controls + accelerators
+        break;
 
     case WM_SYSCOMMAND:
@@ -419,41 +439,41 @@
       ULONG win32sc;
 
-	if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
-	    POINTL pointl;
-	    WinQueryPointerPos(HWND_DESKTOP, &pointl);
-	    x = pointl.x;
-	    y = desktopRectl.yTop - y;
-	}
-	switch(SHORT1FROMMP(mp1)) {
-	case SC_MOVE:
-	    win32sc = WIN32SC_MOVE;
-	    break;
-	case SC_CLOSE:
-	    win32sc = WIN32SC_CLOSE;
-	    break;
-	case SC_MAXIMIZE:
-	    win32sc = WIN32SC_MAXIMIZE;
-	    break;
-	case SC_MINIMIZE:
-	    win32sc = WIN32SC_MINIMIZE;
-	    break;
-	case SC_NEXTFRAME:
-	case SC_NEXTWINDOW:
-	    win32sc = WIN32SC_NEXTWINDOW;
-	    break;
-	case SC_RESTORE:
-	    win32sc = WIN32SC_RESTORE;
-	    break;
-	case SC_TASKMANAGER:
-	    win32sc = WIN32SC_TASKLIST;
-	    break;
-	default:
-	    goto RunDefWndProc;
-	}
-	dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
-	if(win32wnd->MsgSysCommand(win32sc, x, y)) {
-	    goto RunDefWndProc;
-	}
-	break;
+        if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
+            POINTL pointl;
+            WinQueryPointerPos(HWND_DESKTOP, &pointl);
+            x = pointl.x;
+            y = ScreenHeight - y;
+        }
+        switch(SHORT1FROMMP(mp1)) {
+        case SC_MOVE:
+            win32sc = WIN32SC_MOVE;
+            break;
+        case SC_CLOSE:
+            win32sc = WIN32SC_CLOSE;
+            break;
+        case SC_MAXIMIZE:
+            win32sc = WIN32SC_MAXIMIZE;
+            break;
+        case SC_MINIMIZE:
+            win32sc = WIN32SC_MINIMIZE;
+            break;
+        case SC_NEXTFRAME:
+        case SC_NEXTWINDOW:
+            win32sc = WIN32SC_NEXTWINDOW;
+            break;
+        case SC_RESTORE:
+            win32sc = WIN32SC_RESTORE;
+            break;
+        case SC_TASKMANAGER:
+            win32sc = WIN32SC_TASKLIST;
+            break;
+        default:
+            goto RunDefWndProc;
+        }
+        dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
+        if(win32wnd->MsgSysCommand(win32sc, x, y)) {
+            goto RunDefWndProc;
+        }
+        break;
     }
     case WM_CHAR:
@@ -462,27 +482,27 @@
      ULONG fl = SHORT1FROMMP(mp1);
 
-	if(!(fl & KC_CHAR)) {
-	    dprintf(("WM_CHAR: no valid character code"));
-	    goto RunDefWndProc;
-	}
-	if(fl & KC_VIRTUALKEY) {
-	    vkey = SHORT2FROMMP(mp2);
-	}
-	if(fl & KC_KEYUP) {
-	    keyflags |= KEY_UP;
-	}
-	if(fl & KC_ALT) {
-	    keyflags |= KEY_ALTDOWN;
-	}
-	if(fl & KC_PREVDOWN) {
-	    keyflags |= KEY_PREVDOWN;
-	}
-	if(fl & KC_DEADKEY) {
-	    keyflags |= KEY_DEADKEY;
-	}
-	if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
-	    goto RunDefWndProc;
-	}
-	break;
+        if(!(fl & KC_CHAR)) {
+            dprintf(("WM_CHAR: no valid character code"));
+            goto RunDefWndProc;
+        }
+        if(fl & KC_VIRTUALKEY) {
+            vkey = SHORT2FROMMP(mp2);
+        }
+        if(fl & KC_KEYUP) {
+            keyflags |= KEY_UP;
+        }
+        if(fl & KC_ALT) {
+            keyflags |= KEY_ALTDOWN;
+        }
+        if(fl & KC_PREVDOWN) {
+            keyflags |= KEY_PREVDOWN;
+        }
+        if(fl & KC_DEADKEY) {
+            keyflags |= KEY_DEADKEY;
+        }
+        if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
+            goto RunDefWndProc;
+        }
+        break;
     }
     case WM_INITMENU:
@@ -492,5 +512,5 @@
 
     case WM_TIMER:
-	goto RunDefWndProc;
+        goto RunDefWndProc;
 
     case WM_SETWINDOWPARAMS:
@@ -498,11 +518,11 @@
       WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
 
-	dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
-	if(wndParams->fsStatus & WPM_TEXT) {
-	    if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
-		    goto RunDefWndProc;
-	    }
-	}
-	goto RunDefWndProc;
+        dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
+        if(wndParams->fsStatus & WPM_TEXT) {
+            if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
+                    goto RunDefWndProc;
+            }
+        }
+        goto RunDefWndProc;
     }
 
@@ -513,26 +533,26 @@
      PSZ   wintext;
 
-	if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
-	    if(wndpars->fsStatus & WPM_CCHTEXT)
-		wndpars->cchText = win32wnd->MsgGetTextLength();
-	    if(wndpars->fsStatus & WPM_TEXT)
-		wndpars->pszText = win32wnd->MsgGetText();
-	    return (MRESULT)TRUE;
-	}
-	goto RunDefWndProc;
+        if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
+            if(wndpars->fsStatus & WPM_CCHTEXT)
+                wndpars->cchText = win32wnd->MsgGetTextLength();
+            if(wndpars->fsStatus & WPM_TEXT)
+                wndpars->pszText = win32wnd->MsgGetText();
+            return (MRESULT)TRUE;
+        }
+        goto RunDefWndProc;
     }
 
     case WM_PAINT:
-	dprintf(("OS2: WM_PAINT %x", hwnd));
-	if(win32wnd->MsgPaint(0, 0)) {
-		goto RunDefWndProc;
-	}
-	break;
+        dprintf(("OS2: WM_PAINT %x", hwnd));
+        if(win32wnd->MsgPaint(0, 0)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_HITTEST:
-	if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_SYSCOLORCHANGE:
@@ -558,7 +578,7 @@
     case WM_SEMANTICEVENT:
     default:
-//	  dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
-	RestoreOS2TIB();
-	return WinDefWindowProc( hwnd, msg, mp1, mp2 );
+//        dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
+        RestoreOS2TIB();
+        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
   }
   RestoreOS2TIB();
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 691)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 693)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.29 1999-08-23 15:34:47 dengert Exp $ */
+/* $Id: win32wnd.cpp,v 1.30 1999-08-25 15:08:50 dengert Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -57,5 +57,5 @@
 //******************************************************************************
 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
-			: GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()
+                        : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()
 {
   Init();
@@ -67,7 +67,7 @@
 void Win32Window::Init()
 {
-  isUnicode	   = FALSE;
-  fCreated	   = FALSE;
-  fFirstShow	   = TRUE;
+  isUnicode        = FALSE;
+  fCreated         = FALSE;
+  fFirstShow       = TRUE;
 
   memset(windowNameA, 0, MAX_WINDOW_NAMELENGTH);
@@ -78,38 +78,38 @@
   nrUserWindowLong = 0;
 
-  magic 	   = WIN32PM_MAGIC;
-  OS2Hwnd	   = 0;
-  OS2HwndFrame	   = 0;
-  OS2HwndMenu	   = 0;
-  Win32Hwnd	   = 0;
+  magic            = WIN32PM_MAGIC;
+  OS2Hwnd          = 0;
+  OS2HwndFrame     = 0;
+  OS2HwndMenu      = 0;
+  Win32Hwnd        = 0;
 
   if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0)
   {
-	dprintf(("Win32Window::Init HMHandleAllocate failed!!"));
-	DebugInt3();
-  }
-  Win32Hwnd	  &= 0xFFFF;
-  Win32Hwnd	  |= 0x68000000;
-
-  posx = posy	   = 0;
+        dprintf(("Win32Window::Init HMHandleAllocate failed!!"));
+        DebugInt3();
+  }
+  Win32Hwnd       &= 0xFFFF;
+  Win32Hwnd       |= 0x68000000;
+
+  posx = posy      = 0;
   width = height   = 0;
 
-  dwExStyle	   = 0;
-  dwStyle	   = 0;
-  win32wndproc	   = 0;
-  hInstance	   = 0;
-  windowId	   = 0xFFFFFFFF;	//default = -1
-  userData	   = 0;
+  dwExStyle        = 0;
+  dwStyle          = 0;
+  win32wndproc     = 0;
+  hInstance        = 0;
+  windowId         = 0xFFFFFFFF;        //default = -1
+  userData         = 0;
 
   hwndLinkAfter    = HWND_BOTTOM;
-  flags 	   = 0;
-  isIcon	   = FALSE;
+  flags            = 0;
+  isIcon           = FALSE;
   lastHitTestVal   = 0;
-  owner 	   = NULL;
-  windowClass	   = 0;
+  owner            = NULL;
+  windowClass      = 0;
 
   acceltableResource = NULL;
-  menuResource	     = NULL;
-  iconResource	     = NULL;
+  menuResource       = NULL;
+  iconResource       = NULL;
 }
 //******************************************************************************
@@ -122,7 +122,7 @@
 
   if(Win32Hwnd)
-	HMHandleFree(Win32Hwnd & 0xFFFF);
+        HMHandleFree(Win32Hwnd & 0xFFFF);
   if(userWindowLong)
-	free(userWindowLong);
+        free(userWindowLong);
 }
 //******************************************************************************
@@ -145,23 +145,23 @@
     if (cs->hwndParent)
     {
-	    Win32Window *window = GetWindowFromHandle(cs->hwndParent);
-	    if(!window) {
-		    dprintf(("Bad parent %04x\n", cs->hwndParent ));
-		    SetLastError(ERROR_INVALID_PARAMETER);
-		    return FALSE;
-	    }
-	    /* Make sure parent is valid */
-	    if (!window->IsWindow() )
-	    {
-		    dprintf(("Bad parent %04x\n", cs->hwndParent ));
-		    SetLastError(ERROR_INVALID_PARAMETER);
-		    return FALSE;
-	    }
+            Win32Window *window = GetWindowFromHandle(cs->hwndParent);
+            if(!window) {
+                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
+                    SetLastError(ERROR_INVALID_PARAMETER);
+                    return FALSE;
+            }
+            /* Make sure parent is valid */
+            if (!window->IsWindow() )
+            {
+                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
+                    SetLastError(ERROR_INVALID_PARAMETER);
+                    return FALSE;
+            }
     }
     else
     if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
-	    dprintf(("No parent for child window\n" ));
-	    SetLastError(ERROR_INVALID_PARAMETER);
-	    return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
+            dprintf(("No parent for child window\n" ));
+            SetLastError(ERROR_INVALID_PARAMETER);
+            return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
     }
 
@@ -170,7 +170,7 @@
   if (!windowClass)
   {
-	GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
-	dprintf(("Bad class '%s'\n", buffer ));
-	return 0;
+        GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
+        dprintf(("Bad class '%s'\n", buffer ));
+        return 0;
   }
 
@@ -180,11 +180,11 @@
    */
   if (!HIWORD(cs->lpszClass) ) {
-	if (isUnicode) {
-		GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
-	}
-	else {
-		GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
-	}
-	cs->lpszClass = buffer;
+        if (isUnicode) {
+                GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
+        }
+        else {
+                GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
+        }
+        cs->lpszClass = buffer;
   }
 
@@ -192,53 +192,53 @@
   if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
   {
-//	  PDB *pdb = PROCESS_Current();
+//        PDB *pdb = PROCESS_Current();
 
        /* Never believe Microsoft's documentation... CreateWindowEx doc says
-	* that if an overlapped window is created with WS_VISIBLE style bit
-	* set and the x parameter is set to CW_USEDEFAULT, the system ignores
-	* the y parameter. However, disassembling NT implementation (WIN32K.SYS)
-	* reveals that
-	*
-	* 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
-	* 2) it does not ignore the y parameter as the docs claim; instead, it
-	*    uses it as second parameter to ShowWindow() unless y is either
-	*    CW_USEDEFAULT or CW_USEDEFAULT16.
-	*
-	* The fact that we didn't do 2) caused bogus windows pop up when wine
-	* was running apps that were using this obscure feature. Example -
-	* calc.exe that comes with Win98 (only Win98, it's different from
-	* the one that comes with Win95 and NT)
-	*/
-	if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) sw = cs->y;
-
-	/* We have saved cs->y, now we can trash it */
+        * that if an overlapped window is created with WS_VISIBLE style bit
+        * set and the x parameter is set to CW_USEDEFAULT, the system ignores
+        * the y parameter. However, disassembling NT implementation (WIN32K.SYS)
+        * reveals that
+        *
+        * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
+        * 2) it does not ignore the y parameter as the docs claim; instead, it
+        *    uses it as second parameter to ShowWindow() unless y is either
+        *    CW_USEDEFAULT or CW_USEDEFAULT16.
+        *
+        * The fact that we didn't do 2) caused bogus windows pop up when wine
+        * was running apps that were using this obscure feature. Example -
+        * calc.exe that comes with Win98 (only Win98, it's different from
+        * the one that comes with Win95 and NT)
+        */
+        if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) sw = cs->y;
+
+        /* We have saved cs->y, now we can trash it */
 #if 0
-	if (   !(cs->style & (WS_CHILD | WS_POPUP))
-	    &&	(pdb->env_db->startup_info->dwFlags & STARTF_USEPOSITION) )
-	{
-	    cs->x = pdb->env_db->startup_info->dwX;
-	    cs->y = pdb->env_db->startup_info->dwY;
-	}
+        if (   !(cs->style & (WS_CHILD | WS_POPUP))
+            &&  (pdb->env_db->startup_info->dwFlags & STARTF_USEPOSITION) )
+        {
+            cs->x = pdb->env_db->startup_info->dwX;
+            cs->y = pdb->env_db->startup_info->dwY;
+        }
 #endif
-	    cs->x = 0;
-	    cs->y = 0;
-//	  }
+            cs->x = 0;
+            cs->y = 0;
+//        }
   }
   if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
   {
 #if 0
-	PDB *pdb = PROCESS_Current();
-	if (   !(cs->style & (WS_CHILD | WS_POPUP))
-	    &&	(pdb->env_db->startup_info->dwFlags & STARTF_USESIZE) )
-	{
-	    cs->cx = pdb->env_db->startup_info->dwXSize;
-	    cs->cy = pdb->env_db->startup_info->dwYSize;
-	}
-	else
-	{
+        PDB *pdb = PROCESS_Current();
+        if (   !(cs->style & (WS_CHILD | WS_POPUP))
+            &&  (pdb->env_db->startup_info->dwFlags & STARTF_USESIZE) )
+        {
+            cs->cx = pdb->env_db->startup_info->dwXSize;
+            cs->cy = pdb->env_db->startup_info->dwYSize;
+        }
+        else
+        {
 #endif
-	    cs->cx = 600; /* FIXME */
-	    cs->cy = 400;
-//	  }
+            cs->cx = 600; /* FIXME */
+            cs->cy = 400;
+//        }
   }
 
@@ -249,26 +249,26 @@
   nrUserWindowLong = windowClass->getExtraWndWords();
   if(nrUserWindowLong) {
-	userWindowLong = (ULONG *)malloc(nrUserWindowLong);
-	memset(userWindowLong, 0, nrUserWindowLong);
+        userWindowLong = (ULONG *)malloc(nrUserWindowLong);
+        memset(userWindowLong, 0, nrUserWindowLong);
   }
 
   if ((cs->style & WS_CHILD) && cs->hwndParent)
   {
-	SetParent(cs->hwndParent);
+        SetParent(cs->hwndParent);
   }
   else
   {
-	if (!cs->hwndParent) {
-	    owner = NULL;
-	}
-	else
-	{
-	    owner = GetWindowFromHandle(cs->hwndParent);
-	    if(owner == NULL)
-	    {
-		dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
-		return FALSE;
-	    }
-	}
+        if (!cs->hwndParent) {
+            owner = NULL;
+        }
+        else
+        {
+            owner = GetWindowFromHandle(cs->hwndParent);
+            if(owner == NULL)
+            {
+                dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
+                return FALSE;
+            }
+        }
   }
 
@@ -279,5 +279,5 @@
 
   hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
-		  ? HWND_BOTTOM : HWND_TOP;
+                  ? HWND_BOTTOM : HWND_TOP;
 
 #if 0
@@ -288,16 +288,16 @@
     {
     CBT_CREATEWNDA cbtc;
-	LRESULT ret;
+        LRESULT ret;
 
     cbtc.lpcs = cs;
     cbtc.hwndInsertAfter = hwndLinkAfter;
-	ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc)
-		      : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc);
-	if (ret)
+        ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc)
+                      : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc);
+        if (ret)
     {
-	TRACE_(win)("CBT-hook returned 0\n");
-	wndPtr->pDriver->pFinalize(wndPtr);
-	    retvalue =	0;
-	    goto end;
+        TRACE_(win)("CBT-hook returned 0\n");
+        wndPtr->pDriver->pFinalize(wndPtr);
+            retvalue =  0;
+            goto end;
     }
     }
@@ -310,10 +310,10 @@
   if (!(cs->style & WS_CHILD))
   {
-	dwStyle |= WS_CLIPSIBLINGS;
-	if (!(cs->style & WS_POPUP))
-	{
-	    dwStyle |= WS_CAPTION;
-	    flags |= WIN_NEED_SIZE;
-	}
+        dwStyle |= WS_CLIPSIBLINGS;
+        if (!(cs->style & WS_POPUP))
+        {
+            dwStyle |= WS_CAPTION;
+            flags |= WIN_NEED_SIZE;
+        }
   }
   if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
@@ -330,20 +330,20 @@
   if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
   {
-	GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
-	if (maxSize.x < cs->cx) cs->cx = maxSize.x;
-	if (maxSize.y < cs->cy) cs->cy = maxSize.y;
-	if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
-	if (cs->cy < minTrack.y ) cs->cy = minTrack.y;
+        GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
+        if (maxSize.x < cs->cx) cs->cx = maxSize.x;
+        if (maxSize.y < cs->cy) cs->cy = maxSize.y;
+        if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
+        if (cs->cy < minTrack.y ) cs->cy = minTrack.y;
   }
 
   if(cs->style & WS_CHILD)
   {
-	if(cs->cx < 0) cs->cx = 0;
-	if(cs->cy < 0) cs->cy = 0;
+        if(cs->cx < 0) cs->cx = 0;
+        if(cs->cy < 0) cs->cy = 0;
   }
   else
   {
-	if (cs->cx <= 0) cs->cx = 1;
-	if (cs->cy <= 0) cs->cy = 1;
+        if (cs->cx <= 0) cs->cx = 1;
+        if (cs->cy <= 0) cs->cy = 1;
   }
 
@@ -352,5 +352,5 @@
   rectWindow.right  = cs->x + cs->cx;
   rectWindow.bottom = cs->y + cs->cy;
-  rectClient	    = rectWindow;
+  rectClient        = rectWindow;
 
   DWORD dwOSWinStyle, dwOSFrameStyle;
@@ -361,36 +361,36 @@
 #if 1
   if(cs->style & WS_CHILD) {
-	dwOSFrameStyle = 0;
+        dwOSFrameStyle = 0;
   }
 #endif
 
   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
-				 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
-				 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
-				 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
-				 &OS2HwndFrame);
+                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
+                                 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
+                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
+                                 &OS2HwndFrame);
 
   if(OS2Hwnd == 0) {
-	dprintf(("Window creation failed!!"));
-	return FALSE;
+        dprintf(("Window creation failed!!"));
+        return FALSE;
   }
 
   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
-	dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
-	return FALSE;
+        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
+        return FALSE;
   }
   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
-	dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
-	return FALSE;
+        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
+        return FALSE;
   }
 #if 0
   if(OS2Hwnd != OS2HwndFrame) {
     if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
-	    dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
-	    return FALSE;
+            dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
+            return FALSE;
     }
     if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
-	    dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
-	    return FALSE;
+            dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
+            return FALSE;
     }
   }
@@ -400,30 +400,30 @@
   if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
   {
-	if (cs->hMenu) SetMenu(cs->hMenu);
-	else
-	{
-		if (windowClass->getMenuNameA()) {
-			cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());
-			if (cs->hMenu) SetMenu(cs->hMenu );
-		}
-	}
-  }
-  else	windowId = (UINT)cs->hMenu;
+        if (cs->hMenu) SetMenu(cs->hMenu);
+        else
+        {
+                if (windowClass->getMenuNameA()) {
+                        cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());
+                        if (cs->hMenu) SetMenu(cs->hMenu );
+                }
+        }
+  }
+  else  windowId = (UINT)cs->hMenu;
 
   //Set icon from class
   if(windowClass->getIcon())
-	SetIcon(windowClass->getIcon());
+        SetIcon(windowClass->getIcon());
 
   if(getParent()) {
-	SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top,
-		     rectClient.right-rectClient.left,
-		     rectClient.bottom-rectClient.top,
-		     SWP_NOACTIVATE | SWP_NOZORDER);
+        SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top,
+                     rectClient.right-rectClient.left,
+                     rectClient.bottom-rectClient.top,
+                     SWP_NOACTIVATE | SWP_NOZORDER);
   }
   else {
-	SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
-		     rectClient.right-rectClient.left,
-		     rectClient.bottom-rectClient.top,
-		     SWP_NOACTIVATE);
+        SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
+                     rectClient.right-rectClient.left,
+                     rectClient.bottom-rectClient.top,
+                     SWP_NOACTIVATE);
   }
   //Get the client window rectangle
@@ -439,29 +439,29 @@
   if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) )
   {
-	//doesn't work right, messes up client rectangle
+        //doesn't work right, messes up client rectangle
 #if 0
-	SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
+        SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
 #endif
-	OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
-	dprintf(("Sending WM_CREATE"));
-	if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
-	{
-	    if(!(flags & WIN_NEED_SIZE)) {
-		SendMessageA(WM_SIZE, SIZE_RESTORED,
-				MAKELONG(rectClient.right-rectClient.left,
-					 rectClient.bottom-rectClient.top));
-		SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
-	    }
-	    if (cs->style & WS_VISIBLE) ShowWindow( sw );
+        OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
+        dprintf(("Sending WM_CREATE"));
+        if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
+        {
+            if(!(flags & WIN_NEED_SIZE)) {
+                SendMessageA(WM_SIZE, SIZE_RESTORED,
+                                MAKELONG(rectClient.right-rectClient.left,
+                                         rectClient.bottom-rectClient.top));
+                SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
+            }
+            if (cs->style & WS_VISIBLE) ShowWindow( sw );
 
 #if 0
-	    /* Call WH_SHELL hook */
-
-	    if (!(dwStyle & WS_CHILD) && !owner)
-		HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
+            /* Call WH_SHELL hook */
+
+            if (!(dwStyle & WS_CHILD) && !owner)
+                HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
 #endif
-	    SetLastError(0);
-	    return TRUE;
-	}
+            SetLastError(0);
+            return TRUE;
+        }
   }
   fCreated = FALSE;
@@ -473,5 +473,5 @@
 #if 0
 /***********************************************************************
- *	     WINPOS_MinMaximize
+ *           WINPOS_MinMaximize
  *
  * Fill in lpRect and return additional flags to be used with SetWindowPos().
@@ -492,83 +492,83 @@
     if( dwStyle & WS_MINIMIZE )
     {
-	if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
-	return (SWP_NOSIZE | SWP_NOMOVE);
-	swpFlags |= SWP_NOCOPYBITS;
+        if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
+        return (SWP_NOSIZE | SWP_NOMOVE);
+        swpFlags |= SWP_NOCOPYBITS;
     }
     switch( cmd )
     {
-	case SW_MINIMIZE:
-	 if( dwStyle & WS_MAXIMIZE)
-	 {
-	     flags |= WIN_RESTORE_MAX;
-	     dwStyle &= ~WS_MAXIMIZE;
-		 }
-		 else
-	     flags &= ~WIN_RESTORE_MAX;
-	     dwStyle |= WS_MINIMIZE;
+        case SW_MINIMIZE:
+         if( dwStyle & WS_MAXIMIZE)
+         {
+             flags |= WIN_RESTORE_MAX;
+             dwStyle &= ~WS_MAXIMIZE;
+                 }
+                 else
+             flags &= ~WIN_RESTORE_MAX;
+             dwStyle |= WS_MINIMIZE;
 
 #if 0
-	 if( flags & WIN_NATIVE )
-	     if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
-	     swpFlags |= MINMAX_NOSWP;
+         if( flags & WIN_NATIVE )
+             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
+             swpFlags |= MINMAX_NOSWP;
 #endif
 
-	 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
-
-	 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
-	     GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
-	 swpFlags |= SWP_NOCOPYBITS;
-	 break;
-
-	case SW_MAXIMIZE:
-		WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
-
-	 if( dwStyle & WS_MINIMIZE )
-	 {
-	     if( flags & WIN_NATIVE )
-	     if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
-		 swpFlags |= MINMAX_NOSWP;
-
-	     WINPOS_ShowIconTitle( wndPtr, FALSE );
-	     dwStyle &= ~WS_MINIMIZE;
-	 }
-		 dwStyle |= WS_MAXIMIZE;
-
-	 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
-		    size.x, size.y );
-	 break;
-
-	case SW_RESTORE:
-	 if( dwStyle & WS_MINIMIZE )
-	 {
-	     if( flags & WIN_NATIVE )
-	     if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
-		 swpFlags |= MINMAX_NOSWP;
-
-	     dwStyle &= ~WS_MINIMIZE;
-	     WINPOS_ShowIconTitle( wndPtr, FALSE );
-
-	     if( flags & WIN_RESTORE_MAX)
-	     {
-	     /* Restore to maximized position */
-			 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
-			 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);
-			 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
-	     dwStyle |= WS_MAXIMIZE;
-	     SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
-	     break;
-	     }
-	 }
-	 else
-	     if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
-	     else dwStyle &= ~WS_MAXIMIZE;
-
-	 /* Restore to normal position */
-
-	*lpRect = lpPos->rectNormal;
-	 lpRect->right -= lpRect->left;
-	 lpRect->bottom -= lpRect->top;
-
-	 break;
+         lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
+
+         SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
+             GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
+         swpFlags |= SWP_NOCOPYBITS;
+         break;
+
+        case SW_MAXIMIZE:
+                WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
+
+         if( dwStyle & WS_MINIMIZE )
+         {
+             if( flags & WIN_NATIVE )
+             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
+                 swpFlags |= MINMAX_NOSWP;
+
+             WINPOS_ShowIconTitle( wndPtr, FALSE );
+             dwStyle &= ~WS_MINIMIZE;
+         }
+                 dwStyle |= WS_MAXIMIZE;
+
+         SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
+                    size.x, size.y );
+         break;
+
+        case SW_RESTORE:
+         if( dwStyle & WS_MINIMIZE )
+         {
+             if( flags & WIN_NATIVE )
+             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
+                 swpFlags |= MINMAX_NOSWP;
+
+             dwStyle &= ~WS_MINIMIZE;
+             WINPOS_ShowIconTitle( wndPtr, FALSE );
+
+             if( flags & WIN_RESTORE_MAX)
+             {
+             /* Restore to maximized position */
+                         CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
+                         WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);
+                         CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
+             dwStyle |= WS_MAXIMIZE;
+             SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
+             break;
+             }
+         }
+         else
+             if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
+             else dwStyle &= ~WS_MAXIMIZE;
+
+         /* Restore to normal position */
+
+        *lpRect = lpPos->rectNormal;
+         lpRect->right -= lpRect->left;
+         lpRect->bottom -= lpRect->top;
+
+         break;
     }
     } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
@@ -577,10 +577,10 @@
 #endif
 /*******************************************************************
- *	     GetMinMaxInfo
+ *           GetMinMaxInfo
  *
  * Get the minimized and maximized information for a window.
  */
 void Win32Window::GetMinMaxInfo(POINT *maxSize, POINT *maxPos,
-				POINT *minTrack, POINT *maxTrack )
+                                POINT *minTrack, POINT *maxTrack )
 {
     MINMAXINFO MinMax;
@@ -599,20 +599,20 @@
     else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     {
-	xinc = GetSystemMetrics(SM_CXDLGFRAME);
-	yinc = GetSystemMetrics(SM_CYDLGFRAME);
+        xinc = GetSystemMetrics(SM_CXDLGFRAME);
+        yinc = GetSystemMetrics(SM_CYDLGFRAME);
     }
     else
     {
-	xinc = yinc = 0;
-	if (HAS_THICKFRAME(dwStyle))
-	{
-	    xinc += GetSystemMetrics(SM_CXFRAME);
-	    yinc += GetSystemMetrics(SM_CYFRAME);
-	}
-	if (dwStyle & WS_BORDER)
-	{
-	    xinc += GetSystemMetrics(SM_CXBORDER);
-	    yinc += GetSystemMetrics(SM_CYBORDER);
-	}
+        xinc = yinc = 0;
+        if (HAS_THICKFRAME(dwStyle))
+        {
+            xinc += GetSystemMetrics(SM_CXFRAME);
+            yinc += GetSystemMetrics(SM_CYFRAME);
+        }
+        if (dwStyle & WS_BORDER)
+        {
+            xinc += GetSystemMetrics(SM_CXBORDER);
+            yinc += GetSystemMetrics(SM_CYBORDER);
+        }
     }
     MinMax.ptMaxSize.x += 2 * xinc;
@@ -622,10 +622,10 @@
     lpPos = (LPINTERNALPOS)GetPropA( hwndSelf, atomInternalPos );
     if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
-	CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
+        CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
     else
     {
 #endif
-	MinMax.ptMaxPosition.x = -xinc;
-	MinMax.ptMaxPosition.y = -yinc;
+        MinMax.ptMaxPosition.x = -xinc;
+        MinMax.ptMaxPosition.y = -yinc;
 //    }
 
@@ -635,12 +635,12 @@
 
     dprintf(("GetMinMaxInfo: %ld %ld / %ld %ld / %ld %ld / %ld %ld\n",
-		      MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
-		      MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
-		      MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
-		      MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y));
+                      MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
+                      MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
+                      MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
+                      MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y));
     MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x,
-				   MinMax.ptMinTrackSize.x );
+                                   MinMax.ptMinTrackSize.x );
     MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y,
-				   MinMax.ptMinTrackSize.y );
+                                   MinMax.ptMinTrackSize.y );
 
     if (maxSize)    *maxSize  = MinMax.ptMaxSize;
@@ -650,5 +650,5 @@
 }
 /***********************************************************************
- *	     WINPOS_SendNCCalcSize
+ *           WINPOS_SendNCCalcSize
  *
  * Send a WM_NCCALCSIZE message to a window.
@@ -658,6 +658,6 @@
  */
 LONG Win32Window::SendNCCalcSize(BOOL calcValidRect, RECT *newWindowRect, RECT *oldWindowRect,
-				 RECT *oldClientRect, WINDOWPOS *winpos,
-				 RECT *newClientRect )
+                                 RECT *oldClientRect, WINDOWPOS *winpos,
+                                 RECT *newClientRect )
 {
    NCCALCSIZE_PARAMS params;
@@ -668,11 +668,11 @@
    if (calcValidRect)
    {
-	winposCopy = *winpos;
-	params.rgrc[1] = *oldWindowRect;
-	params.rgrc[2] = *oldClientRect;
-	params.lppos = &winposCopy;
+        winposCopy = *winpos;
+        params.rgrc[1] = *oldWindowRect;
+        params.rgrc[2] = *oldClientRect;
+        params.lppos = &winposCopy;
    }
    result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect,
-				 (LPARAM)&params );
+                                 (LPARAM)&params );
    *newClientRect = params.rgrc[0];
    return result;
@@ -696,5 +696,5 @@
 {
   if(SendInternalMessageA(WM_CLOSE, 0, 0) == 0) {
-	return 0; //app handles this message
+        return 0; //app handles this message
   }
   delete this;
@@ -726,9 +726,33 @@
 //******************************************************************************
 //******************************************************************************
+ULONG Win32Window::MsgPosChanging(LPARAM lp)
+{
+    dprintf(("MsgPosChanging"));
+#if 1
+    if(fCreated == FALSE) {
+        return 1;
+    }
+#endif
+    return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG Win32Window::MsgPosChanged(LPARAM lp)
+{
+    dprintf(("MsgPosChanged"));
+#if 1
+    if(fCreated == FALSE) {
+        return 1;
+    }
+#endif
+    return SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, lp);
+}
+//******************************************************************************
+//******************************************************************************
 ULONG Win32Window::MsgMove(ULONG x, ULONG y)
 {
     dprintf(("MsgMove to (%d,%d)", x, y));
     if(fCreated == FALSE) {
-	return 1;
+        return 1;
     }
 
@@ -741,10 +765,10 @@
   switch(cmd) {
     case CMD_MENU:
-	return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0);
+        return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0);
     case CMD_CONTROL:
-	return 0; //todo
+        return 0; //todo
     case CMD_ACCELERATOR:
-	dprintf(("accelerator command"));
-	return 0; //todo
+        dprintf(("accelerator command"));
+        return 0; //todo
   }
   return 0;
@@ -765,13 +789,13 @@
 
     if(fCreated == FALSE) {//Solitaire crashes if it receives a WM_SIZE during CreateWindowEx (normal or our fault?)
-	return 1;
+        return 1;
     }
 
     if(fMinimize) {
-	    fwSizeType = SIZE_MINIMIZED;
+            fwSizeType = SIZE_MINIMIZED;
     }
     else
     if(fMaximize) {
-	    fwSizeType = SIZE_MAXIMIZED;
+            fwSizeType = SIZE_MAXIMIZED;
     }
     else    fwSizeType = SIZE_RESTORED;
@@ -785,7 +809,7 @@
     if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE)
     {
-	if(!fActivate) {
-	    return 1;
-	}
+        if(!fActivate) {
+            return 1;
+        }
     }
     return SendInternalMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd);
@@ -807,16 +831,16 @@
     lParam |= (scancode << 16);
     if(keyflags & KEY_ALTDOWN)
-	lParam |= (1<<29);
+        lParam |= (1<<29);
     if(keyflags & KEY_PREVDOWN)
-	lParam |= (1<<30);
+        lParam |= (1<<30);
     if(keyflags & KEY_UP)
-	lParam |= (1<<31);
+        lParam |= (1<<31);
     if(keyflags & KEY_DEADKEY) {
-	dprintf(("WM_DEADCHAR: %x %x %08x", OS2Hwnd, cmd, lParam));
-	return SendInternalMessageA(WM_DEADCHAR, cmd, lParam);
+        dprintf(("WM_DEADCHAR: %x %x %08x", OS2Hwnd, cmd, lParam));
+        return SendInternalMessageA(WM_DEADCHAR, cmd, lParam);
     }
     else {
-	dprintf(("WM_CHAR: %x %x %08x", OS2Hwnd, cmd, lParam));
-	return SendInternalMessageA(WM_CHAR, cmd, lParam);
+        dprintf(("WM_CHAR: %x %x %08x", OS2Hwnd, cmd, lParam));
+        return SendInternalMessageA(WM_CHAR, cmd, lParam);
     }
 }
@@ -826,6 +850,6 @@
 {
     if(hwnd == 0) {
-	//other app lost focus
-	SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
+        //other app lost focus
+        SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
     }
     return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
@@ -836,6 +860,6 @@
 {
     if(hwnd == 0) {
-	//other app lost focus
-	SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
+        //other app lost focus
+        SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
     }
     return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
@@ -850,48 +874,48 @@
     dprintf(("MsgButton to (%d,%d)", ncx, ncy));
     switch(msg) {
-	case BUTTON_LEFTDOWN:
-		win32msg = WM_LBUTTONDOWN;
-		win32ncmsg = WM_NCLBUTTONDOWN;
-		break;
-	case BUTTON_LEFTUP:
-		win32msg = WM_LBUTTONUP;
-		win32ncmsg = WM_NCLBUTTONUP;
-		break;
-	case BUTTON_LEFTDBLCLICK:
-		win32msg = WM_LBUTTONDBLCLK;
-		win32ncmsg = WM_NCLBUTTONDBLCLK;
-		break;
-	case BUTTON_RIGHTUP:
-		win32msg = WM_RBUTTONUP;
-		win32ncmsg = WM_NCRBUTTONUP;
-		break;
-	case BUTTON_RIGHTDOWN:
-		win32msg = WM_RBUTTONDOWN;
-		win32ncmsg = WM_NCRBUTTONDOWN;
-		break;
-	case BUTTON_RIGHTDBLCLICK:
-		win32msg = WM_RBUTTONDBLCLK;
-		win32ncmsg = WM_NCRBUTTONDBLCLK;
-		break;
-	case BUTTON_MIDDLEUP:
-		win32msg = WM_MBUTTONUP;
-		win32ncmsg = WM_NCMBUTTONUP;
-		break;
-	case BUTTON_MIDDLEDOWN:
-		win32msg = WM_MBUTTONDOWN;
-		win32ncmsg = WM_NCMBUTTONDOWN;
-		break;
-	case BUTTON_MIDDLEDBLCLICK:
-		win32msg = WM_MBUTTONDBLCLK;
-		win32ncmsg = WM_NCMBUTTONDBLCLK;
-		break;
-	default:
-		dprintf(("Win32Window::Button: invalid msg!!!!"));
-		return 1;
+        case BUTTON_LEFTDOWN:
+                win32msg = WM_LBUTTONDOWN;
+                win32ncmsg = WM_NCLBUTTONDOWN;
+                break;
+        case BUTTON_LEFTUP:
+                win32msg = WM_LBUTTONUP;
+                win32ncmsg = WM_NCLBUTTONUP;
+                break;
+        case BUTTON_LEFTDBLCLICK:
+                win32msg = WM_LBUTTONDBLCLK;
+                win32ncmsg = WM_NCLBUTTONDBLCLK;
+                break;
+        case BUTTON_RIGHTUP:
+                win32msg = WM_RBUTTONUP;
+                win32ncmsg = WM_NCRBUTTONUP;
+                break;
+        case BUTTON_RIGHTDOWN:
+                win32msg = WM_RBUTTONDOWN;
+                win32ncmsg = WM_NCRBUTTONDOWN;
+                break;
+        case BUTTON_RIGHTDBLCLICK:
+                win32msg = WM_RBUTTONDBLCLK;
+                win32ncmsg = WM_NCRBUTTONDBLCLK;
+                break;
+        case BUTTON_MIDDLEUP:
+                win32msg = WM_MBUTTONUP;
+                win32ncmsg = WM_NCMBUTTONUP;
+                break;
+        case BUTTON_MIDDLEDOWN:
+                win32msg = WM_MBUTTONDOWN;
+                win32ncmsg = WM_NCMBUTTONDOWN;
+                break;
+        case BUTTON_MIDDLEDBLCLICK:
+                win32msg = WM_MBUTTONDBLCLK;
+                win32ncmsg = WM_NCMBUTTONDBLCLK;
+                break;
+        default:
+                dprintf(("Win32Window::Button: invalid msg!!!!"));
+                return 1;
     }
     if(win32msg == WM_MBUTTONDBLCLK || win32msg == WM_RBUTTONDBLCLK || win32msg == WM_LBUTTONDBLCLK) {
-	if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) {
-	    return 1;
-	}
+        if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) {
+            return 1;
+        }
     }
     SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(ncx, ncy)); //TODO:
@@ -905,13 +929,13 @@
 
     if(keystate & WMMOVE_LBUTTON)
-	winstate |= MK_LBUTTON;
+        winstate |= MK_LBUTTON;
     if(keystate & WMMOVE_RBUTTON)
-	winstate |= MK_RBUTTON;
+        winstate |= MK_RBUTTON;
     if(keystate & WMMOVE_MBUTTON)
-	winstate |= MK_MBUTTON;
+        winstate |= MK_MBUTTON;
     if(keystate & WMMOVE_SHIFT)
-	winstate |= MK_SHIFT;
+        winstate |= MK_SHIFT;
     if(keystate & WMMOVE_CTRL)
-	winstate |= MK_CONTROL;
+        winstate |= MK_CONTROL;
 
     return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y));
@@ -925,10 +949,10 @@
 //******************************************************************************
 //TODO: Is the clipper region of the window DC equal to the invalidated rectangle?
-//	(or are we simply erasing too much here)
+//      (or are we simply erasing too much here)
 //******************************************************************************
 ULONG Win32Window::MsgEraseBackGround(HDC hdc)
 {
     if(isIcon) {
-	    return SendInternalMessageA(WM_ICONERASEBKGND, hdc, 0);
+            return SendInternalMessageA(WM_ICONERASEBKGND, hdc, 0);
     }
     else    return SendInternalMessageA(WM_ERASEBKGND, hdc, 0);
@@ -939,5 +963,5 @@
 {
     if(isUnicode) {
-	    return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
+            return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
     }
     else    return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
@@ -955,8 +979,8 @@
 {
     if(isUnicode) {
-	SendInternalMessageW(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameW);
+        SendInternalMessageW(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameW);
     }
     else {
-	SendInternalMessageA(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameA);
+        SendInternalMessageA(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameA);
     }
     return windowNameA;
@@ -969,22 +993,22 @@
     {
     case WM_GETTEXTLENGTH:
-	return wndNameLength;
+        return wndNameLength;
 
     case WM_GETTEXT:   //TODO: SS_ICON controls
-	strncpy((LPSTR)lParam, windowNameA, wParam);
-	return min(wndNameLength, wParam);
+        strncpy((LPSTR)lParam, windowNameA, wParam);
+        return min(wndNameLength, wParam);
 
     case WM_SETTEXT:
-	return 0;
+        return 0;
 
     case WM_SETREDRAW:
-	if(wParam)
-		SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) | WS_VISIBLE);
-	else	SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) & ~WS_VISIBLE);
-
-	return 0; //TODO
+        if(wParam)
+                SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) | WS_VISIBLE);
+        else    SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) & ~WS_VISIBLE);
+
+        return 0; //TODO
 
     case WM_NCCREATE:
-	return(TRUE);
+        return(TRUE);
 
     case WM_CTLCOLORMSGBOX:
@@ -995,42 +1019,64 @@
     case WM_CTLCOLORSTATIC:
     case WM_CTLCOLORSCROLLBAR:
-	 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
-	 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
-	 return GetSysColorBrush(COLOR_BTNFACE);
+         SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+         SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+         return GetSysColorBrush(COLOR_BTNFACE);
 
     case WM_PARENTNOTIFY:
-	return 0;
+        return 0;
 
     case WM_MOUSEACTIVATE:
     {
-	DWORD dwStyle = GetWindowLongA(GWL_STYLE);
-	DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);
-	dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
-	if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
-	{
-	    if(getParent()) {
-		LRESULT rc = getParent()->SendMessageA(WM_MOUSEACTIVATE, wParam, lParam );
-		if(rc)	return rc;
-	    }
-	}
-	return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
+        DWORD dwStyle = GetWindowLongA(GWL_STYLE);
+        DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);
+        dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
+        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
+        {
+            if(getParent()) {
+                LRESULT rc = getParent()->SendMessageA(WM_MOUSEACTIVATE, wParam, lParam );
+                if(rc)  return rc;
+            }
+        }
+        return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
     }
     case WM_SETCURSOR:
     {
-	DWORD dwStyle = GetWindowLongA(GWL_STYLE);
-	DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);
-	dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
-	if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
-	{
-	    if(getParent()) {
-		LRESULT rc = getParent()->SendMessageA(WM_SETCURSOR, wParam, lParam);
-		if(rc)	return rc;
-	    }
-	}
-	return 1;
+        DWORD dwStyle = GetWindowLongA(GWL_STYLE);
+        DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);
+        dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
+        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
+        {
+            if(getParent()) {
+                LRESULT rc = getParent()->SendMessageA(WM_SETCURSOR, wParam, lParam);
+                if(rc)  return rc;
+            }
+        }
+        return 1;
     }
     case WM_MOUSEMOVE:
-	return 0;
-
+        return 0;
+
+    case WM_WINDOWPOSCHANGED:
+    {
+
+/* undocumented SWP flags - from SDK 3.1 */
+#define SWP_NOCLIENTSIZE        0x0800
+#define SWP_NOCLIENTMOVE        0x1000
+
+        PWINDOWPOS wpos = (PWINDOWPOS)lParam;
+        WPARAM     wp   = SIZE_RESTORED;
+
+        if (!(wpos->flags & SWP_NOCLIENTMOVE))
+            SendMessageA(WM_MOVE, 0, MAKELONG(wpos->x, wpos->y));
+
+        if (!(wpos->flags & SWP_NOCLIENTSIZE))
+        {
+            if (dwStyle & WS_MAXIMIZE) wp = SIZE_MAXIMIZED;
+            else if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
+
+            SendMessageA(WM_SIZE, wp, MAKELONG(wpos->cx,wpos->cy));
+        }
+        return 0;
+    }
     case WM_ERASEBKGND:
     case WM_ICONERASEBKGND:
@@ -1038,14 +1084,14 @@
       RECT rect;
 
-	if (!windowClass->getBackgroundBrush()) return 0;
-
-	/*  Since WM_ERASEBKGND may receive either a window dc or a    */
-	/*  client dc, the area to be erased has to be retrieved from  */
-	/*  the device context. 				   */
-	GetClipBox( (HDC)wParam, &rect );
-
-	FillRect( (HDC)wParam, &rect, windowClass->getBackgroundBrush());
-
-	return 1;
+        if (!windowClass->getBackgroundBrush()) return 0;
+
+        /*  Since WM_ERASEBKGND may receive either a window dc or a    */
+        /*  client dc, the area to be erased has to be retrieved from  */
+        /*  the device context.                                    */
+        GetClipBox( (HDC)wParam, &rect );
+
+        FillRect( (HDC)wParam, &rect, windowClass->getBackgroundBrush());
+
+        return 1;
     }
 
@@ -1059,11 +1105,11 @@
     case WM_NCMBUTTONUP:
     case WM_NCMBUTTONDBLCLK:
-	return 0;	    //TODO: Send WM_SYSCOMMAND if required
+        return 0;           //TODO: Send WM_SYSCOMMAND if required
 
     case WM_NCHITTEST: //TODO:
-	return 0;
+        return 0;
 
     default:
-	return 1;
+        return 1;
     }
 }
@@ -1075,12 +1121,12 @@
     {
     case WM_GETTEXTLENGTH:
-	return wndNameLength;
+        return wndNameLength;
 
     case WM_GETTEXT:   //TODO: SS_ICON controls
-	lstrcpynW((LPWSTR)lParam, windowNameW, wParam);
-	return min(wndNameLength, wParam);
+        lstrcpynW((LPWSTR)lParam, windowNameW, wParam);
+        return min(wndNameLength, wParam);
 
     default:
-	return DefWindowProcA(Msg, wParam, lParam);
+        return DefWindowProcA(Msg, wParam, lParam);
     }
 }
@@ -1090,40 +1136,40 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-	dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
+        dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
   if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
-	return(0);
+        return(0);
   }
   switch(Msg)
   {
-	case WM_CREATE:
-	{
-		if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
-			dprintf(("WM_NCCREATE returned FALSE\n"));
-			return(-1); //don't create window
-		}
-		if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
-			dprintf(("WM_CREATE returned -1\n"));
-			return(-1); //don't create window
-		}
-		NotifyParent(Msg, wParam, lParam);
-
-		return(0);
-	}
-	case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc
-		return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);
-
-	case WM_LBUTTONDOWN:
-	case WM_MBUTTONDOWN:
-	case WM_RBUTTONDOWN:
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-
-	case WM_DESTROY:
-		win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-	default:
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+        case WM_CREATE:
+        {
+                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
+                        dprintf(("WM_NCCREATE returned FALSE\n"));
+                        return(-1); //don't create window
+                }
+                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
+                        dprintf(("WM_CREATE returned -1\n"));
+                        return(-1); //don't create window
+                }
+                NotifyParent(Msg, wParam, lParam);
+
+                return(0);
+        }
+        case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc
+                return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);
+
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+
+        case WM_DESTROY:
+                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
+        default:
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
   }
 }
@@ -1133,41 +1179,41 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-	dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
+        dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
   if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
-	return(0);
+        return(0);
   }
   switch(Msg)
   {
-	case WM_CREATE:
-	{
-		if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
-			dprintf(("WM_NCCREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
-			dprintf(("WM_CREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		NotifyParent(Msg, wParam, lParam);
-
-		return(1);
-	}
-	case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc
-		return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);
-
-	case WM_LBUTTONDOWN:
-	case WM_MBUTTONDOWN:
-	case WM_RBUTTONDOWN:
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-
-	case WM_DESTROY:
-		win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-
-	default:
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+        case WM_CREATE:
+        {
+                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
+                        dprintf(("WM_NCCREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
+                        dprintf(("WM_CREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                NotifyParent(Msg, wParam, lParam);
+
+                return(1);
+        }
+        case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc
+                return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);
+
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+
+        case WM_DESTROY:
+                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
+
+        default:
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
   }
 }
@@ -1178,37 +1224,37 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-	dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
+        dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
   if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
-	return(0);
+        return(0);
   }
   switch(Msg)
   {
-	case WM_CREATE:
-	{
-		if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
-			dprintf(("WM_NCCREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
-			dprintf(("WM_CREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		NotifyParent(Msg, wParam, lParam);
-
-		return(1);
-	}
-	case WM_LBUTTONDOWN:
-	case WM_MBUTTONDOWN:
-	case WM_RBUTTONDOWN:
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-
-	case WM_DESTROY:
-		win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-	default:
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+        case WM_CREATE:
+        {
+                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
+                        dprintf(("WM_NCCREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
+                        dprintf(("WM_CREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                NotifyParent(Msg, wParam, lParam);
+
+                return(1);
+        }
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+
+        case WM_DESTROY:
+                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
+        default:
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
   }
 }
@@ -1220,37 +1266,37 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-	dprintf(("SendInternalMessageW %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
+        dprintf(("SendInternalMessageW %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
   if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
-	return(0);
+        return(0);
   }
   switch(Msg)
   {
-	case WM_CREATE:
-	{
-		if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
-			dprintf(("WM_NCCREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
-			dprintf(("WM_CREATE returned FALSE\n"));
-			return(0); //don't create window
-		}
-		NotifyParent(Msg, wParam, lParam);
-
-		return(1);
-	}
-	case WM_LBUTTONDOWN:
-	case WM_MBUTTONDOWN:
-	case WM_RBUTTONDOWN:
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-
-	case WM_DESTROY:
-		win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-	default:
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+        case WM_CREATE:
+        {
+                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
+                        dprintf(("WM_NCCREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
+                        dprintf(("WM_CREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                NotifyParent(Msg, wParam, lParam);
+
+                return(1);
+        }
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+
+        case WM_DESTROY:
+                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
+        default:
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
   }
 }
@@ -1266,5 +1312,5 @@
     return 0;
   }
-  postmsg->Msg	  = msg;
+  postmsg->Msg    = msg;
   postmsg->wParam = wParam;
   postmsg->lParam = lParam;
@@ -1282,5 +1328,5 @@
     return 0;
   }
-  postmsg->Msg	  = msg;
+  postmsg->Msg    = msg;
   postmsg->wParam = wParam;
   postmsg->lParam = lParam;
@@ -1297,18 +1343,18 @@
    while(window)
    {
-	if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
-	{
-		/* Notify the parent window only */
-		parentwindow = window->getParent();
-		if(parentwindow) {
-			if(Msg == WM_CREATE || Msg == WM_DESTROY) {
-				parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
-			}
-			else	parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
-		}
-	}
-	else	break;
-
-	window = parentwindow;
+        if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
+        {
+                /* Notify the parent window only */
+                parentwindow = window->getParent();
+                if(parentwindow) {
+                        if(Msg == WM_CREATE || Msg == WM_DESTROY) {
+                                parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
+                        }
+                        else    parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
+                }
+        }
+        else    break;
+
+        window = parentwindow;
    }
 }
@@ -1317,23 +1363,23 @@
 BOOL Win32Window::SetMenu(HMENU hMenu)
 {
- PVOID		menutemplate;
+ PVOID          menutemplate;
  Win32Resource *winres = (Win32Resource *)hMenu;
 
     dprintf(("SetMenu %x", hMenu));
     if(HIWORD(winres) == 0) {
-	dprintf(("Win32Window:: Win32Resource *winres == 0"));
-	SetLastError(ERROR_INVALID_PARAMETER);
-	return FALSE;
+        dprintf(("Win32Window:: Win32Resource *winres == 0"));
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
     }
     menutemplate = winres->lockOS2Resource();
     if(menutemplate == NULL)
     {
-	dprintf(("Win32Window::SetMenu menutemplate == 0"));
-	return FALSE;
+        dprintf(("Win32Window::SetMenu menutemplate == 0"));
+        return FALSE;
     }
     OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
     if(OS2HwndMenu == 0) {
-	dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
-	return FALSE;
+        dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
+        return FALSE;
     }
     menuResource = winres;
@@ -1345,10 +1391,10 @@
 {
  Win32Resource *winres = (Win32Resource *)hAccel;
- HANDLE 	accelhandle;
+ HANDLE         accelhandle;
 
     if(HIWORD(hAccel) == 0) {
-	dprintf(("SetAccelTable: hAccel %x invalid", hAccel));
-	SetLastError(ERROR_INVALID_PARAMETER);
-	return FALSE;
+        dprintf(("SetAccelTable: hAccel %x invalid", hAccel));
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
     }
     acceltableResource = winres;
@@ -1372,12 +1418,12 @@
     dprintf(("ShowWindow %x", nCmdShow));
     if(fFirstShow) {
-	if(isFrameWindow() && IS_OVERLAPPED(getStyle())) {
-		SendMessageA(WM_SIZE, SIZE_RESTORED,
-				MAKELONG(rectClient.right-rectClient.left,
-					 rectClient.bottom-rectClient.top));
-		SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
-
-	}
-	fFirstShow = FALSE;
+        if(isFrameWindow() && IS_OVERLAPPED(getStyle())) {
+                SendMessageA(WM_SIZE, SIZE_RESTORED,
+                                MAKELONG(rectClient.right-rectClient.left,
+                                         rectClient.bottom-rectClient.top));
+                SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
+
+        }
+        fFirstShow = FALSE;
     }
     switch(nCmdShow)
@@ -1385,33 +1431,33 @@
     case SW_SHOW:
     case SW_SHOWDEFAULT: //todo
-	showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
-	break;
+        showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
     case SW_HIDE:
-	showstate = SWPOS_HIDE;
-	break;
+        showstate = SWPOS_HIDE;
+        break;
     case SW_RESTORE:
-	showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
-	break;
+        showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
     case SW_MINIMIZE:
-	showstate = SWPOS_MINIMIZE;
-	break;
+        showstate = SWPOS_MINIMIZE;
+        break;
     case SW_SHOWMAXIMIZED:
-	showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
-	break;
+        showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
     case SW_SHOWMINIMIZED:
-	showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
-	break;
+        showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
     case SW_SHOWMINNOACTIVE:
-	showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
-	break;
+        showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
+        break;
     case SW_SHOWNA:
-	showstate = SWPOS_SHOW;
-	break;
+        showstate = SWPOS_SHOW;
+        break;
     case SW_SHOWNOACTIVATE:
-	showstate = SWPOS_SHOW;
-	break;
+        showstate = SWPOS_SHOW;
+        break;
     case SW_SHOWNORMAL:
-	showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
-	break;
+        showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
+        break;
     }
     return OSLibWinShowWindow(OS2HwndFrame, showstate);
@@ -1421,90 +1467,103 @@
 BOOL Win32Window::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
 {
- Win32Window *window;
- ULONG	      setstate = 0;
-
-    switch(hwndInsertAfter) {
-    case HWND_BOTTOM:
-	hwndInsertAfter = HWNDOS_BOTTOM;
-	break;
-    case HWND_TOPMOST: //TODO
-    case HWND_NOTOPMOST: //TODO:
-    case HWND_TOP:
-	hwndInsertAfter = HWNDOS_TOP;
-	break;
-    default:
-	window = GetWindowFromHandle(hwndInsertAfter);
-	if(window) {
-	    hwndInsertAfter = window->getOS2WindowHandle();
-	    PRECT clientRect = window->getClientRect();
-
-#if 1
-	    if(x+cx > clientRect->right - clientRect->left) {
-		dprintf(("Adjusting cx from %d to %d", cx, (clientRect->right - clientRect->left) - x));
-		cx = (clientRect->right - clientRect->left) - x;
-	    }
-	    if(y+cy > clientRect->bottom - clientRect->top) {
-		dprintf(("Adjusting cy from %d to %d", cy, (clientRect->bottom - clientRect->top) - y));
-		cy = (clientRect->bottom - clientRect->top) - y;
-	    }
-#endif
-#if 0
-	    //Correct coordinates if parent is a frame window (border adjustment)
-	    //TODO: Not quite right (Solitaire child window placement slightly wrong)
-	    if (window->isFrameWindow() && !(fuFlags & SWP_NOMOVE)) {
-		if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
-		{
-		    x += GetSystemMetrics(SM_CXDLGFRAME);
-		    y -= GetSystemMetrics(SM_CYDLGFRAME);
-		}
-		else
-		{
-		    if (HAS_THICKFRAME(window->getStyle()))
-		    {
-			x += GetSystemMetrics(SM_CXFRAME);
-			y -= GetSystemMetrics(SM_CYFRAME);
-		    }
-		    else
-		    if (window->getStyle() & WS_BORDER)
-		    {
-			x += GetSystemMetrics(SM_CXBORDER);
-			y -= GetSystemMetrics(SM_CYBORDER);
-		    }
-		}
-	    }
-#endif
-	}
-	else {
-	    dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
-	    hwndInsertAfter = 0;
-	}
-
-	break;
-
-    }
-    setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER;
-    if(fuFlags & SWP_DRAWFRAME)
-	setstate |= 0; //TODO
-    if(fuFlags & SWP_FRAMECHANGED)
-	setstate |= 0; //TODO
-    if(fuFlags & SWP_HIDEWINDOW)
-	setstate &= ~SWPOS_ZORDER;
-    if(fuFlags & SWP_NOACTIVATE)
-	setstate &= ~SWPOS_ACTIVATE;
-    if(fuFlags & SWP_NOCOPYBITS)
-	setstate |= 0;	    //TODO
-    if(fuFlags & SWP_NOMOVE)
-	setstate &= ~SWPOS_MOVE;
-    if(fuFlags & SWP_NOSIZE)
-	setstate &= ~SWPOS_SIZE;
-    if(fuFlags & SWP_NOREDRAW)
-	setstate |= SWPOS_NOREDRAW;
-    if(fuFlags & SWP_NOZORDER)
-	setstate &= ~SWPOS_ZORDER;
-    if(fuFlags & SWP_SHOWWINDOW)
-	setstate |= SWPOS_SHOW;
-
-    //TODO send NCCREATE if size changed or SWP_FRAMECHANGED flag specified.
-    return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
+   BOOL rc = FALSE;
+   Win32Window *window;
+
+   dprintf (("SetWindowPos %x %x (%d,%d)(%d,%d) %x", Win32Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
+
+   /* Validate the flags passed in ...                   */
+   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;
+   ULONG parentHeight;
+
+   //****************************
+   // Set up with Windows values.
+   //****************************
+   wpos.flags            = fuFlags;
+   wpos.cy               = cy;
+   wpos.cx               = cx;
+   wpos.x                = x;
+   wpos.y                = y;
+   wpos.hwndInsertAfter  = hwndInsertAfter;
+   wpos.hwnd             = getWindowHandle();
+
+   //**********************************************
+   // Convert from Windows to PM coords and flags.
+   //**********************************************
+   if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE)) {
+       OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
+       parentHeight = isChild() ?
+           OSLibGetWindowHeight(getParent()->getOS2WindowHandle())
+         : OSLibQueryScreenHeight();
+   }
+   OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, parentHeight);
+
+   /* MapSWP can clear the SWP_MOVE and SWP_SIZE flags if the window is not
+    * being moved or sized.  If these were the only operations to be done
+    * and they have been cleared, return now.
+    */
+   if (swp.fl == 0)
+      return TRUE;
+
+   //*********************************************************************
+   //On Windows, a WM_GETMINMAXINFO is made to the app from within this API.
+   //We'll send a WM_QUERYTRACKINFO which is translated into a WM_GETMINMAXINFO
+   //and passed on to the app. Compare the values returned with the SWP cx and
+   //cy values.  They cannot be bigger than the max nor smaller than the min.
+   //*********************************************************************
+
+   if ((swp.fl & SWPOS_ZORDER) && (swp.hwndInsertBehind > HWNDOS_BOTTOM))
+   {
+      Win32Window *wndBehind = Win32Window::GetWindowFromHandle(swp.hwndInsertBehind);
+      swp.hwndInsertBehind   = wndBehind->getOS2WindowHandle();
+   }
+   if (isFrameWindow())
+   {
+      POINT maxSize, maxPos, minTrack, maxTrack;
+
+      GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
+
+      if (swp.cx > maxTrack.x) swp.cx = maxTrack.x;
+      if (swp.cy > maxTrack.y) swp.cy = maxTrack.y;
+      if (swp.cx < minTrack.x) swp.cx = minTrack.x;
+      if (swp.cy < minTrack.y) swp.cy = minTrack.y;
+      swp.hwnd = OS2HwndFrame;
+   } else
+      swp.hwnd = OS2Hwnd;
+   dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
+
+   //*****************************************************************************
+   // Squibble the window.  (WinSetMultWindowPos is faster than WinSetWindowPos.)
+   //*****************************************************************************
+   rc = OSLibWinSetMultWindowPos(&swp, 1);
+
+   if (rc == FALSE)
+   {
+//      SET_ERROR_LAST();
+   }
+   else
+   {
+      /* To implement support for SWP_FRAMECHANGED_W correctly, we would need
+      ** to send a WM_NCCALCSIZE message. This means DAX would have to support
+      ** the WM_NCCALCSIZE message. I don't think DAX can support this
+      ** message because it is tightly bound with the architecture of
+      ** overlapped windows (the "just one window" architecture). However,
+      ** we *can* support the SWP_FRAMECHANGED flag by sending the window
+      ** a WM_UPDATEFRAME, which will provide the behavior of WM_NCCALCSIZE.
+      */
+//      if (fuFlags & SWP_FRAMECHANGED_W)
+//         WinSendMsg(hWindow, WM_UPDATEFRAME, (MPARAM)-1, 0);
+   }
+
+   return (rc);
 }
 //******************************************************************************
@@ -1522,5 +1581,5 @@
     return getParent()->getWindowHandle();
   }
-  else	return 0;
+  else  return 0;
 }
 //******************************************************************************
@@ -1532,5 +1591,5 @@
 
    if(getParent()) {
-	oldhwnd = getParent()->getWindowHandle();
+        oldhwnd = getParent()->getWindowHandle();
    }
    else oldhwnd = 0;
@@ -1538,13 +1597,13 @@
    if(hwndNewParent == 0) {//desktop window = parent
     setParent(NULL);
-	OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
-	return oldhwnd;
+        OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
+        return oldhwnd;
    }
    newparent = GetWindowFromHandle(hwndNewParent);
    if(newparent)
    {
-	setParent(newparent);
-	OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
-	return oldhwnd;
+        setParent(newparent);
+        OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
+        return oldhwnd;
    }
    SetLastError(ERROR_INVALID_PARAMETER);
@@ -1558,5 +1617,5 @@
     return getParent()->getWindowHandle() == hwndParent;
   }
-  else	return 0;
+  else  return 0;
 }
 //******************************************************************************
@@ -1577,5 +1636,5 @@
     if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
     {//update region not empty
-	SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
+        SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     }
     return TRUE;
@@ -1593,47 +1652,47 @@
 {
  Win32Window  *win32wnd;
- ULONG	       magic;
- ULONG	       getcmd = 0;
- HWND	       hwndRelated;
+ ULONG         magic;
+ ULONG         getcmd = 0;
+ HWND          hwndRelated;
 
     dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd));
     switch(uCmd)
     {
-	case GW_CHILD:
-	    getcmd = QWOS_TOP;
-	    break;
-	case GW_HWNDFIRST:
-	    if(getParent()) {
-		    getcmd = QWOS_TOP; //top of child windows
-	    }
-	    else    getcmd = QWOS_TOP; //TODO
-	    break;
-	case GW_HWNDLAST:
-	    if(getParent()) {
-		    getcmd = QWOS_BOTTOM; //bottom of child windows
-	    }
-	    else    getcmd = QWOS_BOTTOM; //TODO
-	    break;
-	case GW_HWNDNEXT:
-	    getcmd = QWOS_NEXT;
-	    break;
-	case GW_HWNDPREV:
-	    getcmd = QWOS_PREV;
-	    break;
-	case GW_OWNER:
-	    if(owner) {
-		    return owner->getWindowHandle();
-	    }
-	    else    return 0;
+        case GW_CHILD:
+            getcmd = QWOS_TOP;
+            break;
+        case GW_HWNDFIRST:
+            if(getParent()) {
+                    getcmd = QWOS_TOP; //top of child windows
+            }
+            else    getcmd = QWOS_TOP; //TODO
+            break;
+        case GW_HWNDLAST:
+            if(getParent()) {
+                    getcmd = QWOS_BOTTOM; //bottom of child windows
+            }
+            else    getcmd = QWOS_BOTTOM; //TODO
+            break;
+        case GW_HWNDNEXT:
+            getcmd = QWOS_NEXT;
+            break;
+        case GW_HWNDPREV:
+            getcmd = QWOS_PREV;
+            break;
+        case GW_OWNER:
+            if(owner) {
+                    return owner->getWindowHandle();
+            }
+            else    return 0;
     }
     hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
     if(hwndRelated)
     {
-	win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
-	magic	 = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
-	if(CheckMagicDword(magic) && win32wnd)
-	{
-	    return win32wnd->getWindowHandle();
-	}
+        win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
+        magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
+        if(CheckMagicDword(magic) && win32wnd)
+        {
+            return win32wnd->getWindowHandle();
+        }
     }
     return 0;
@@ -1662,7 +1721,7 @@
 HWND Win32Window::GetActiveWindow()
 {
- HWND	       hwndActive;
+ HWND          hwndActive;
  Win32Window  *win32wnd;
- ULONG	       magic;
+ ULONG         magic;
 
   hwndActive = OSLibWinQueryActiveWindow();
@@ -1725,40 +1784,40 @@
 
    switch(index) {
-	case GWL_EXSTYLE:
-		oldval = dwExStyle;
-		dwExStyle = value;
-		return oldval;
-	case GWL_STYLE:
-		oldval = dwStyle;
-		dwStyle = value;
-		return oldval;
-	case GWL_WNDPROC:
-		oldval = (LONG)getWindowProc();
-		setWindowProc((WNDPROC)value);
-		return oldval;
-	case GWL_HINSTANCE:
-		oldval = hInstance;
-		hInstance = value;
-		return oldval;
-	case GWL_HWNDPARENT:
-	return SetParent((HWND)value);
-
-	case GWL_ID:
-		oldval = getWindowId();
-		setWindowId(value);
-		return oldval;
-	case GWL_USERDATA:
-		oldval = userData;
-		userData = value;
-		return oldval;
-	default:
-		if(index >= 0 && index/4 < nrUserWindowLong)
-		{
-			oldval = userWindowLong[index/4];
-			userWindowLong[index/4] = value;
-			return oldval;
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GWL_EXSTYLE:
+                oldval = dwExStyle;
+                dwExStyle = value;
+                return oldval;
+        case GWL_STYLE:
+                oldval = dwStyle;
+                dwStyle = value;
+                return oldval;
+        case GWL_WNDPROC:
+                oldval = (LONG)getWindowProc();
+                setWindowProc((WNDPROC)value);
+                return oldval;
+        case GWL_HINSTANCE:
+                oldval = hInstance;
+                hInstance = value;
+                return oldval;
+        case GWL_HWNDPARENT:
+        return SetParent((HWND)value);
+
+        case GWL_ID:
+                oldval = getWindowId();
+                setWindowId(value);
+                return oldval;
+        case GWL_USERDATA:
+                oldval = userData;
+                userData = value;
+                return oldval;
+        default:
+                if(index >= 0 && index/4 < nrUserWindowLong)
+                {
+                        oldval = userWindowLong[index/4];
+                        userWindowLong[index/4] = value;
+                        return oldval;
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
    }
 }
@@ -1768,28 +1827,28 @@
 {
    switch(index) {
-	case GWL_EXSTYLE:
-		return dwExStyle;
-	case GWL_STYLE:
-		return dwStyle;
-	case GWL_WNDPROC:
-		return (ULONG)getWindowProc();
-	case GWL_HINSTANCE:
-		return hInstance;
-	case GWL_HWNDPARENT:
-		if(getParent()) {
-			return getParent()->getWindowHandle();
-		}
-		else	return 0;
-	case GWL_ID:
-		return getWindowId();
-	case GWL_USERDATA:
-		return userData;
-	default:
-		if(index >= 0 && index/4 < nrUserWindowLong)
-		{
-			return userWindowLong[index/4];
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GWL_EXSTYLE:
+                return dwExStyle;
+        case GWL_STYLE:
+                return dwStyle;
+        case GWL_WNDPROC:
+                return (ULONG)getWindowProc();
+        case GWL_HINSTANCE:
+                return hInstance;
+        case GWL_HWNDPARENT:
+                if(getParent()) {
+                        return getParent()->getWindowHandle();
+                }
+                else    return 0;
+        case GWL_ID:
+                return getWindowId();
+        case GWL_USERDATA:
+                return userData;
+        default:
+                if(index >= 0 && index/4 < nrUserWindowLong)
+                {
+                        return userWindowLong[index/4];
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
    }
 }
@@ -1802,7 +1861,7 @@
    if(index >= 0 && index/4 < nrUserWindowLong)
    {
-	oldval = ((WORD *)userWindowLong)[index/2];
-	((WORD *)userWindowLong)[index/2] = value;
-	return oldval;
+        oldval = ((WORD *)userWindowLong)[index/2];
+        ((WORD *)userWindowLong)[index/2] = value;
+        return oldval;
    }
    SetLastError(ERROR_INVALID_PARAMETER);
@@ -1815,5 +1874,5 @@
    if(index >= 0 && index/4 < nrUserWindowLong)
    {
-	return ((WORD *)userWindowLong)[index/2];
+        return ((WORD *)userWindowLong)[index/2];
    }
    SetLastError(ERROR_INVALID_PARAMETER);
@@ -1840,5 +1899,5 @@
 {
  Win32Window *win32wnd;
- DWORD	      magic;
+ DWORD        magic;
 
   win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);
Index: trunk/src/user32/new/win32wnd.h
===================================================================
--- trunk/src/user32/new/win32wnd.h	(revision 691)
+++ trunk/src/user32/new/win32wnd.h	(revision 693)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.24 1999-08-23 15:34:47 dengert Exp $ */
+/* $Id: win32wnd.h,v 1.25 1999-08-25 15:08:51 dengert Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -23,147 +23,149 @@
 class Win32Window;
 
-#define OFFSET_WIN32WNDPTR	0
-#define OFFSET_WIN32PM_MAGIC	4
-
-#define WIN32PM_MAGIC		0x12345678
-#define CheckMagicDword(a)	(a==WIN32PM_MAGIC)
+#define OFFSET_WIN32WNDPTR      0
+#define OFFSET_WIN32PM_MAGIC    4
+
+#define WIN32PM_MAGIC           0x12345678
+#define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
 
 typedef struct {
-	USHORT		cb;
-	Win32Window    *win32wnd;
-	ULONG		win32CreateStruct;	//or dialog create dword
+        USHORT          cb;
+        Win32Window    *win32wnd;
+        ULONG           win32CreateStruct;      //or dialog create dword
 } CUSTOMWNDDATA;
 
 typedef struct
 {
-	ULONG		Msg;
-	ULONG		wParam;
-	ULONG		lParam;
+        ULONG           Msg;
+        ULONG           wParam;
+        ULONG           lParam;
 } POSTMSG_PACKET;
 
-#define WM_WIN32_POSTMESSAGEA	0x4000
-#define WM_WIN32_POSTMESSAGEW	0x4001
-
-#define MAX_WINDOW_NAMELENGTH	256
+#define WM_WIN32_POSTMESSAGEA   0x4000
+#define WM_WIN32_POSTMESSAGEW   0x4001
+
+#define MAX_WINDOW_NAMELENGTH   256
 
 class Win32Window : private GenericObject, private ChildWindow
 {
 public:
-	DWORD	magic;
-
-		Win32Window(DWORD objType);
-		Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
+        DWORD   magic;
+
+                Win32Window(DWORD objType);
+                Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
 virtual        ~Win32Window();
 
-virtual  ULONG	MsgCreate(HWND hwndOS2, ULONG initParam);
-	 ULONG	MsgQuit();
-	 ULONG	MsgClose();
-	 ULONG	MsgDestroy();
-	 ULONG	MsgEnable(BOOL fEnable);
-	 ULONG	MsgShow(BOOL fShow);
-	 ULONG	MsgMove(ULONG x, ULONG y);
-	 ULONG	MsgHitTest(ULONG x, ULONG y);
-	 ULONG	MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
-	 ULONG	MsgActivate(BOOL fActivate, HWND hwnd);
-	 ULONG	MsgSetFocus(HWND hwnd);
-	 ULONG	MsgKillFocus(HWND hwnd);
-	 ULONG	MsgCommand(ULONG cmd, ULONG Id, HWND hwnd);
-	 ULONG	MsgSysCommand(ULONG win32sc, ULONG x, ULONG y);
-	 ULONG	MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags);
-	 ULONG	MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly);
-	 ULONG	MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
-	 ULONG	MsgPaint(ULONG tmp1, ULONG tmp2);
-	 ULONG	MsgEraseBackGround(HDC hdc);
-	 ULONG	MsgSetText(LPSTR lpsz, LONG cch);
-	 ULONG	MsgGetTextLength();
-	 char  *MsgGetText();
-
-virtual  LONG	SetWindowLongA(int index, ULONG value);
-virtual  ULONG	GetWindowLongA(int index);
-virtual  WORD	SetWindowWord(int index, WORD value);
-virtual  WORD	GetWindowWord(int index);
-
-	 DWORD	getStyle()			{ return dwStyle; };
-	 DWORD	getExStyle()			{ return dwExStyle; };
-	 HWND	getWindowHandle()		{ return Win32Hwnd; };
-	 HWND	getOS2WindowHandle()		{ return OS2Hwnd; };
-	 HWND	getOS2FrameWindowHandle()	{ return OS2HwndFrame; };
-	 BOOL	isFrameWindow() 		{ return OS2Hwnd != OS2HwndFrame; };
-   Win32Window *getParent()			{ return (Win32Window *)ChildWindow::GetParent(); };
-	 void	setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
-       WNDPROC	getWindowProc() 		{ return win32wndproc; };
-	 void	setWindowProc(WNDPROC newproc)	{ win32wndproc = newproc; };
-	DWORD	getWindowId()			{ return windowId; };
-	 void	setWindowId(DWORD id)		{ windowId = id; };
-	 ULONG	getWindowHeight()		{ return rectClient.bottom - rectClient.top; };
-	 BOOL	isChild();
-	 PRECT	getClientRect() 		{ return &rectClient; };
-	 PRECT	getWindowRect() 		{ return &rectWindow; };
-
-	 DWORD	getFlags()			{ return flags; };
-	 void	setFlags(DWORD newflags)	{ flags = newflags; };
-
-	 HACCEL GetAccelTable() 		    { return (HACCEL) acceltableResource; };
-	 BOOL	SetAccelTable(ULONG hAccel);
-
-	 HMENU	GetMenu()			    { return (HMENU) menuResource; };
-	 BOOL	SetMenu(ULONG hMenu);
-
-	 BOOL	SetIcon(HICON hIcon);
-	 HICON	GetIcon()			    { return (HICON) iconResource; };
-
-	 BOOL	ShowWindow(ULONG nCmdShow);
-	 BOOL	SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
-	 BOOL	DestroyWindow();
-	 HWND	SetActiveWindow();
-	 HWND	GetParent();
-	 HWND	SetParent(HWND hwndNewParent);
-	 BOOL	IsChild(HWND hwndParent);
-	 HWND	GetTopWindow();
-	 BOOL	UpdateWindow();
-	 BOOL	IsIconic();
-	 HWND	GetWindow(UINT uCmd);
-	 BOOL	EnableWindow(BOOL fEnable);
-	 BOOL	CloseWindow();
-  static HWND	GetActiveWindow();
-	 BOOL	IsWindow();
-	 BOOL	IsWindowEnabled();
-	 BOOL	IsWindowVisible();
-	 BOOL	IsUnicode()  { return isUnicode; };
-
-	 BOOL	GetWindowRect(PRECT pRect);
-	 int	GetWindowTextLengthA();
-	 int	GetWindowTextA(LPSTR lpsz, int cch);
-	 BOOL	SetWindowTextA(LPCSTR lpsz);
-
-       LRESULT	SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
-       LRESULT	SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
-       BOOL	PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
-       BOOL	PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
-       LRESULT	DefWindowProcA(UINT msg, WPARAM wParam, LPARAM lParam);
-       LRESULT	DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
-
-	 void	NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
+virtual  ULONG  MsgCreate(HWND hwndOS2, ULONG initParam);
+         ULONG  MsgQuit();
+         ULONG  MsgClose();
+         ULONG  MsgDestroy();
+         ULONG  MsgEnable(BOOL fEnable);
+         ULONG  MsgShow(BOOL fShow);
+         ULONG  MsgPosChanging(LPARAM lp);
+         ULONG  MsgPosChanged(LPARAM lp);
+         ULONG  MsgMove(ULONG x, ULONG y);
+         ULONG  MsgHitTest(ULONG x, ULONG y);
+         ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
+         ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
+         ULONG  MsgSetFocus(HWND hwnd);
+         ULONG  MsgKillFocus(HWND hwnd);
+         ULONG  MsgCommand(ULONG cmd, ULONG Id, HWND hwnd);
+         ULONG  MsgSysCommand(ULONG win32sc, ULONG x, ULONG y);
+         ULONG  MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags);
+         ULONG  MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly);
+         ULONG  MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
+         ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
+         ULONG  MsgEraseBackGround(HDC hdc);
+         ULONG  MsgSetText(LPSTR lpsz, LONG cch);
+         ULONG  MsgGetTextLength();
+         char  *MsgGetText();
+
+virtual  LONG   SetWindowLongA(int index, ULONG value);
+virtual  ULONG  GetWindowLongA(int index);
+virtual  WORD   SetWindowWord(int index, WORD value);
+virtual  WORD   GetWindowWord(int index);
+
+         DWORD  getStyle()                      { return dwStyle; };
+         DWORD  getExStyle()                    { return dwExStyle; };
+         HWND   getWindowHandle()               { return Win32Hwnd; };
+         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
+         HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
+         BOOL   isFrameWindow()                 { return OS2Hwnd != OS2HwndFrame; };
+   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
+         void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
+       WNDPROC  getWindowProc()                 { return win32wndproc; };
+         void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
+        DWORD   getWindowId()                   { return windowId; };
+         void   setWindowId(DWORD id)           { windowId = id; };
+         ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
+         BOOL   isChild();
+         PRECT  getClientRect()                 { return &rectClient; };
+         PRECT  getWindowRect()                 { return &rectWindow; };
+
+         DWORD  getFlags()                      { return flags; };
+         void   setFlags(DWORD newflags)        { flags = newflags; };
+
+         HACCEL GetAccelTable()                     { return (HACCEL) acceltableResource; };
+         BOOL   SetAccelTable(ULONG hAccel);
+
+         HMENU  GetMenu()                           { return (HMENU) menuResource; };
+         BOOL   SetMenu(ULONG hMenu);
+
+         BOOL   SetIcon(HICON hIcon);
+         HICON  GetIcon()                           { return (HICON) iconResource; };
+
+         BOOL   ShowWindow(ULONG nCmdShow);
+         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
+         BOOL   DestroyWindow();
+         HWND   SetActiveWindow();
+         HWND   GetParent();
+         HWND   SetParent(HWND hwndNewParent);
+         BOOL   IsChild(HWND hwndParent);
+         HWND   GetTopWindow();
+         BOOL   UpdateWindow();
+         BOOL   IsIconic();
+         HWND   GetWindow(UINT uCmd);
+         BOOL   EnableWindow(BOOL fEnable);
+         BOOL   CloseWindow();
+  static HWND   GetActiveWindow();
+         BOOL   IsWindow();
+         BOOL   IsWindowEnabled();
+         BOOL   IsWindowVisible();
+         BOOL   IsUnicode()  { return isUnicode; };
+
+         BOOL   GetWindowRect(PRECT pRect);
+         int    GetWindowTextLengthA();
+         int    GetWindowTextA(LPSTR lpsz, int cch);
+         BOOL   SetWindowTextA(LPCSTR lpsz);
+
+       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
+       LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
+       BOOL     PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
+       BOOL     PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
+       LRESULT  DefWindowProcA(UINT msg, WPARAM wParam, LPARAM lParam);
+       LRESULT  DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
+
+         void   NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
 
 Win32WndClass  *getClass()  { return windowClass; };
 
-static	 HWND  Win32ToOS2Handle(HWND hwnd)
+static   HWND  Win32ToOS2Handle(HWND hwnd)
 {
  Win32Window *window = GetWindowFromHandle(hwnd);
 
   if(window) {
-	return window->getOS2WindowHandle();
+        return window->getOS2WindowHandle();
   }
-  else	return hwnd;	//OS/2 window handle
+  else  return hwnd;    //OS/2 window handle
 }
 
-static	 HWND  OS2ToWin32Handle(HWND hwnd)
+static   HWND  OS2ToWin32Handle(HWND hwnd)
 {
  Win32Window *window = GetWindowFromOS2Handle(hwnd);
 
   if(window) {
-	return window->getWindowHandle();
+        return window->getWindowHandle();
   }
-  else	return hwnd;	//OS/2 window handle
+  else  return hwnd;    //OS/2 window handle
 }
 
@@ -172,33 +174,33 @@
 
 protected:
-       LRESULT	SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
-       LRESULT	SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
-	void	Init();
-
-	HWND	OS2Hwnd;
-	HWND	OS2HwndFrame;
-	HWND	OS2HwndMenu;
-	HWND	Win32Hwnd;
-	BOOL	isUnicode;
-
-	int	posx, posy, width, height;
-
-	// values normally contained in the standard window words
-	ULONG	dwExStyle;		//GWL_EXSTYLE
-	ULONG	dwStyle;		//GWL_STYLE
-      WNDPROC	win32wndproc;		//GWL_WNDPROC
-	ULONG	hInstance;		//GWL_HINSTANCE
+       LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
+       LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
+        void    Init();
+
+        HWND    OS2Hwnd;
+        HWND    OS2HwndFrame;
+        HWND    OS2HwndMenu;
+        HWND    Win32Hwnd;
+        BOOL    isUnicode;
+
+        int     posx, posy, width, height;
+
+        // values normally contained in the standard window words
+        ULONG   dwExStyle;              //GWL_EXSTYLE
+        ULONG   dwStyle;                //GWL_STYLE
+      WNDPROC   win32wndproc;           //GWL_WNDPROC
+        ULONG   hInstance;              //GWL_HINSTANCE
 //Moved in ChildWindow class
-/////	Win32Window *parent;			//GWL_HWNDPARENT
-	ULONG	windowId;		//GWL_ID
-	ULONG	userData;		//GWL_USERDATA
-
-	 HWND	hwndLinkAfter;
-	DWORD	flags;
-	DWORD	lastHitTestVal; 	//Last value returned by WM_NCHITTEST handler
-
-	BOOL	isIcon;
-	BOOL	fCreated;
-	BOOL	fFirstShow;
+/////   Win32Window *parent;                    //GWL_HWNDPARENT
+        ULONG   windowId;               //GWL_ID
+        ULONG   userData;               //GWL_USERDATA
+
+         HWND   hwndLinkAfter;
+        DWORD   flags;
+        DWORD   lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
+
+        BOOL    isIcon;
+        BOOL    fCreated;
+        BOOL    fFirstShow;
 
    Win32Window *owner;
@@ -208,13 +210,13 @@
  Win32Resource *iconResource;
 
-	char	windowNameA[MAX_WINDOW_NAMELENGTH];
-	WCHAR	windowNameW[MAX_WINDOW_NAMELENGTH];
-	ULONG	wndNameLength;
-
-	ULONG  *userWindowLong;
-	ULONG	nrUserWindowLong;
-
-	RECT	rectWindow;
-	RECT	rectClient;
+        char    windowNameA[MAX_WINDOW_NAMELENGTH];
+        WCHAR   windowNameW[MAX_WINDOW_NAMELENGTH];
+        ULONG   wndNameLength;
+
+        ULONG  *userWindowLong;
+        ULONG   nrUserWindowLong;
+
+        RECT    rectWindow;
+        RECT    rectClient;
 
 Win32WndClass  *windowClass;
@@ -224,18 +226,18 @@
 private:
 #ifndef OS2_INCLUDED
-	BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
-
-	void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
-
-	LONG  SendNCCalcSize(BOOL calcValidRect,
-			     RECT *newWindowRect, RECT *oldWindowRect,
-			     RECT *oldClientRect, WINDOWPOS *winpos,
-			     RECT *newClientRect );
+        BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
+
+        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
+
+        LONG  SendNCCalcSize(BOOL calcValidRect,
+                             RECT *newWindowRect, RECT *oldWindowRect,
+                             RECT *oldClientRect, WINDOWPOS *winpos,
+                             RECT *newClientRect );
 
      LRESULT  SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
      {
-	if(isUnicode)
-		return SendInternalMessageW(msg, wParam, lParam);
-	else	return SendInternalMessageA(msg, wParam, lParam);
+        if(isUnicode)
+                return SendInternalMessageW(msg, wParam, lParam);
+        else    return SendInternalMessageA(msg, wParam, lParam);
      }
 #endif
@@ -243,32 +245,32 @@
 
 
-#define BUTTON_LEFTDOWN 	0
-#define BUTTON_LEFTUP		1
-#define BUTTON_LEFTDBLCLICK	2
-#define BUTTON_RIGHTUP		3
-#define BUTTON_RIGHTDOWN	4
-#define BUTTON_RIGHTDBLCLICK	5
-#define BUTTON_MIDDLEUP 	6
-#define BUTTON_MIDDLEDOWN	7
-#define BUTTON_MIDDLEDBLCLICK	8
-
-#define WMMOVE_LBUTTON		1
-#define WMMOVE_MBUTTON		2
-#define WMMOVE_RBUTTON		4
-#define WMMOVE_CTRL		8
-#define WMMOVE_SHIFT		16
-
-
-#define CMD_MENU		1
-#define CMD_CONTROL		2
-#define CMD_ACCELERATOR 	3
-
-#define WIN32SC_SIZE	     0xf000
-#define WIN32SC_MOVE	     0xf010
+#define BUTTON_LEFTDOWN         0
+#define BUTTON_LEFTUP           1
+#define BUTTON_LEFTDBLCLICK     2
+#define BUTTON_RIGHTUP          3
+#define BUTTON_RIGHTDOWN        4
+#define BUTTON_RIGHTDBLCLICK    5
+#define BUTTON_MIDDLEUP         6
+#define BUTTON_MIDDLEDOWN       7
+#define BUTTON_MIDDLEDBLCLICK   8
+
+#define WMMOVE_LBUTTON          1
+#define WMMOVE_MBUTTON          2
+#define WMMOVE_RBUTTON          4
+#define WMMOVE_CTRL             8
+#define WMMOVE_SHIFT            16
+
+
+#define CMD_MENU                1
+#define CMD_CONTROL             2
+#define CMD_ACCELERATOR         3
+
+#define WIN32SC_SIZE         0xf000
+#define WIN32SC_MOVE         0xf010
 #define WIN32SC_MINIMIZE     0xf020
 #define WIN32SC_MAXIMIZE     0xf030
 #define WIN32SC_NEXTWINDOW   0xf040
 #define WIN32SC_PREVWINDOW   0xf050
-#define WIN32SC_CLOSE	     0xf060
+#define WIN32SC_CLOSE        0xf060
 #define WIN32SC_VSCROLL      0xf070
 #define WIN32SC_HSCROLL      0xf080
@@ -279,10 +281,10 @@
 #define WIN32SC_TASKLIST     0xf130
 #define WIN32SC_SCREENSAVE   0xf140
-#define WIN32SC_HOTKEY	     0xf150
-
-#define KEY_ALTDOWN		1
-#define KEY_PREVDOWN		2
-#define KEY_UP			4
-#define KEY_DEADKEY		8
+#define WIN32SC_HOTKEY       0xf150
+
+#define KEY_ALTDOWN             1
+#define KEY_PREVDOWN            2
+#define KEY_UP                  4
+#define KEY_DEADKEY             8
 
 #endif //__cplusplus
