Index: trunk/src/user32/new/makefile
===================================================================
--- trunk/src/user32/new/makefile	(revision 397)
+++ trunk/src/user32/new/makefile	(revision 398)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.21 1999-07-25 17:47:24 sandervl Exp $
+# $Id: makefile,v 1.22 1999-07-26 20:03:48 sandervl Exp $
 
 #
@@ -33,5 +33,5 @@
         oslibutil.obj oslibmsg.obj windlg.obj \
         winprop.obj wingdi.obj oslibgdi.obj winaccel.obj winscrollbar.obj \
-        nativerc.obj oslibres.obj winnonclient.obj
+        nativerc.obj oslibres.obj
 
 
@@ -109,5 +109,4 @@
 oslibres.obj:   oslibres.cpp oslibwin.h oslibres.h
 
-winnonclient.obj: winnonclient.cpp
 clipboard.obj:  clipboard.cpp
 
Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 397)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.20 1999-07-26 09:01:34 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.21 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -109,8 +109,10 @@
   if(dwStyle & WINWS_CAPTION)
         *OSFrameStyle |= FCF_TITLEBAR;
+  if(dwStyle & WINWS_DLGFRAME)
+        *OSFrameStyle |= FCF_DLGBORDER;
+  else
   if(dwStyle & WINWS_BORDER)
         *OSFrameStyle |= FCF_BORDER;
-  if(dwStyle & WINWS_DLGFRAME)
-        *OSFrameStyle |= FCF_DLGBORDER;
+
   if(dwStyle & WINWS_VSCROLL)
         *OSFrameStyle |= FCF_VERTSCROLL;
@@ -371,3 +373,11 @@
 //******************************************************************************
 //******************************************************************************
-
+BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
+{
+  pointl->x = 0;
+  pointl->y = 0;
+  return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
+}
+//******************************************************************************
+//******************************************************************************
+
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 397)
+++ trunk/src/user32/new/oslibwin.h	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.18 1999-07-26 09:01:34 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.19 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -12,4 +12,5 @@
 #ifndef __OSLIBWIN_H__
 #define __OSLIBWIN_H__
+#include <oslibgdi.h>
 
 #define OSLIB_HWND_DESKTOP      0
@@ -209,3 +210,5 @@
 BOOL  OSLibWinMinimizeWindow(HWND hwnd);
 
+BOOL  OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl);
+
 #endif //__OSLIBWIN_H__
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 397)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */
+/* $Id: win32wnd.cpp,v 1.24 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -44,4 +44,7 @@
     ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
 
+#define IS_OVERLAPPED(style) \
+    !(style & (WS_CHILD | WS_POPUP))
+
 //******************************************************************************
 //******************************************************************************
@@ -65,4 +68,5 @@
   isUnicode        = FALSE;
   fCreated         = FALSE;
+  fFirstShow       = TRUE;
 
   memset(windowNameA, 0, MAX_WINDOW_NAMELENGTH);
@@ -431,7 +435,8 @@
   maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
 
+  fCreated = TRUE; //Allow WM_SIZE messages now
   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 );
@@ -455,9 +460,9 @@
                 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
 #endif
-            fCreated = TRUE;
             SetLastError(0);
             return TRUE;
         }
   }
+  fCreated = FALSE;
   OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
   OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
@@ -473,5 +478,5 @@
  * state.
  */
-UINT Win32Window::MinMaximize(UINT16 cmd, LPRECT16 lpRect )
+UINT Win32Window::MinMaximize(UINT cmd, LPRECT lpRect )
 {
     UINT swpFlags = 0;
@@ -516,7 +521,5 @@
 
         case SW_MAXIMIZE:
-                CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
                 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
-                CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
 
          if( dwStyle & WS_MINIMIZE )
@@ -779,4 +782,10 @@
 ULONG Win32Window::MsgActivate(BOOL fActivate, HWND hwnd)
 {
+    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE)
+    {
+        if(!fActivate) {
+            return 1;
+        }
+    }
     return SendInternalMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd);
 }
@@ -815,4 +824,8 @@
 ULONG Win32Window::MsgSetFocus(HWND hwnd)
 {
+    if(hwnd == 0) {
+        //other app lost focus
+        SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
+    }
     return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
 }
@@ -821,4 +834,8 @@
 ULONG Win32Window::MsgKillFocus(HWND hwnd)
 {
+    if(hwnd == 0) {
+        //other app lost focus
+        SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
+    }
     return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
 }
@@ -872,4 +889,9 @@
                 return 1;
     }
+    if(win32msg == WM_MBUTTONDBLCLK || win32msg == WM_RBUTTONDBLCLK || win32msg == WM_LBUTTONDBLCLK) {
+        if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) {
+            return 1;
+        }
+    }
     SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(x, y)); //TODO:
     return SendInternalMessageA(win32msg, 0, MAKELONG(x, y));
@@ -1343,7 +1365,17 @@
  ULONG showstate = 0;
 
-  dprintf(("ShowWindow %x", nCmdShow));
-  switch(nCmdShow)
-  {
+    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;
+    }
+    switch(nCmdShow)
+    {
     case SW_SHOW:
     case SW_SHOWDEFAULT: //todo
@@ -1377,6 +1409,6 @@
         showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
         break;
-  }
-  return OSLibWinShowWindow(OS2HwndFrame, showstate);
+    }
+    return OSLibWinShowWindow(OS2HwndFrame, showstate);
 }
 //******************************************************************************
@@ -1391,5 +1423,5 @@
         hwndInsertAfter = HWNDOS_BOTTOM;
         break;
-    case HWND_TOPMOST: //TODO:
+    case HWND_TOPMOST: //TODO
     case HWND_NOTOPMOST: //TODO:
     case HWND_TOP:
@@ -1402,29 +1434,35 @@
             PRECT clientRect = window->getClientRect();
 
-#if 0
+#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
+            //Correct coordinates if parent is a frame window (border adjustment)
             //TODO: Not quite right (Solitaire child window placement slightly wrong)
-            if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
-            {
-                x += GetSystemMetrics(SM_CXDLGFRAME);
-                y -= GetSystemMetrics(SM_CYDLGFRAME);
-            }
-            else
-            {
-                if (HAS_THICKFRAME(window->getStyle()))
+            if (window->isFrameWindow() && !(fuFlags & SWP_NOMOVE)) {
+                if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
                 {
-                    x += GetSystemMetrics(SM_CXFRAME);
-                    y -= GetSystemMetrics(SM_CYFRAME);
+                    x += GetSystemMetrics(SM_CXDLGFRAME);
+                    y -= GetSystemMetrics(SM_CYDLGFRAME);
                 }
-                if (window->getStyle() & WS_BORDER)
+                else
                 {
-                    x += GetSystemMetrics(SM_CXBORDER);
-                    y -= GetSystemMetrics(SM_CYBORDER);
+                    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);
+                    }
                 }
             }
@@ -1615,10 +1653,4 @@
 //******************************************************************************
 //******************************************************************************
-BOOL Win32Window::BringWindowToTop()
-{
-  return SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
-}
-//******************************************************************************
-//******************************************************************************
 HWND Win32Window::GetActiveWindow()
 {
Index: trunk/src/user32/new/win32wnd.h
===================================================================
--- trunk/src/user32/new/win32wnd.h	(revision 397)
+++ trunk/src/user32/new/win32wnd.h	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.20 1999-07-26 09:01:34 sandervl Exp $ */
+/* $Id: win32wnd.h,v 1.21 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -88,4 +88,5 @@
 	 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); };
@@ -124,5 +125,4 @@
 	 BOOL   EnableWindow(BOOL fEnable);
 	 BOOL   CloseWindow();
- 	 BOOL   BringWindowToTop();
   static HWND   GetActiveWindow();
 	 BOOL   IsWindow();
@@ -199,4 +199,5 @@
 	BOOL    isIcon;
 	BOOL    fCreated;
+	BOOL    fFirstShow;
 
    Win32Window *owner;			
Index: trunk/src/user32/new/window.cpp
===================================================================
--- trunk/src/user32/new/window.cpp	(revision 397)
+++ trunk/src/user32/new/window.cpp	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: window.cpp,v 1.13 1999-07-26 09:01:34 sandervl Exp $ */
+/* $Id: window.cpp,v 1.14 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Win32 window apis for OS/2
@@ -316,13 +316,5 @@
 BOOL WIN32API BringWindowToTop(HWND hwnd)
 {
-  Win32Window *window;
-
-    window = Win32Window::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("BringWindowToTop, window %x not found", hwnd));
-        return 0;
-    }
-    dprintf(("BringWindowToTop %x", hwnd));
-    return window->BringWindowToTop();
+    return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
 }
 //******************************************************************************
@@ -605,11 +597,11 @@
 }
 //******************************************************************************
-//******************************************************************************
-BOOL WIN32API SetForegroundWindow(HWND arg1)
-{
-#ifdef DEBUG
-    WriteLog("USER32:  SetForegroundWindow\n");
-#endif
-    return O32_SetForegroundWindow(arg1);
+//TODO: Correct?
+//******************************************************************************
+BOOL WIN32API SetForegroundWindow(HWND hwnd)
+{
+    dprintf((" SetForegroundWindow %x", hwnd));
+
+    return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
 }
 //******************************************************************************
@@ -623,4 +615,22 @@
     dprintf(("USER32:  GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
     return rc;
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL  arg3)
+{
+#ifdef DEBUG
+    WriteLog("USER32:  AdjustWindowRect\n");
+#endif
+    return O32_AdjustWindowRect(arg1, arg2, arg3);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD  arg4)
+{
+#ifdef DEBUG
+    WriteLog("USER32:  AdjustWindowRectEx\n");
+#endif
+    return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
 }
 //******************************************************************************
@@ -692,11 +702,13 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API MoveWindow(HWND arg1, int arg2, int arg3, int arg4, int arg5, BOOL arg6)
-{
- BOOL rc;
-
-    rc = O32_MoveWindow(arg1, arg2, arg3, arg4, arg5, arg6);
-    dprintf(("USER32:  MoveWindow %X to (%d,%d) size (%d,%d), repaint = %d returned %d\n", arg1, arg2, arg3, arg4, arg5, arg6, rc));
-    return(rc);
+BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
+                          BOOL repaint )
+{
+    int flags = SWP_NOZORDER | SWP_NOACTIVATE;
+
+    if (!repaint) flags |= SWP_NOREDRAW;
+    dprintf(("MoveWindow: %04x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
+
+    return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
 }
 //******************************************************************************
Index: trunk/src/user32/new/windowmsg.cpp
===================================================================
--- trunk/src/user32/new/windowmsg.cpp	(revision 397)
+++ trunk/src/user32/new/windowmsg.cpp	(revision 398)
@@ -1,3 +1,3 @@
-/* $Id: windowmsg.cpp,v 1.7 1999-07-18 17:12:03 sandervl Exp $ */
+/* $Id: windowmsg.cpp,v 1.8 1999-07-26 20:03:49 sandervl Exp $ */
 /*
  * Win32 window message APIs for OS/2
@@ -122,4 +122,5 @@
 	return 0;
     }
+    dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam));
     return window->PostMessageA(msg, wParam, lParam);
 }
@@ -139,4 +140,5 @@
 	return 0;
     }
+    dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam));
     return window->PostMessageW(msg, wParam, lParam);
 }
