Index: trunk/src/user32/dc.cpp
===================================================================
--- trunk/src/user32/dc.cpp	(revision 3481)
+++ trunk/src/user32/dc.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: dc.cpp,v 1.54 2000-04-07 12:55:15 sandervl Exp $ */
+/* $Id: dc.cpp,v 1.55 2000-05-02 20:50:48 sandervl Exp $ */
 
 /*
@@ -803,4 +803,30 @@
 }
 //******************************************************************************
+//******************************************************************************
+int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
+{
+   BOOL isOwnDC = FALSE;
+   int rc;
+
+   if (hwnd)
+   {
+        Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
+        if(wnd == NULL) {
+                dprintf(("ERROR: ReleaseDC %x %x failed", hwnd, hdc));
+                return 0;
+        }
+        //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
+//      isOwnDC = wnd->isOwnDC() && wnd->getOwnDC();
+        isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
+   }
+   if (isOwnDC)
+      rc = TRUE;
+   else
+      rc = O32_ReleaseDC (0, hdc);
+
+   dprintf(("ReleaseDC %x %x", hwnd, hdc));
+   return (rc);
+}
+//******************************************************************************
 // This implementation of GetDCEx supports
 // DCX_WINDOW
@@ -961,4 +987,6 @@
    /* Something went wrong; clean up
     */
+   dprintf(("ERROR: GetDCEx hwnd %x (%x %x) FAILED!", hwnd, hrgn, flags));
+   DebugInt3();
    if (pHps)
    {
@@ -993,30 +1021,4 @@
   if (!hwnd) hwnd = GetDesktopWindow();
   return GetDCEx (hwnd, NULL, DCX_USESTYLE_W | DCX_WINDOW_W);
-}
-//******************************************************************************
-//******************************************************************************
-int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
-{
-   BOOL isOwnDC = FALSE;
-   int rc;
-
-   if (hwnd)
-   {
-        Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
-        if(wnd == NULL) {
-                dprintf(("ERROR: ReleaseDC %x %x failed", hwnd, hdc));
-                return 0;
-        }
-        //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
-//      isOwnDC = wnd->isOwnDC() && wnd->getOwnDC();
-        isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
-   }
-   if (isOwnDC)
-      rc = TRUE;
-   else
-      rc = O32_ReleaseDC (0, hdc);
-
-   dprintf(("ReleaseDC %x %x", hwnd, hdc));
-   return (rc);
 }
 //******************************************************************************
@@ -1040,10 +1042,4 @@
    else   dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw));
 
-   if (redraw & (RDW_FRAME_W | RDW_NOFRAME_W))
-   {
-        SetLastError(ERROR_NOT_SUPPORTED_W);
-        return FALSE;
-   }
-
    if (hwnd == NULLHANDLE)
    {
@@ -1076,5 +1072,10 @@
             return FALSE;
         }
-        hwnd = wnd->getOS2WindowHandle();
+	//TODO: If frame, exclude client window from update
+        if(redraw & RDW_FRAME_W) {
+		hwnd = wnd->getOS2FrameWindowHandle();
+	}
+	else   	hwnd = wnd->getOS2WindowHandle();
+
    }
 
Index: trunk/src/user32/loadres.cpp
===================================================================
--- trunk/src/user32/loadres.cpp	(revision 3481)
+++ trunk/src/user32/loadres.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: loadres.cpp,v 1.27 2000-04-29 18:28:36 sandervl Exp $ */
+/* $Id: loadres.cpp,v 1.28 2000-05-02 20:50:48 sandervl Exp $ */
 
 /*
@@ -468,4 +468,7 @@
                 hbitmap = CreateDIBitmap(hdc, &fix_info->bmiHeader, CBM_INIT,
                                          bits, fix_info, DIB_RGB_COLORS );
+		if(hbitmap == 0) {
+			dprintf(("LoadBitmapA: CreateDIBitmap failed!!"));
+		}
 //        }
         }
Index: trunk/src/user32/oslibmsgtranslate.cpp
===================================================================
--- trunk/src/user32/oslibmsgtranslate.cpp	(revision 3481)
+++ trunk/src/user32/oslibmsgtranslate.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsgtranslate.cpp,v 1.28 2000-04-15 15:11:13 sandervl Exp $ */
+/* $Id: oslibmsgtranslate.cpp,v 1.29 2000-05-02 20:50:49 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -194,4 +194,5 @@
 			win32wnd = win32wnd->getParent();
 		}
+		dprintf(("Rerouting mouse messages to parent %x of disabled window %x", win32wnd->getWindowHandle(), winMsg->hwnd));
 		fWasDisabled = TRUE;
 	}
@@ -246,4 +247,5 @@
 			win32wnd = win32wnd->getParent();
 		}
+		dprintf(("Rerouting mouse messages to parent %x of disabled window %x", win32wnd->getWindowHandle(), winMsg->hwnd));
 		fWasDisabled = TRUE;
 	}
@@ -636,5 +638,5 @@
 
         dprintf(("PM: WM_CHAR: %x %x %d %x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode));
-        dprintf(("PM: WM_CHAR: %x", flags));
+        dprintf(("PM: WM_CHAR: hwnd %x flags %x", win32wnd->getWindowHandle(), flags));
 
         // vitali add begin
Index: trunk/src/user32/uitools.cpp
===================================================================
--- trunk/src/user32/uitools.cpp	(revision 3481)
+++ trunk/src/user32/uitools.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: uitools.cpp,v 1.26 2000-02-23 17:05:17 cbratschi Exp $ */
+/* $Id: uitools.cpp,v 1.27 2000-05-02 20:50:49 sandervl Exp $ */
 /*
  * User Interface Functions
@@ -1614,10 +1614,11 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API DrawFocusRect( HDC arg1, const RECT *  arg2)
-{
-#ifdef DEBUG
-    WriteLog("USER32:  DrawFocusRect\n");
-#endif
-    return O32_DrawFocusRect(arg1, arg2);
+BOOL WIN32API DrawFocusRect( HDC hdc, const RECT *lpRect)
+{
+ BOOL rc;
+
+    rc = O32_DrawFocusRect(hdc, lpRect);
+    dprintf(("USER32:  DrawFocusRect %x %x returned %d", hdc, lpRect, rc));
+    return rc;
 }
 //******************************************************************************
@@ -1631,7 +1632,5 @@
   COLORREF oldFg,oldBg;
 
-#ifdef DEBUG
-  WriteLog("USER32:  DrawIcon\n");
-#endif
+  dprintf(("USER32:  DrawIcon\n"));
 
   if (!hDC || !hIcon)
@@ -1681,7 +1680,5 @@
   INT oldStretchMode;
 
-#ifdef DEBUG
-  WriteLog("USER32:  DrawIconEx\n");
-#endif
+  dprintf(("USER32:  DrawIconEx"));
 
   //CB: istepIfAniCur, DI_COMPAT ignored
Index: trunk/src/user32/user32.cpp
===================================================================
--- trunk/src/user32/user32.cpp	(revision 3481)
+++ trunk/src/user32/user32.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: user32.cpp,v 1.77 2000-04-07 10:01:16 sandervl Exp $ */
+/* $Id: user32.cpp,v 1.78 2000-05-02 20:50:50 sandervl Exp $ */
 
 /*
@@ -151,7 +151,8 @@
        (lprcSrc1->top >= lprcSrc2->bottom) || (lprcSrc2->top >= lprcSrc1->bottom))
     {
-      SetLastError(ERROR_INVALID_PARAMETER);
-      if (lprcDst) SetRectEmpty(lprcDst);
-      return FALSE;
+	//SvL: NT doesn't set the last error here
+      	//SetLastError(ERROR_INVALID_PARAMETER);
+      	if (lprcDst) SetRectEmpty(lprcDst);
+      	return FALSE;
     }
     if (lprcDst)
@@ -1222,5 +1223,4 @@
 SHORT WIN32API GetKeyState( int nVirtKey)
 {
-//SvL: Hehe. 32 MB logfile for Opera after a minute.
     dprintf2(("USER32:  GetKeyState %d\n", nVirtKey));
     return O32_GetKeyState(nVirtKey);
Index: trunk/src/user32/win32dlg.cpp
===================================================================
--- trunk/src/user32/win32dlg.cpp	(revision 3481)
+++ trunk/src/user32/win32dlg.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: win32dlg.cpp,v 1.47 2000-03-09 19:05:39 sandervl Exp $ */
+/* $Id: win32dlg.cpp,v 1.48 2000-05-02 20:50:51 sandervl Exp $ */
 /*
  * Win32 Dialog Code for OS/2
@@ -76,7 +76,12 @@
     if (dlgInfo.style & DS_SETFONT)
     {
-        /* The font height must be negative as it is a point size */
-        /* (see CreateFont() documentation in the Windows SDK).   */
-        hUserFont = CreateFontW(-(dlgInfo.pointSize*3)/2, 0, 0, 0,
+	  /* The font height must be negative as it is a point size */
+	  /* and must be converted to pixels first */
+          /* (see CreateFont() documentation in the Windows SDK).   */
+	HDC dc = GetDC(0);
+	int pixels = dlgInfo.pointSize * GetDeviceCaps(dc , LOGPIXELSY)/72;
+	ReleaseDC(0, dc);
+
+        hUserFont = CreateFontW(-pixels, 0, 0, 0,
                             dlgInfo.weight, dlgInfo.italic, FALSE,
                             FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY,
@@ -125,5 +130,5 @@
             INT dX, dY;
 
-            if( !(dlgInfo.style & DS_ABSALIGN) )
+            if( !(dlgInfo.style & DS_ABSALIGN) && owner)
                 ClientToScreen(owner, (POINT *)&rect );
 
@@ -232,6 +237,15 @@
         hwndFocus = GetNextDlgTabItem( getWindowHandle(), 0, FALSE );
 
-        if (SendInternalMessageA(WM_INITDIALOG, (WPARAM)hwndFocus, param))
-             SetFocus(hwndFocus);
+	HWND hwndPreInitFocus = GetFocus();
+        if(SendInternalMessageA(WM_INITDIALOG, (WPARAM)hwndFocus, param)) {
+          	SetFocus(hwndFocus);
+	}
+	else
+	{
+   	    	/* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
+	       	   but the focus has not changed, set the focus where we expect it. */
+            	if ( (getStyle() & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
+                	SetFocus( hwndFocus );
+	}
 
         if (dlgInfo.style & WS_VISIBLE && !(getStyle() & WS_VISIBLE))
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 3481)
+++ trunk/src/user32/win32wbase.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.181 2000-04-29 18:28:39 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.182 2000-05-02 20:50:51 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -2113,4 +2113,41 @@
         return TRUE;
     }
+#if 0
+    /* Fix redundant flags */
+    if(getStyle() & WS_VISIBLE) {
+        fuFlags &= ~SWP_SHOWWINDOW;
+    }
+    else
+    {
+	if (!(fuFlags & SWP_SHOWWINDOW)) 
+	      fuFlags |= SWP_NOREDRAW;
+	fuFlags &= ~SWP_HIDEWINDOW;
+    }
+
+    if(cx < 0) cx = 0; 
+    if(cy < 0) cy = 0;
+
+    if((rectWindow.right - rectWindow.left == cx) && (rectWindow.bottom - rectWindow.top == cy)) {
+        fuFlags |= SWP_NOSIZE;    /* Already the right size */
+    }
+
+    if((rectWindow.left == x) && (rectWindow.top == y)) {
+        fuFlags |= SWP_NOMOVE;    /* Already the right position */
+    }
+
+    if(getWindowHandle() == GetActiveWindow()) {
+        fuFlags |= SWP_NOACTIVATE;   /* Already active */
+    }
+    else 
+    if((getStyle() & (WS_POPUP | WS_CHILD)) != WS_CHILD )
+    {
+        if(!(fuFlags & SWP_NOACTIVATE)) /* Bring to the top when activating */
+        {
+            fuFlags &= ~SWP_NOZORDER;
+ 	    hwndInsertAfter = HWND_TOP;           
+        }
+    }
+#endif
+
     WINDOWPOS wpos;
     SWP swp, swpOld;
@@ -2196,5 +2233,4 @@
         FrameUpdateClient(this);
     }
-
     return (rc);
 }
Index: trunk/src/user32/window.cpp
===================================================================
--- trunk/src/user32/window.cpp	(revision 3481)
+++ trunk/src/user32/window.cpp	(revision 3482)
@@ -1,3 +1,3 @@
-/* $Id: window.cpp,v 1.62 2000-04-29 18:28:41 sandervl Exp $ */
+/* $Id: window.cpp,v 1.63 2000-05-02 20:50:53 sandervl Exp $ */
 /*
  * Win32 window apis for OS/2
@@ -465,5 +465,4 @@
         return 0;
     }
-    dprintf(("ShowWindow %x", hwnd));
     return window->ShowWindow(nCmdShow);
 }
@@ -868,4 +867,5 @@
  OSLIBPOINT point;
 
+    SetLastError(0);
     if(lpPoints == NULL || cPoints == 0) {
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -902,6 +902,6 @@
     if (!mapWin32Point(wndfrom,wndto,&point))
     {
-      SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-      return 0;
+      	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+      	return 0;
     }
 
@@ -919,5 +919,5 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API ScreenToClient (HWND hwnd, LPPOINT pt)
+BOOL WIN32API ScreenToClient(HWND hwnd, LPPOINT pt)
 {
     Win32BaseWindow *wnd;
@@ -929,6 +929,8 @@
     if (!wnd) {
         dprintf(("warning: ScreenToClient: window %x not found!", hwnd));
-        return (TRUE);
-    }
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        return FALSE;
+    }
+    SetLastError(0);
 #ifdef DEBUG
     POINT tmp = *pt;
