Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 322)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 323)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.7 1999-07-17 12:49:40 cbratschi Exp $ */
+/* $Id: oslibwin.cpp,v 1.8 1999-07-17 15:23:38 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -38,15 +38,14 @@
 //******************************************************************************
 HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
-                          char *pszName, ULONG x, ULONG y, ULONG cx, ULONG cy,
-                          HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
+                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
 {
  HWND  hwndClient;
  RECTL rectl;
 
+  if(pszName && *pszName == 0) {
+	pszName = NULL;
+  }
   if(hwndParent == 0) {
         hwndParent = HWND_DESKTOP;
-  }
-  if(WinQueryWindowRect(hwndParent, &rectl) == TRUE) {
-        y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
   }
   if(dwFrameStyle) {
@@ -59,7 +58,4 @@
                         WinSetWindowText(*hwndFrame, pszName);
                 }
-                WinSetWindowPos(*hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP,
-                                x, y, cx, cy, SWP_SIZE | SWP_MOVE);
-
                 return hwndClient;
         }
@@ -67,5 +63,5 @@
         return 0;
   }
-  hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy,
+  hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, 0, 0, 0, 0,
                                Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
                                NULL);
@@ -83,6 +79,9 @@
   if(dwStyle & WINWS_MINIMIZE)
         *OSWinStyle |= WS_MINIMIZED;
+//Done explicitely in CreateWindowExA
+#if 0
   if(dwStyle & WINWS_VISIBLE)
         *OSWinStyle |= WS_VISIBLE;
+#endif
   if(dwStyle & WINWS_DISABLED)
         *OSWinStyle |= WS_DISABLED;
@@ -178,4 +177,13 @@
                           LONG cy, ULONG fl)
 {
+ RECTL rectl;
+ HWND  hwndParent;
+
+  if(fl & SWP_MOVE) {
+        hwndParent = WinQueryWindow(hwnd, QW_PARENT);
+        if(WinQueryWindowRect(hwnd, &rectl)) {
+                y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
+	}
+  }
   return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
 }
@@ -184,5 +192,15 @@
 BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
 {
-  return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
+ BOOL rc;
+
+  if(fl & SWP_SHOW) {
+	 rc = WinShowWindow(hwnd, TRUE);
+  }
+  if(rc == 0)
+	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+  rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
+  if(rc == 0)
+	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+  return rc;
 }
 //******************************************************************************
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 322)
+++ trunk/src/user32/new/oslibwin.h	(revision 323)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.6 1999-07-17 12:49:41 cbratschi Exp $ */
+/* $Id: oslibwin.h,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -20,6 +20,5 @@
 
 HWND  OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
-                           char *pszName, ULONG x, ULONG y, ULONG cx, ULONG cy,
-                           HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
+                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
 
 BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 322)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 323)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.5 1999-07-17 09:17:58 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.6 1999-07-17 15:23:38 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -35,7 +35,9 @@
 {
   hab = WinInitialize(0);
+  dprintf(("Winitialize returned %x", hab));
   hmq = WinCreateMsgQueue(hab, 0);
 
-  if(!hab || !hmq) {
+  if(!hab || !hmq) 
+  {
         UINT error;
 
@@ -44,13 +46,21 @@
         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
         {
-          //CB: get queue handle (todo)
+		if(!hab) {
+         		hab = WinQueryAnchorBlock(HWND_DESKTOP);
+			dprintf(("WinQueryAnchorBlock returned %x", hab));
+		}
+		if(!hmq) {
+			hmq = HMQ_CURRENT;
+		}
         }
   }
   SetThreadHAB(hab);
+  dprintf(("InitPM: hmq = %x", hmq));
   SetThreadMessageQueue(hmq);
 
@@ -113,7 +123,10 @@
     case WM_CREATE:
         //Processing is done in after WinCreateWindow returns
-        break;
+	dprintf(("OS2: WM_CREATE %x", hwnd));
+	RestoreOS2TIB();
+	return (MRESULT)FALSE;
 
     case WM_QUIT:
+	dprintf(("OS2: WM_QUIT %x", hwnd));
         if(win32wnd->MsgQuit()) {
                 goto RunDefWndProc;
@@ -122,4 +135,5 @@
 
     case WM_CLOSE:
+	dprintf(("OS2: WM_CLOSE %x", hwnd));
         if(win32wnd->MsgClose()) {
                 goto RunDefWndProc;
@@ -128,4 +142,5 @@
 
     case WM_DESTROY:
+	dprintf(("OS2: WM_DESTROY %x", hwnd));
         if(win32wnd->MsgDestroy()) {
                 goto RunDefWndProc;
@@ -134,4 +149,5 @@
 
     case WM_ENABLE:
+	dprintf(("OS2: WM_ENABLE %x", hwnd));
         if(win32wnd->MsgEnable((ULONG)mp1)) {
                 goto RunDefWndProc;
@@ -140,4 +156,5 @@
 
     case WM_SHOW:
+	dprintf(("OS2: WM_SHOW %x", hwnd));
         if(win32wnd->MsgShow((ULONG)mp1)) {
                 goto RunDefWndProc;
@@ -152,4 +169,5 @@
      ULONG  xScreen, yScreen, yParent, xParent;
 
+	dprintf(("OS2: WM_MOVE %x", hwnd));
         rc = WinQueryWindowRect(hwnd, &rectl);
         if(rc == TRUE) {
@@ -169,5 +187,5 @@
                                 break;
                         }
-                        yParent = point.x;
+                        xParent = point.x;
                         yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);
                 }
@@ -207,5 +225,8 @@
     case WM_ADJUSTWINDOWPOS:
     {
-//      if(win32wnd->MsgWindowPosChanging(0, 0)) {
+	dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
+//      	if(win32wnd->MsgWindowPosChanging(0, 0)) {
+                goto RunDefWndProc;
+//	}
         break;
     }
@@ -215,4 +236,5 @@
      HPS hps;
 
+	dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
         hps = WinGetPS(hwnd);
         if(win32wnd->MsgEraseBackGround((ULONG)hps))
@@ -232,4 +254,5 @@
      SWP swp;
 
+	dprintf(("OS2: WM_SIZE %x", hwnd));
         rc = WinQueryWindowPos(hwnd, &swp);
         if(rc == FALSE) {
@@ -251,4 +274,5 @@
       HWND hwndActivate = (HWND)mp1;
 
+	dprintf(("OS2: WM_ACTIVATE %x", hwnd));
         if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
                 //another (non-win32) application's window
@@ -268,4 +292,5 @@
       HWND hwndFocus = (HWND)mp1;
 
+	dprintf(("OS2: WM_SETFOCUS %x", hwnd));
         if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
                 //another (non-win32) application's window
@@ -360,4 +385,5 @@
 
     case WM_PAINT:
+	dprintf(("OS2: WM_PAINT %x", hwnd));
         if(win32wnd->MsgPaint(0, 0)) {
                 goto RunDefWndProc;
@@ -393,4 +419,5 @@
         break;
     default:
+	dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
         RestoreOS2TIB();
         return WinDefWindowProc( hwnd, msg, mp1, mp2 );
@@ -400,4 +427,5 @@
 
 RunDefWndProc:
+  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 322)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 323)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.6 1999-07-17 11:52:23 sandervl Exp $ */
+/* $Id: win32wnd.cpp,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -72,5 +72,4 @@
   Win32Hwnd        = 0;
 
-  //CB: what does this code? Win32Hwnd is always 0!
   if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0)
   {
@@ -335,7 +334,7 @@
   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0,
                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
-                                 cs->x, cs->y, cs->cx, cs->cy,
                                  (owner) ? owner->getOS2WindowHandle() : 0,
-                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, &OS2HwndFrame);
+				 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
+                                 &OS2HwndFrame);
 
   if(OS2Hwnd == 0) {
@@ -351,4 +350,5 @@
         return FALSE;
   }
+#if 0
   if(OS2Hwnd != OS2HwndFrame) {
   	if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
@@ -361,4 +361,5 @@
   	}
   }
+#endif
   /* Set the window menu */
   if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
@@ -389,50 +390,8 @@
         if( (sendMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
         {
-            /* Send the size messages */
-	    dprintf(("Sent WM_CREATE"));
-
-            if (!(flags & WIN_NEED_SIZE))
-            {
-                /* send it anyway */
-	        if (((rectClient.right-rectClient.left) <0)
-		    ||((rectClient.bottom-rectClient.top)<0))
-		  dprintf(("sending bogus WM_SIZE message 0x%08lx\n",
-			MAKELONG(rectClient.right-rectClient.left,
-				 rectClient.bottom-rectClient.top)));
-                SendMessageA(WM_SIZE, SIZE_RESTORED,
-                                MAKELONG(rectClient.right-rectClient.left,
-                                         rectClient.bottom-rectClient.top));
-                SendMessageA(WM_MOVE, 0,
-                                MAKELONG( rectClient.left,
-                                          rectClient.top ) );
-            }
-
-#if 0
-            /* Show the window, maximizing or minimizing if needed */
-
-            if (dwStyle & (WS_MINIMIZE | WS_MAXIMIZE))
-            {
-		RECT16 newPos;
-		UINT16 swFlag = (dwStyle & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
-                dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE);
-		WINPOS_MinMaximize(swFlag, &newPos );
-                swFlag = ((dwStyle & WS_CHILD) || GetActiveWindow())
-                    ? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
-                    : SWP_NOZORDER | SWP_FRAMECHANGED;
-                SetWindowPos(0, newPos.left, newPos.top,
-                             newPos.right, newPos.bottom, swFlag );
-            }
-#endif
-
-	    if( dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
-	    {
-		/* Notify the parent window only */
-
-		NotifyParent(WM_CREATE, 0, 0);
-                if( !IsWindow() )
-                {
-                    return FALSE;
-	        }
-	    }
+            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
+			 rectClient.right-rectClient.left, 
+			 rectClient.bottom-rectClient.top,
+			 SWP_NOACTIVATE);
 
             if (cs->style & WS_VISIBLE) ShowWindow( sw );
@@ -802,13 +761,13 @@
                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
                         dprintf(("WM_NCCREATE returned FALSE\n"));
-                        return(0); //don't create window
+                        return(-1); //don't create window
                 }
-                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
-                        dprintf(("WM_CREATE returned FALSE\n"));
-                        return(0); //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(1);
+                return(0);
         }
         case WM_LBUTTONDOWN:
@@ -952,32 +911,35 @@
 	case SW_SHOW:
 	case SW_SHOWDEFAULT: //todo
-		showstate = SWPOS_SHOW;
+		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;
+		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_SHOWMINNOACTIVE:  //TODO
-		showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
-		break;
-	case SW_SHOWNA: //TODO
+	case SW_SHOWNA:
 		showstate = SWPOS_SHOW;
 		break;
-	case SW_SHOWNOACTIVATE:  //TODO
+	case SW_SHOWNOACTIVATE:
 		showstate = SWPOS_SHOW;
 		break;
 	case SW_SHOWNORMAL:
-		showstate = SWPOS_RESTORE;
-		break;
-  }
-  return OSLibWinShowWindow(OS2HwndFrame, showstate);
+		showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
+		break;
+  }
+  return OSLibWinShowWindow(OS2Hwnd, showstate);
 }
 //******************************************************************************
@@ -1031,5 +993,5 @@
 	setstate |= SWPOS_SHOW;
 
-  return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
+  return OSLibWinSetWindowPos(OS2Hwnd, hwndInsertAfter, x, y, cx, cy, setstate);
 }
 //******************************************************************************
@@ -1110,5 +1072,5 @@
 BOOL Win32Window::IsIconic()
 {
-  return OSLibWinIsIconic(OS2HwndFrame);
+  return OSLibWinIsIconic(OS2Hwnd);
 }
 //******************************************************************************
@@ -1152,5 +1114,5 @@
 		else 	return 0;
   }
-  hwndRelated = OSLibWinQueryWindow(OS2HwndFrame, getcmd);
+  hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
   if(hwndRelated) 
   {
@@ -1168,5 +1130,5 @@
 HWND Win32Window::SetActiveWindow()
 {
-  return OSLibWinSetActiveWindow(OS2HwndFrame);
+  return OSLibWinSetActiveWindow(OS2Hwnd);
 }
 //******************************************************************************
@@ -1175,5 +1137,5 @@
 BOOL Win32Window::EnableWindow(BOOL fEnable)
 {
-  return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
+  return OSLibWinEnableWindow(OS2Hwnd, fEnable);
 }
 //******************************************************************************
