Index: trunk/src/user32/new/defwndproc.cpp
===================================================================
--- trunk/src/user32/new/defwndproc.cpp	(revision 327)
+++ trunk/src/user32/new/defwndproc.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: defwndproc.cpp,v 1.1 1999-07-14 08:35:34 sandervl Exp $ */
+/* $Id: defwndproc.cpp,v 1.2 1999-07-18 14:39:34 sandervl Exp $ */
 
 /*
@@ -25,52 +25,111 @@
 ////    WriteLog("*DWP*");
 #endif
-    switch(Msg) {
-        case WM_SETREDRAW: //Open32 does not set the visible flag
-                if(wParam)
-                  	SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
-                else    SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
-
+    switch(Msg)
+    {
+    case WM_SETREDRAW: //Open32 does not set the visible flag
+        if(wParam)
+               	SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
+        else    SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
+
+        return 0; //TODO
+
+    case WM_NCCREATE:
+        return(TRUE);
+
+    case WM_CTLCOLORMSGBOX:
+    case WM_CTLCOLOREDIT:
+    case WM_CTLCOLORLISTBOX:
+    case WM_CTLCOLORBTN:
+    case WM_CTLCOLORDLG:
+    case WM_CTLCOLORSTATIC:
+    case WM_CTLCOLORSCROLLBAR:
+         SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+         SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+         return GetSysColorBrush(COLOR_BTNFACE);
+
+    case WM_PARENTNOTIFY:
+        return 0;
+
+    case WM_MOUSEACTIVATE:
+    {
+        DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
+        DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
+        dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
+        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
+        {
+            LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
+            if(rc)  return rc;
+        }
+        return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
+    }
+    case WM_SETCURSOR:
+    {
+        DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
+        DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
+        dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
+        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
+        {
+            LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam);
+            if(rc)  return rc;
+        }
+        return 1;
+    }
+    case WM_MOUSEMOVE:
+    	return 0;
+    	
+    case WM_ERASEBKGND:
+    case WM_ICONERASEBKGND:
+    	return 0;
+    	
+    case WM_NCLBUTTONDOWN:
+    case WM_NCLBUTTONUP:
+    case WM_NCLBUTTONDBLCLK:
+    case WM_NCRBUTTONUP:
+    case WM_NCRBUTTONDOWN:
+    case WM_NCRBUTTONDBLCLK:
+    case WM_NCMBUTTONDOWN:
+    case WM_NCMBUTTONUP:
+    case WM_NCMBUTTONDBLCLK:
+		return 0;           //TODO: Send WM_SYSCOMMAND if required
+		
+    case WM_NCHITTEST: //TODO:
+    	return 0;
+    	
+    default:
+        return 1;
+    }
+}
+//******************************************************************************
+//NOTE: Unicode msg translation!
+//******************************************************************************
+LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+#ifdef DEBUG
+////    WriteLog("*DWPW*");
+#endif
+    switch(Msg) {
+        case WM_SETREDRAW: //Open32 does not set the visible flag
+                if(wParam)
+                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
+                else
+                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
                 return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
-        case WM_NCCREATE://SvL: YAFMO (yet another feature missing in Open32)
-                return(TRUE);
-        case WM_CTLCOLORMSGBOX:
-        case WM_CTLCOLOREDIT:
-        case WM_CTLCOLORLISTBOX:
-        case WM_CTLCOLORBTN:
-        case WM_CTLCOLORDLG:
-        case WM_CTLCOLORSTATIC:
-        case WM_CTLCOLORSCROLLBAR:
-                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
-                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
-                return GetSysColorBrush(COLOR_BTNFACE);
-
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
-
-	case WM_MOUSEACTIVATE:
-	{
-		DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
-		DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
-		dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
-		if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
-		{
-			LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
-			if(rc)	return rc;
-		}
-		return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
-	}
-	case WM_SETCURSOR:
-	{
-		DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
-		DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
-		dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
-		if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
-		{
-			LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam);
-			if(rc)	return rc;
-		}
-		return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
-	}
+        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
+                return(TRUE);
+        case WM_CTLCOLORMSGBOX:
+        case WM_CTLCOLOREDIT:
+        case WM_CTLCOLORLISTBOX:
+        case WM_CTLCOLORBTN:
+        case WM_CTLCOLORDLG:
+        case WM_CTLCOLORSTATIC:
+        case WM_CTLCOLORSCROLLBAR:
+                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+                return GetSysColorBrush(COLOR_BTNFACE);
+
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
+        return 0;
+
         default:
                 return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
@@ -78,45 +137,45 @@
 }
 //******************************************************************************
+//******************************************************************************
+LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+#ifdef DEBUG
+////    WriteLog("*DDP*");
+#endif
+    switch(Msg) {
+        case WM_SETREDRAW: //Open32 does not set the visible flag
+                if(wParam)
+                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
+                else
+                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
+                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
+        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
+                return(TRUE);
+        case WM_CTLCOLORMSGBOX:
+        case WM_CTLCOLOREDIT:
+        case WM_CTLCOLORLISTBOX:
+        case WM_CTLCOLORBTN:
+        case WM_CTLCOLORDLG:
+        case WM_CTLCOLORSTATIC:
+        case WM_CTLCOLORSCROLLBAR:
+                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+                return GetSysColorBrush(COLOR_BTNFACE);
+
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
+        return 0;
+
+        default:
+                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
+    }
+}
+//******************************************************************************
 //NOTE: Unicode msg translation!
 //******************************************************************************
-LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-#ifdef DEBUG
-////    WriteLog("*DWPW*");
-#endif
-    switch(Msg) {
-        case WM_SETREDRAW: //Open32 does not set the visible flag
-                if(wParam)
-                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
-                else
-                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
-                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
-        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
-                return(TRUE);
-        case WM_CTLCOLORMSGBOX:
-        case WM_CTLCOLOREDIT:
-        case WM_CTLCOLORLISTBOX:
-        case WM_CTLCOLORBTN:
-        case WM_CTLCOLORDLG:
-        case WM_CTLCOLORSTATIC:
-        case WM_CTLCOLORSCROLLBAR:
-                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
-                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
-                return GetSysColorBrush(COLOR_BTNFACE);
-
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
-
-        default:
-                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
-    }
-}
-//******************************************************************************
-//******************************************************************************
-LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-#ifdef DEBUG
-////    WriteLog("*DDP*");
+LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+#ifdef DEBUG
+////    WriteLog("*DDPW*");
 #endif
     switch(Msg) {
@@ -140,43 +199,7 @@
                 return GetSysColorBrush(COLOR_BTNFACE);
 
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
-
-        default:
-                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
-    }
-}
-//******************************************************************************
-//NOTE: Unicode msg translation!
-//******************************************************************************
-LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-#ifdef DEBUG
-////    WriteLog("*DDPW*");
-#endif
-    switch(Msg) {
-        case WM_SETREDRAW: //Open32 does not set the visible flag
-                if(wParam)
-                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
-                else
-                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
-                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
-        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
-                return(TRUE);
-        case WM_CTLCOLORMSGBOX:
-        case WM_CTLCOLOREDIT:
-        case WM_CTLCOLORLISTBOX:
-        case WM_CTLCOLORBTN:
-        case WM_CTLCOLORDLG:
-        case WM_CTLCOLORSTATIC:
-        case WM_CTLCOLORSCROLLBAR:
-                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
-                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
-                return GetSysColorBrush(COLOR_BTNFACE);
-
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
+        return 0;
 
         default:
@@ -211,7 +234,7 @@
                 return GetSysColorBrush(COLOR_BTNFACE);
 
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
-		return 0;
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
+        return 0;
 
         default:
@@ -247,7 +270,7 @@
                 return GetSysColorBrush(COLOR_BTNFACE);
 
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
-		return 0;
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
+        return 0;
 
         default:
@@ -282,7 +305,7 @@
                 return GetSysColorBrush(COLOR_BTNFACE);
 
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
+        return 0;
 
         default:
@@ -318,7 +341,7 @@
                 return GetSysColorBrush(COLOR_BTNFACE);
 
-	case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
-		dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
-		return 0;
+    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
+        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
+        return 0;
 
         default:
Index: trunk/src/user32/new/oslibgdi.cpp
===================================================================
--- trunk/src/user32/new/oslibgdi.cpp	(revision 327)
+++ trunk/src/user32/new/oslibgdi.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: oslibgdi.cpp,v 1.1 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: oslibgdi.cpp,v 1.2 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Window GDI wrapper functions for OS/2
@@ -26,5 +26,5 @@
  PRECTL pWinRect = (PRECTL)pRectl;
  ULONG  tmp;
-  
+
   tmp = pWinRect->yBottom;
   pWinRect->yBottom = pWinRect->yTop;
@@ -74,5 +74,5 @@
  HWND     hwndParent;
  RECTLOS2 rectParent = {0};
-   
+
    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
@@ -110,11 +110,11 @@
 //
 // Parameters:
-//   hwndChild:	Child window handle
+//   hwndChild: Child window handle
 //   rectChild: OS/2 child window RECTL
 //
 // Returns:
 //   rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
-//   TRUE:  	Success
-//   FALSE: 	Failures
+//   TRUE:      Success
+//   FALSE:     Failures
 //******************************************************************************
 BOOL MapOS2ToWin32Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32)
@@ -142,6 +142,6 @@
 // Returns:
 //   rectChild:  Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
-//   TRUE:  	 Success
-//   FALSE: 	 Failures
+//   TRUE:       Success
+//   FALSE:      Failures
 //******************************************************************************
 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32)
@@ -162,6 +162,6 @@
 //   rectChild:  OS/2  Child window RECTL  (OUT)
 // Returns:
-//   TRUE:  	 Success
-//   FALSE: 	 Failures
+//   TRUE:       Success
+//   FALSE:      Failures
 //******************************************************************************
 BOOL MapWin32ToOS2Rectl(HWND hwndChild, PRECT rectWin32, PRECTLOS2 rectChild)
@@ -188,6 +188,6 @@
 //   rectChild:  OS/2  Child window RECTL  (OUT)
 // Returns:
-//   TRUE:  	 Success
-//   FALSE: 	 Failures
+//   TRUE:       Success
+//   FALSE:      Failures
 //******************************************************************************
 BOOL MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECT rectWin32, PRECTLOS2 rectChild)
Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 327)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.11 1999-07-18 13:57:47 cbratschi Exp $ */
+/* $Id: oslibwin.cpp,v 1.12 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -256,8 +256,14 @@
 //******************************************************************************
 //******************************************************************************
-BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect)
-{
-  return WinQueryUpdateRect(hwnd, (PRECTL)pRect);
-  //CB: caller must convert rect
+BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)
+{
+ BOOL rc;
+ RECTLOS2 rectl;
+
+  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
+  if(rc) {
+	MapOS2ToWin32Rectl(hwnd, &rectl, pRect);
+  }
+  return rc;
 }
 //******************************************************************************
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 327)
+++ trunk/src/user32/new/oslibwin.h	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.10 1999-07-18 13:57:47 cbratschi Exp $ */
+/* $Id: oslibwin.h,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -184,5 +184,5 @@
 
 BOOL  OSLibWinDestroyWindow(HWND hwnd);
-BOOL  OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect); //must be RECTL pointer!
+BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);
 BOOL  OSLibWinIsIconic(HWND hwnd);
 BOOL  OSLibWinSetActiveWindow(HWND hwnd);
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 327)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.8 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.9 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -39,5 +39,5 @@
   hmq = WinCreateMsgQueue(hab, 0);
 
-  if(!hab || !hmq) 
+  if(!hab || !hmq)
   {
         UINT error;
@@ -46,17 +46,17 @@
         if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
         {
-          	dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
-          	dprintf((" Error = %x",error));
-          	return(FALSE);
-        } 
- 	else
+            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;
+        }
         }
   }
@@ -69,5 +69,5 @@
      (PSZ)WIN32_STDCLASS,               /* Window class name            */
      (PFNWP)Win32WindowProc,            /* Address of window procedure  */
-     CS_SIZEREDRAW,                     /* Class style                  */
+     CS_SIZEREDRAW | CS_MOVENOTIFY | CS_HITTEST,
      8)) {
         dprintf(("WinRegisterClass Win32Window failed"));
@@ -101,32 +101,32 @@
     //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;
+    	dprintf(("OS2: WM_CREATE %x", hwnd));
+    	RestoreOS2TIB();
+    	return (MRESULT)FALSE;
 
     case WM_QUIT:
-	dprintf(("OS2: WM_QUIT %x", hwnd));
+    	dprintf(("OS2: WM_QUIT %x", hwnd));
         if(win32wnd->MsgQuit()) {
                 goto RunDefWndProc;
@@ -135,5 +135,5 @@
 
     case WM_CLOSE:
-	dprintf(("OS2: WM_CLOSE %x", hwnd));
+    	dprintf(("OS2: WM_CLOSE %x", hwnd));
         if(win32wnd->MsgClose()) {
                 goto RunDefWndProc;
@@ -142,5 +142,5 @@
 
     case WM_DESTROY:
-	dprintf(("OS2: WM_DESTROY %x", hwnd));
+    	dprintf(("OS2: WM_DESTROY %x", hwnd));
         if(win32wnd->MsgDestroy()) {
                 goto RunDefWndProc;
@@ -149,5 +149,5 @@
 
     case WM_ENABLE:
-	dprintf(("OS2: WM_ENABLE %x", hwnd));
+    	dprintf(("OS2: WM_ENABLE %x", hwnd));
         if(win32wnd->MsgEnable((ULONG)mp1)) {
                 goto RunDefWndProc;
@@ -156,5 +156,5 @@
 
     case WM_SHOW:
-	dprintf(("OS2: WM_SHOW %x", hwnd));
+    	dprintf(("OS2: WM_SHOW %x", hwnd));
         if(win32wnd->MsgShow((ULONG)mp1)) {
                 goto RunDefWndProc;
@@ -165,16 +165,16 @@
     {
       RECTLOS2 rectChild;
-      ULONG xParent, yParent;
-
-	dprintf(("OS2: WM_MOVE %x", hwnd));
-
-	WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
+      ULONG x, y;
+
+    	dprintf(("OS2: WM_MOVE %x", hwnd));
+
+    	WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
 
         //Calculate position relative to parent window (real window or desktop)
-        xParent = rectChild.xLeft;
-        yParent = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
-
-       	if(win32wnd->MsgMove(xParent, yParent)) {
-           	goto RunDefWndProc;
+        x = rectChild.xLeft;
+        y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
+
+        if(win32wnd->MsgMove(x, y)) {
+            goto RunDefWndProc;
         }
         break;
@@ -183,13 +183,13 @@
     case WM_WINDOWPOSCHANGED:
     {
-        break;
+    	dprintf(("OS2: WM_WINDOWPOSCHANGED %x", hwnd));
     }
 
     case WM_ADJUSTWINDOWPOS:
     {
-	dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
-//      	if(win32wnd->MsgWindowPosChanging(0, 0)) {
-                goto RunDefWndProc;
-//	}
+    	dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
+//          if(win32wnd->MsgWindowPosChanging(0, 0)) {
+                goto RunDefWndProc;
+//  }
         break;
     }
@@ -199,7 +199,7 @@
      HPS hps;
 
-	dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
+    	dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
         hps = WinGetPS(hwnd);
-        if(win32wnd->MsgEraseBackGround((ULONG)hps))
+        if(!win32wnd->MsgEraseBackGround((ULONG)hps))
         {
                 /*
@@ -217,5 +217,5 @@
      SWP swp;
 
-	dprintf(("OS2: WM_SIZE %x", hwnd));
+    	dprintf(("OS2: WM_SIZE %x", hwnd));
         rc = WinQueryWindowPos(hwnd, &swp);
         if(rc == FALSE) {
@@ -236,5 +236,5 @@
       HWND hwndActivate = (HWND)mp1;
 
-	dprintf(("OS2: WM_ACTIVATE %x", hwnd));
+    	dprintf(("OS2: WM_ACTIVATE %x", hwnd));
         if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
                 //another (non-win32) application's window
@@ -248,5 +248,6 @@
     }
     case WM_FOCUSCHANGE:
-        break;
+    	dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
+        goto RunDefWndProc;
 
     case WM_SETFOCUS:
@@ -254,5 +255,5 @@
       HWND hwndFocus = (HWND)mp1;
 
-	dprintf(("OS2: WM_SETFOCUS %x", hwnd));
+    	dprintf(("OS2: WM_SETFOCUS %x", hwnd));
         if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
                 //another (non-win32) application's window
@@ -273,33 +274,51 @@
     //**************************************************************************
     case WM_BUTTON1DOWN:
-        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+    	dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
+        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
                 goto RunDefWndProc;
         }
         break;
     case WM_BUTTON1UP:
-        if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+    	dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
+        if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
                 goto RunDefWndProc;
         }
         break;
     case WM_BUTTON1DBLCLK:
-        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
                 goto RunDefWndProc;
         }
         break;
     case WM_BUTTON2DOWN:
-        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
                 goto RunDefWndProc;
         }
         break;
     case WM_BUTTON2UP:
-        if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+        if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
                 goto RunDefWndProc;
         }
         break;
     case WM_BUTTON2DBLCLK:
-        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-                goto RunDefWndProc;
-        }
-        break;
+        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
+    case WM_BUTTON3DOWN:
+        if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
+    case WM_BUTTON3UP:
+        if(win32wnd->MsgButton(BUTTON_MIDDLEUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
+    case WM_BUTTON3DBLCLK:
+        if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
+
     case WM_BUTTON2MOTIONSTART:
     case WM_BUTTON2MOTIONEND:
@@ -308,14 +327,28 @@
     case WM_BUTTON1MOTIONEND:
     case WM_BUTTON1CLICK:
-    case WM_BUTTON3DOWN:
-    case WM_BUTTON3UP:
-    case WM_BUTTON3DBLCLK:
     case WM_BUTTON3MOTIONSTART:
     case WM_BUTTON3MOTIONEND:
     case WM_BUTTON3CLICK:
-        break;
+        goto RunDefWndProc;
 
     case WM_MOUSEMOVE:
-        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;
+			
+        if(!win32wnd->MsgMouseMove(keystate, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+        break;
+    }
 
     //**************************************************************************
@@ -323,17 +356,12 @@
     //**************************************************************************
     case WM_VSCROLL:
-        break;
     case WM_HSCROLL:
-        break;
 
     case WM_CONTROL:
-        break;
 
     case WM_COMMAND:
     case WM_SYSCOMMAND:
-        break;
 
     case WM_CHAR:
-        break;
 
     case WM_INITMENU:
@@ -341,24 +369,23 @@
     case WM_MENUEND:
     case WM_NEXTMENU:
-        break;
 
     case WM_TIMER:
-        break;
-
+    	goto RunDefWndProc;
+		
     case WM_SETWINDOWPARAMS:
     {
       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;
     }
 
     case WM_PAINT:
-	dprintf(("OS2: WM_PAINT %x", hwnd));
+    	dprintf(("OS2: WM_PAINT %x", hwnd));
         if(win32wnd->MsgPaint(0, 0)) {
                 goto RunDefWndProc;
@@ -366,11 +393,14 @@
         break;
 
+    case WM_HITTEST:
+        if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
+                goto RunDefWndProc;
+        }
+    	break;
+    	
     case WM_SYSCOLORCHANGE:
     case WM_SYSVALUECHANGED:
-        break;
-
     case WM_CALCVALIDRECTS:
     case WM_QUERYWINDOWPARAMS:
-    case WM_HITTEST:
     case WM_SETSELECTION:
     case WM_PPAINT:
@@ -391,7 +421,6 @@
     case WM_SAVEAPPLICATION:
     case WM_SEMANTICEVENT:
-        break;
     default:
-	dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
+    	dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
         RestoreOS2TIB();
         return WinDefWindowProc( hwnd, msg, mp1, mp2 );
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 327)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.10 1999-07-18 13:57:48 cbratschi Exp $ */
+/* $Id: win32wnd.cpp,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -95,4 +95,5 @@
   flags            = 0;
   isIcon           = FALSE;
+  lastHitTestVal   = 0;
   owner            = NULL;
   windowClass      = 0;
@@ -128,5 +129,5 @@
                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
                 SetLastError(ERROR_INVALID_PARAMETER);
-                return FALSE;
+        return FALSE;
         }
         /* Make sure parent is valid */
@@ -231,5 +232,5 @@
   if ((cs->style & WS_CHILD) && cs->hwndParent)
   {
-        SetParent(cs->hwndParent);
+    SetParent(cs->hwndParent);
   }
   else
@@ -240,5 +241,5 @@
         else
         {
-                owner = GetWindowFromHandle(cs->hwndParent);
+        owner = GetWindowFromHandle(cs->hwndParent);
                 if(owner == NULL)
                 {
@@ -263,18 +264,18 @@
     if (HOOK_IsHooked( WH_CBT ))
     {
-        CBT_CREATEWNDA cbtc;
+    CBT_CREATEWNDA cbtc;
         LRESULT ret;
 
-        cbtc.lpcs = cs;
-        cbtc.hwndInsertAfter = hwndLinkAfter;
+    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)
-        {
-            TRACE_(win)("CBT-hook returned 0\n");
-            wndPtr->pDriver->pFinalize(wndPtr);
+    {
+        TRACE_(win)("CBT-hook returned 0\n");
+        wndPtr->pDriver->pFinalize(wndPtr);
             retvalue =  0;
             goto end;
-        }
+    }
     }
 #endif
@@ -337,5 +338,5 @@
                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
                                  (owner) ? owner->getOS2WindowHandle() : 0,
-                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
+                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
                                  &OS2HwndFrame);
 
@@ -354,12 +355,12 @@
 #if 0
   if(OS2Hwnd != OS2HwndFrame) {
-        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == 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;
-        }
+    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == 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;
+    }
   }
 #endif
@@ -389,11 +390,11 @@
         OffsetRect(&rectWindow, maxPos.x - rectWindow.left,
                                           maxPos.y - rectWindow.top);
-        dprintf(("Sending WM_CREATE"));
+    dprintf(("Sending WM_CREATE"));
         if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
         {
             SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
-                         rectClient.right-rectClient.left,
-                         rectClient.bottom-rectClient.top,
-                         SWP_NOACTIVATE);
+             rectClient.right-rectClient.left,
+             rectClient.bottom-rectClient.top,
+             SWP_NOACTIVATE);
 
             if (cs->style & WS_VISIBLE) ShowWindow( sw );
@@ -405,5 +406,5 @@
                 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
 #endif
-            return TRUE;
+        return TRUE;
         }
   }
@@ -429,88 +430,88 @@
     if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))
     {
-        if( dwStyle & WS_MINIMIZE )
-        {
-            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;
+    if( dwStyle & WS_MINIMIZE )
+    {
+        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;
+             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:
+         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:
                 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
                 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
                 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
 
-                 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;
-                 }
+         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 */
+         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;
-        }
+             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;
     return swpFlags;
@@ -611,7 +612,7 @@
    {
         winposCopy = *winpos;
-        params.rgrc[1] = *oldWindowRect;
-        params.rgrc[2] = *oldClientRect;
-        params.lppos = &winposCopy;
+    params.rgrc[1] = *oldWindowRect;
+    params.rgrc[2] = *oldClientRect;
+    params.lppos = &winposCopy;
    }
    result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect,
@@ -665,6 +666,13 @@
 //******************************************************************************
 ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent)
-{
-  return 0;
+{  	
+  return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)xParent, (USHORT)yParent));
+}
+//******************************************************************************
+//******************************************************************************
+ULONG Win32Window::MsgHitTest(ULONG x, ULONG y)
+{
+  lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y));
+  return 1; //TODO: May need to change this
 }
 //******************************************************************************
@@ -709,23 +717,42 @@
 {
  ULONG win32msg;
+ ULONG win32ncmsg;
 
   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:
@@ -733,5 +760,25 @@
                 return 1;
   }
-  return SendInternalMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y)));
+  SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(x, y)); //TODO:
+  return SendInternalMessageA(win32msg, 0, MAKELONG(x, y));
+}
+//******************************************************************************
+//******************************************************************************
+ULONG Win32Window::MsgMouseMove(ULONG keystate, ULONG x, ULONG y)
+{
+ULONG winstate = 0;
+
+  if(keystate & WMMOVE_LBUTTON)
+  	winstate |= MK_LBUTTON;
+  if(keystate & WMMOVE_RBUTTON)
+  	winstate |= MK_RBUTTON;
+  if(keystate & WMMOVE_MBUTTON)
+  	winstate |= MK_MBUTTON;
+  if(keystate & WMMOVE_SHIFT)
+  	winstate |= MK_SHIFT;
+  if(keystate & WMMOVE_CTRL)
+  	winstate |= MK_CONTROL;
+  	
+   return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y));
 }
 //******************************************************************************
@@ -745,5 +792,8 @@
 ULONG Win32Window::MsgEraseBackGround(ULONG hps)
 {
-  return SendInternalMessageA(WM_ERASEBKGND, hps, 0);
+ 	if(isIcon) {
+ 			return SendInternalMessageA(WM_ICONERASEBKGND, hps, 0);
+ 	}
+  	else	return SendInternalMessageA(WM_ERASEBKGND, hps, 0);
 }
 //******************************************************************************
@@ -752,5 +802,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);
@@ -843,5 +893,4 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-
         dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
@@ -929,6 +978,6 @@
   postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
   if(postmsg == NULL) {
-        dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
-        return 0;
+    dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
+    return 0;
   }
   postmsg->Msg    = msg;
@@ -945,6 +994,6 @@
   postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
   if(postmsg == NULL) {
-        dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
-        return 0;
+    dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
+    return 0;
   }
   postmsg->Msg    = msg;
@@ -987,9 +1036,9 @@
    if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR)
    {
-        OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
-        if(OS2HwndMenu == 0) {
-                dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
-                return FALSE;
-        }
+    OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
+    if(OS2HwndMenu == 0) {
+        dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
+        return FALSE;
+    }
    }
    dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu));
@@ -1005,35 +1054,35 @@
   switch(nCmdShow)
   {
-        case SW_SHOW:
-        case SW_SHOWDEFAULT: //todo
-                showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
-                break;
-        case SW_HIDE:
-                showstate = SWPOS_HIDE;
-                break;
-        case SW_RESTORE:
-                showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
-                break;
-        case SW_MINIMIZE:
-                showstate = SWPOS_MINIMIZE;
-                break;
-        case SW_SHOWMAXIMIZED:
-                showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
-                break;
-        case SW_SHOWMINIMIZED:
-                showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
-                break;
-        case SW_SHOWMINNOACTIVE:
-                showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
-                break;
-        case SW_SHOWNA:
-                showstate = SWPOS_SHOW;
-                break;
-        case SW_SHOWNOACTIVATE:
-                showstate = SWPOS_SHOW;
-                break;
-        case SW_SHOWNORMAL:
-                showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
-                break;
+    case SW_SHOW:
+    case SW_SHOWDEFAULT: //todo
+        showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
+    case SW_HIDE:
+        showstate = SWPOS_HIDE;
+        break;
+    case SW_RESTORE:
+        showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
+    case SW_MINIMIZE:
+        showstate = SWPOS_MINIMIZE;
+        break;
+    case SW_SHOWMAXIMIZED:
+        showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
+    case SW_SHOWMINIMIZED:
+        showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
+        break;
+    case SW_SHOWMINNOACTIVE:
+        showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
+        break;
+    case SW_SHOWNA:
+        showstate = SWPOS_SHOW;
+        break;
+    case SW_SHOWNOACTIVATE:
+        showstate = SWPOS_SHOW;
+        break;
+    case SW_SHOWNORMAL:
+        showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
+        break;
   }
   return OSLibWinShowWindow(OS2HwndFrame, showstate);
@@ -1047,45 +1096,45 @@
 
   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();
-                }
-                else {
-                        dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
-                        hwndInsertAfter = 0;
-                }
-                break;
+    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();
+        }
+        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
+    setstate |= 0; //TODO
   if(fuFlags & SWP_FRAMECHANGED)
-        setstate |= 0; //TODO
+    setstate |= 0; //TODO
   if(fuFlags & SWP_HIDEWINDOW)
-        setstate &= ~SWPOS_ZORDER;
+    setstate &= ~SWPOS_ZORDER;
   if(fuFlags & SWP_NOACTIVATE)
-        setstate &= ~SWPOS_ACTIVATE;
+    setstate &= ~SWPOS_ACTIVATE;
   if(fuFlags & SWP_NOCOPYBITS)
-        setstate |= 0;          //TODO
+    setstate |= 0;      //TODO
   if(fuFlags & SWP_NOMOVE)
-        setstate &= ~SWPOS_MOVE;
+    setstate &= ~SWPOS_MOVE;
   if(fuFlags & SWP_NOSIZE)
-        setstate &= ~SWPOS_SIZE;
+    setstate &= ~SWPOS_SIZE;
   if(fuFlags & SWP_NOREDRAW)
-        setstate |= SWPOS_NOREDRAW;
+    setstate |= SWPOS_NOREDRAW;
   if(fuFlags & SWP_NOZORDER)
-        setstate &= ~SWPOS_ZORDER;
+    setstate &= ~SWPOS_ZORDER;
   if(fuFlags & SWP_SHOWWINDOW)
-        setstate |= SWPOS_SHOW;
+    setstate |= SWPOS_SHOW;
 
   return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
@@ -1103,5 +1152,5 @@
 {
   if(getParent()) {
-        return getParent()->getWindowHandle();
+    return getParent()->getWindowHandle();
   }
   else  return 0;
@@ -1120,5 +1169,5 @@
 
    if(hwndNewParent == 0) {//desktop window = parent
-        setParent(NULL);
+    setParent(NULL);
         OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
         return oldhwnd;
@@ -1139,5 +1188,5 @@
 {
   if(getParent()) {
-        return getParent()->getWindowHandle() == hwndParent;
+    return getParent()->getWindowHandle() == hwndParent;
   }
   else  return 0;
@@ -1156,9 +1205,9 @@
 BOOL Win32Window::UpdateWindow()
 {
-   OSRECTL rect;
+ RECT rect;
 
   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;
@@ -1183,40 +1232,40 @@
   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;
@@ -1255,5 +1304,5 @@
   if(CheckMagicDword(magic) && win32wnd)
   {
-        return win32wnd->getWindowHandle();
+    return win32wnd->getWindowHandle();
   }
   return hwndActive;
@@ -1325,5 +1374,5 @@
                 return oldval;
         case GWL_HWNDPARENT:
-                return SetParent((HWND)value);
+        return SetParent((HWND)value);
 
         case GWL_ID:
@@ -1410,9 +1459,9 @@
 
    if(HIWORD(hwnd) != 0x6800) {
-        return NULL;
+    return NULL;
    }
 
    if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) {
-        return window;
+    return window;
    }
    else return NULL;
@@ -1420,19 +1469,3 @@
 //******************************************************************************
 //******************************************************************************
-Win32Window *Win32Window::GetWindowFromOS2Handle(HWND hwnd)
-{
-   ULONG winHandle;
-   Win32Window *window;
-
-   //CB: returns index, not handle!
-   if(HMHandleTranslateToWin(hwnd,(PULONG)&winHandle) == NO_ERROR)
-   {
-     if (HMHandleTranslateToOS2(LOWORD(winHandle),(PULONG)&window) == NO_ERROR)
-     {
-       return window;
-     } else return NULL;
-   } else return NULL;
-}
-//******************************************************************************
-//******************************************************************************
 GenericObject *Win32Window::windows  = NULL;
Index: trunk/src/user32/new/win32wnd.h
===================================================================
--- trunk/src/user32/new/win32wnd.h	(revision 327)
+++ trunk/src/user32/new/win32wnd.h	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.9 1999-07-18 13:57:48 cbratschi Exp $ */
+/* $Id: win32wnd.h,v 1.10 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -21,63 +21,64 @@
 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 WM_WIN32_POSTMESSAGEA	0x4000
+#define WM_WIN32_POSTMESSAGEW	0x4001
 
 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  MsgQuit();
+	 ULONG  MsgClose();
          ULONG  MsgDestroy();
-         ULONG  MsgEnable(BOOL fEnable);
-         ULONG  MsgShow(BOOL fShow);
-         ULONG  MsgMove(ULONG xParent, ULONG yParent);
-         ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
+	 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  MsgButton(ULONG msg, ULONG x, ULONG y);
-         ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
-         ULONG  MsgEraseBackGround(ULONG hps);
-         ULONG  MsgSetText(LPSTR lpsz, LONG cch);
-
-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; };
-   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
-         void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
-
+	 ULONG  MsgSetFocus(HWND hwnd);
+	 ULONG  MsgKillFocus(HWND hwnd);
+	 ULONG  MsgButton(ULONG msg, ULONG x, ULONG y);
+	 ULONG  MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
+	 ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
+	 ULONG  MsgEraseBackGround(ULONG hps);
+	 ULONG  MsgSetText(LPSTR lpsz, LONG cch);
+
+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; };
+   Win32Window *getParent()			{ return (Win32Window *)ChildWindow::GetParent(); };
+	 void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
        WNDPROC  getWindowProc()                 { return win32wndproc; };
          void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
@@ -85,31 +86,30 @@
          void   setWindowId(DWORD id)           { windowId = id; };
 
-         DWORD  getFlags()                      { return flags; };
-         void   setFlags(DWORD newflags)        { flags = newflags; };
-
-         BOOL   SetMenu(ULONG hMenu);
-         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();
+	 DWORD  getFlags()			{ return flags; };
+	 void   setFlags(DWORD newflags)	{ flags = newflags; };
+
+	 BOOL   SetMenu(ULONG hMenu);
+	 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   BringWindowToTop();
+	 BOOL   EnableWindow(BOOL fEnable);
+ 	 BOOL   BringWindowToTop();
   static HWND   GetActiveWindow();
-
-         BOOL   IsWindow();
-         BOOL   IsWindowEnabled();
-         BOOL   IsWindowVisible();
-
-         BOOL   GetWindowRect(PRECT pRect);
-         int    GetWindowTextLengthA();
-         int    GetWindowTextA(LPSTR lpsz, int cch);
-         BOOL   SetWindowTextA(LPCSTR lpsz);
+	 BOOL   IsWindow();
+	 BOOL   IsWindowEnabled();
+	 BOOL   IsWindowVisible();
+
+	 BOOL   GetWindowRect(PRECT pRect);
+	 int    GetWindowTextLengthA();
+	 int    GetWindowTextA(LPSTR lpsz, int cch);
+ 	 BOOL   SetWindowTextA(LPCSTR lpsz);
 
        LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
@@ -125,47 +125,47 @@
 
 static Win32Window *GetWindowFromHandle(HWND hwnd);
-static Win32Window *GetWindowFromOS2Handle(HWND hwnd);
 
 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
+	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
+/////   Win32Window *parent;			//GWL_HWNDPARENT
+	ULONG	windowId;		//GWL_ID
+	ULONG	userData;		//GWL_USERDATA
 
          HWND   hwndLinkAfter;
         DWORD   flags;
-
-        BOOL    isIcon;
-
-   Win32Window *owner;
-
-        char   *windowName;
-        ULONG   wndNameLength;
-
-        char   *windowText;
-        ULONG   wndTextLength;
-
-        ULONG  *userWindowLong;
-        ULONG   nrUserWindowLong;
-
-        RECT    rectWindow;
-        RECT    rectClient;
+	DWORD   lastHitTestVal;		//Last value returned by WM_NCHITTEST handler
+
+	BOOL    isIcon;
+
+   Win32Window *owner;			
+
+	char   *windowName;
+	ULONG   wndNameLength;
+
+	char   *windowText;
+	ULONG   wndTextLength;
+	
+	ULONG  *userWindowLong;
+	ULONG	nrUserWindowLong;
+
+	RECT    rectWindow;
+	RECT    rectClient;
 
 Win32WndClass  *windowClass;
@@ -175,9 +175,9 @@
 private:
 #ifndef OS2_INCLUDED
-        BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
-
-        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
-
-        LONG  SendNCCalcSize(BOOL calcValidRect,
+	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,
@@ -186,7 +186,7 @@
      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
@@ -194,10 +194,20 @@
 
 
-#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_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
+
 
 #endif //__cplusplus
Index: trunk/src/user32/new/wingdi.cpp
===================================================================
--- trunk/src/user32/new/wingdi.cpp	(revision 327)
+++ trunk/src/user32/new/wingdi.cpp	(revision 328)
@@ -1,3 +1,3 @@
-/* $Id: wingdi.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
+/* $Id: wingdi.cpp,v 1.3 1999-07-18 14:39:35 sandervl Exp $ */
 /*
  * Win32 Window graphics apis for OS/2
@@ -23,18 +23,16 @@
 {
   Win32Window *window;
-  OSRECTL rect;
 
    window = Win32Window::GetWindowFromHandle(hwnd);
    if(!window) {
-        dprintf(("GetDC, window %x not found", hwnd));
-        return 0;
+	dprintf(("GetDC, window %x not found", hwnd));
+	return 0;
    }
    dprintf(("BeginPaint %X\n", hwnd));
-   if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &rect) == FALSE)
+   if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &lps->rcPaint) == FALSE)
    {
-        dprintf(("BeginPaint, NO update rectl"));
-        return 0;
+	dprintf(("BeginPaint, NO update rectl"));
+	return 0;
    }
-   MapOS2ToWin32Rectl(window->getOS2WindowHandle(),(PRECTLOS2)&rect,&lps->rcPaint);
    lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint);
 
@@ -57,6 +55,6 @@
    window = Win32Window::GetWindowFromHandle(hwnd);
    if(!window) {
-        dprintf(("GetDC, window %x not found", hwnd));
-        return 0;
+	dprintf(("GetDC, window %x not found", hwnd));
+	return 0;
    }
    dprintf(("GetDC %x", hwnd));
