Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 326)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.10 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.11 1999-07-18 13:57:47 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -46,5 +46,5 @@
 
   if(pszName && *pszName == 0) {
-	pszName = NULL;
+        pszName = NULL;
   }
   if(hwndParent == 0) {
@@ -53,6 +53,6 @@
   if(dwFrameStyle) {
         dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
-	if(pszName)
-		dwFrameStyle |= FCF_TITLEBAR;
+        if(pszName)
+                dwFrameStyle |= FCF_TITLEBAR;
 
         *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
@@ -60,7 +60,7 @@
                                        "", 0, 0, 0, &hwndClient);
         if(*hwndFrame) {
-		if(pszName) {
-			WinSetWindowText(*hwndFrame, pszName);
-		}
+                if(pszName) {
+                        WinSetWindowText(*hwndFrame, pszName);
+                }
                 return hwndClient;
         }
@@ -161,4 +161,58 @@
 //******************************************************************************
 //******************************************************************************
+HWND OSLibWinQueryFocus(HWND hwndDeskTop)
+{
+  return WinQueryFocus(hwndDeskTop);
+}
+//******************************************************************************
+//******************************************************************************
+HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
+{
+  return WinWindowFromID(hwndParent,id);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus)
+{
+  return WinSetFocus(hwndDeskTop,hwndNewFocus);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG OSLibGetWindowHeight(HWND hwnd)
+{
+  RECTL rect;
+
+  return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren)
+{
+  return WinInvalidateRect(hwnd,(PRECTL)pwrc,fIncludeChildren);
+}
+//******************************************************************************
+//******************************************************************************
+LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
+{
+  return WinQuerySysValue(hwndDeskTop,iSysValue);
+}
+//******************************************************************************
+//******************************************************************************
+ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
+{
+  return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
+{
+  return WinSetDlgItemText(hwndDlg,idItem,pszText);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
+{
+  return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
+}
 //******************************************************************************
 //******************************************************************************
@@ -173,5 +227,5 @@
 {
   if(fl & SWP_MOVE) {
-	y = MapOS2ToWin32Y(hwnd, cy, y);
+        y = MapOS2ToWin32Y(hwnd, cy, y);
   }
   dprintf(("WinSetWindowPos %x %x %d %d %d %d %x", hwnd, hwndInsertBehind, x, y, cx, cy, fl));
@@ -185,11 +239,11 @@
 
   if(fl & SWP_SHOW) {
-	 rc = WinShowWindow(hwnd, TRUE);
+         rc = WinShowWindow(hwnd, TRUE);
   }
   if(rc == 0)
-	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
   rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl);
   if(rc == 0)
-	dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
+        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
   return rc;
 }
@@ -202,14 +256,8 @@
 //******************************************************************************
 //******************************************************************************
-BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)
-{
- BOOL rc;
- RECTLOS2 rectl;
-
-  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
-  if(rc) {
-	MapOS2ToWin32Rectl(hwnd, &rectl, pRect);
-  }
-  return rc;
+BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect)
+{
+  return WinQueryUpdateRect(hwnd, (PRECTL)pRect);
+  //CB: caller must convert rect
 }
 //******************************************************************************
Index: trunk/src/user32/new/oslibwin.h
===================================================================
--- trunk/src/user32/new/oslibwin.h	(revision 326)
+++ trunk/src/user32/new/oslibwin.h	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.9 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.10 1999-07-18 13:57:47 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -29,11 +29,134 @@
 HWND  OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate);
 
-#define WA_WARNING                 0
-#define WA_NOTE                    1
-#define WA_ERROR                   2
-#define WA_CWINALARMS             13     /* count of valid alarms     53304*/
+#define WAOS_WARNING                 0
+#define WAOS_NOTE                    1
+#define WAOS_ERROR                   2
+#define WAOS_CWINALARMS             13     /* count of valid alarms     53304*/
 
 BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle);
 ULONG OSLibDosBeep(ULONG freg,ULONG dur);
+HWND OSLibWinQueryFocus(HWND hwndDeskTop);
+HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id);
+BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus);
+ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation
+
+typedef struct _OSRECTL
+{
+  LONG xLeft;
+  LONG yBottom;
+  LONG xRight;
+  LONG yTop;
+} OSRECTL;
+
+typedef OSRECTL *POSRECTL;
+
+BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren); //must be RECTL pointer!
+
+//reserved deleted
+
+#define SVOS_SWAPBUTTON              0
+#define SVOS_DBLCLKTIME              1
+#define SVOS_CXDBLCLK                2
+#define SVOS_CYDBLCLK                3
+#define SVOS_CXSIZEBORDER            4
+#define SVOS_CYSIZEBORDER            5
+#define SVOS_ALARM                   6
+#define SVOS_CURSORRATE              9
+#define SVOS_FIRSTSCROLLRATE         10
+#define SVOS_SCROLLRATE              11
+#define SVOS_NUMBEREDLISTS           12
+#define SVOS_WARNINGFREQ             13
+#define SVOS_NOTEFREQ                14
+#define SVOS_ERRORFREQ               15
+#define SVOS_WARNINGDURATION         16
+#define SVOS_NOTEDURATION            17
+#define SVOS_ERRORDURATION           18
+#define SVOS_CXSCREEN                20
+#define SVOS_CYSCREEN                21
+#define SVOS_CXVSCROLL               22
+#define SVOS_CYHSCROLL               23
+#define SVOS_CYVSCROLLARROW          24
+#define SVOS_CXHSCROLLARROW          25
+#define SVOS_CXBORDER                26
+#define SVOS_CYBORDER                27
+#define SVOS_CXDLGFRAME              28
+#define SVOS_CYDLGFRAME              29
+#define SVOS_CYTITLEBAR              30
+#define SVOS_CYVSLIDER               31
+#define SVOS_CXHSLIDER               32
+#define SVOS_CXMINMAXBUTTON          33
+#define SVOS_CYMINMAXBUTTON          34
+#define SVOS_CYMENU                  35
+#define SVOS_CXFULLSCREEN            36
+#define SVOS_CYFULLSCREEN            37
+#define SVOS_CXICON                  38
+#define SVOS_CYICON                  39
+#define SVOS_CXPOINTER               40
+#define SVOS_CYPOINTER               41
+#define SVOS_DEBUG                   42
+#define SVOS_CMOUSEBUTTONS           43
+#define SVOS_CPOINTERBUTTONS         43
+#define SVOS_POINTERLEVEL            44
+#define SVOS_CURSORLEVEL             45
+#define SVOS_TRACKRECTLEVEL          46
+#define SVOS_CTIMERS                 47
+#define SVOS_MOUSEPRESENT            48
+#define SVOS_CXBYTEALIGN             49
+#define SVOS_CXALIGN                 49
+#define SVOS_CYBYTEALIGN             50
+#define SVOS_CYALIGN                 50
+
+/* The following value enables any greater value to be set by WinSetSysValue. */
+/* This is to enable the setting of SV_EXTRAKEYBEEP by applications.          */
+
+#define SVOS_NOTRESERVED             56
+#define SVOS_EXTRAKEYBEEP            57
+
+/* The following system value controls whether PM controls the keyboard      */
+/* lights for light key keystrokes (else applications will)                  */
+#define SVOS_SETLIGHTS               58
+#define SVOS_INSERTMODE              59
+
+#define SVOS_MENUROLLDOWNDELAY       64
+#define SVOS_MENUROLLUPDELAY         65
+#define SVOS_ALTMNEMONIC             66
+#define SVOS_TASKLISTMOUSEACCESS     67
+#define SVOS_CXICONTEXTWIDTH         68
+#define SVOS_CICONTEXTLINES          69
+#define SVOS_CHORDTIME               70
+#define SVOS_CXCHORD                 71
+#define SVOS_CYCHORD                 72
+#define SVOS_CXMOTIONSTART           73
+#define SVOS_CYMOTIONSTART           74
+#define SVOS_BEGINDRAG               75
+#define SVOS_ENDDRAG                 76
+#define SVOS_SINGLESELECT            77
+#define SVOS_OPEN                    78
+#define SVOS_CONTEXTMENU             79
+#define SVOS_CONTEXTHELP             80
+#define SVOS_TEXTEDIT                81
+#define SVOS_BEGINSELECT             82
+#define SVOS_ENDSELECT               83
+#define SVOS_BEGINDRAGKB             84
+#define SVOS_ENDDRAGKB               85
+#define SVOS_SELECTKB                86
+#define SVOS_OPENKB                  87
+#define SVOS_CONTEXTMENUKB           88
+#define SVOS_CONTEXTHELPKB           89
+#define SVOS_TEXTEDITKB              90
+#define SVOS_BEGINSELECTKB           91
+#define SVOS_ENDSELECTKB             92
+#define SVOS_ANIMATION               93
+#define SVOS_ANIMATIONSPEED          94
+#define SVOS_MONOICONS               95
+#define SVOS_KBDALTERED              96
+#define SVOS_PRINTSCREEN             97
+#define SVOS_LOCKSTARTINPUT          98
+#define SVOS_CSYSVALUES              108
+
+LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue);
+ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer);
+BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText);
+BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint); //pptlPoint == POINTL pointer!
 
 #define SWPOS_SIZE                   0x0001
@@ -61,5 +184,5 @@
 
 BOOL  OSLibWinDestroyWindow(HWND hwnd);
-BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);
+BOOL  OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect); //must be RECTL pointer!
 BOOL  OSLibWinIsIconic(HWND hwnd);
 BOOL  OSLibWinSetActiveWindow(HWND hwnd);
Index: trunk/src/user32/new/user32.cpp
===================================================================
--- trunk/src/user32/new/user32.cpp	(revision 326)
+++ trunk/src/user32/new/user32.cpp	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: user32.cpp,v 1.5 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: user32.cpp,v 1.6 1999-07-18 13:57:47 cbratschi Exp $ */
 
 /*
@@ -19,4 +19,11 @@
  *****************************************************************************/
 
+/*
+  CB:
+  - don't replace GDI functions (hdc), only convert window handle
+  - always use OSRECTL for PM functions
+  - POINT == POINTL
+*/
+
 #include <os2win.h>
 #include "misc.h"
@@ -31,4 +38,5 @@
 #include <string.h>
 #include <oslibwin.h>
+#include <win32wnd.h>
 
 //undocumented stuff
@@ -69,6 +77,52 @@
 // WIN32API YieldTask
 
-
-
+//Window handle transformation
+
+inline HWND Win32ToOS2Handle(HWND hwnd)
+{
+  Win32Window *window;
+
+  window = Win32Window::GetWindowFromHandle(hwnd);
+  if (window) return window->getOS2WindowHandle();
+  else return hwnd; //already OS/2 handle?
+}
+
+inline HWND OS2ToWin32Handle(HWND hwnd)
+{
+  Win32Window *window;
+
+  window = Win32Window::GetWindowFromOS2Handle(hwnd);
+  if (window) return window->getWindowHandle();
+  else return hwnd; //OS/2 window
+}
+
+//Coordinate transformation
+
+inline void Win32ToOS2Rect(POSRECTL dest,PRECT source,ULONG windowH)
+{
+  dest->xLeft   = source->left;
+  dest->xRight  = source->right;
+  dest->yTop    = windowH-source->top;
+  dest->yBottom = windowH-source->bottom;
+}
+
+inline void OS2ToWin32Rect(PRECT dest,POSRECTL source,ULONG windowH)
+{
+  dest->left   = source->xLeft;
+  dest->right  = source->xRight;
+  dest->top    = windowH-source->yTop;
+  dest->bottom = windowH-source->yBottom;
+}
+
+inline void OS2ToWin32ScreenPos(POINT *dest,POINT *source)
+{
+  dest->x = source->x;
+  dest->y = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN)-source->y;
+}
+
+inline void Win32ToOS2ScreenPos(POINT *dest,POINT *source)
+{
+  OS2ToWin32ScreenPos(dest,source); //transform back
+}
 
 //******************************************************************************
@@ -185,5 +239,5 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API MessageBeep( UINT arg1)
+BOOL WIN32API MessageBeep( UINT uType)
 {
     INT flStyle;
@@ -193,5 +247,5 @@
 #endif
 
-    switch (arg1)
+    switch (uType)
     {
       case 0xFFFFFFFF:
@@ -199,20 +253,21 @@
         return TRUE;
       case MB_ICONASTERISK:
-        flStyle = WA_NOTE;
+        flStyle = WAOS_NOTE;
         break;
       case MB_ICONEXCLAMATION:
-        flStyle = WA_WARNING;
+        flStyle = WAOS_WARNING;
         break;
       case MB_ICONHAND:
       case MB_ICONQUESTION:
       case MB_OK:
-        flStyle = WA_NOTE;
+        flStyle = WAOS_NOTE;
         break;
       default:
-        flStyle = WA_ERROR; //CB: should be right
+        flStyle = WAOS_ERROR; //CB: should be right
         break;
     }
-    return OSLibWinAlarm(HWND_DESKTOP,flStyle);
-}
+    return OSLibWinAlarm(OSLIB_HWND_DESKTOP,flStyle);
+}
+//******************************************************************************
 //******************************************************************************
 
@@ -231,14 +286,13 @@
     return GetWindowTextW(hwnd,lpString,nMaxCount);
 }
-
-
-//******************************************************************************
 //******************************************************************************
 //******************************************************************************
 HWND WIN32API GetFocus(void)
 {
+    HWND hwnd;
 //    dprintf(("USER32:  GetFocus\n"));
-    //return OS2LibWinQueryFocus(HWND_DESKTOP);
-    return O32_GetFocus();
+
+    hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
+    return OS2ToWin32Handle(hwnd);
 }
 //******************************************************************************
@@ -247,6 +301,5 @@
 {
     dprintf(("USER32:  GetDesktopWindow\n"));
-    //return HWND_DESKTOP //CB: WinQueryDesktopWindow();, hab and hdc not available!
-    return O32_GetDesktopWindow();
+    return OSLIB_HWND_DESKTOP;
 }
 //******************************************************************************
@@ -258,5 +311,5 @@
 
   dprintf(("USER32:  EnumThreadWindows\n"));
-  //replace
+  //CB: replace
   rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback);
   if(callback)
@@ -271,5 +324,4 @@
 ////    WriteLog("USER32:  OffsetRect\n");
 #endif
-    //CB: inc values
     if (lprc)
     {
@@ -295,50 +347,70 @@
 //******************************************************************************
 //******************************************************************************
-HWND WIN32API SetFocus( HWND arg1)
-{
+HWND WIN32API SetFocus( HWND hwnd)
+{
+    HWND lastFocus;
+
     dprintf(("USER32:  SetFocus\n"));
-    //return OSLibWinSetFocus(HWND_DESKTOP,arg1);
-    return O32_SetFocus(arg1);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API InvalidateRect(HWND arg1, const RECT *arg2, BOOL arg3)
-{
-#ifdef DEBUG
-    if(arg2)
-        WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", arg1, arg2->left, arg2->top, arg2->right, arg2->bottom, arg3);
-    else    WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", arg1, arg3);
-#endif
-    //return OSLibWinInvalidateRect(arg1,arg2,arg3);
-    return O32_InvalidateRect(arg1, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API GetUpdateRect( HWND arg1, PRECT arg2, BOOL  arg3)
-{
+
+    lastFocus = GetFocus();
+    hwnd = Win32ToOS2Handle(hwnd);
+    return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP,hwnd)) ? lastFocus:0;
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
+{
+#ifdef DEBUG
+    if(lpRect)
+        WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
+    else    WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
+#endif
+
+    //CB: bErase no quite the same
+    hWnd = Win32ToOS2Handle(hWnd);
+    if (lpRect)
+    {
+      OSRECTL rect;
+      ULONG windowH;
+
+      windowH = OSLibGetWindowHeight(hWnd);
+      Win32ToOS2Rect(&rect,(PRECT)lpRect,windowH);
+      return OSLibWinInvalidateRect(hWnd,&rect,bErase); //rect == RECTL
+    } else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API GetUpdateRect( HWND hWnd, PRECT lpRect, BOOL  bErase)
+{
+    OSRECTL rect;
+    ULONG windowH;
+    BOOL rc;
+
 #ifdef DEBUG
     WriteLog("USER32:  GetUpdateRect\n");
 #endif
-    // OSLibWinQueryUpdateRect(arg1,arg2);
-    // translate top,bottom
-    return O32_GetUpdateRect(arg1, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-int WIN32API GetSystemMetrics(int arg1)
-{
- int rc;
-
-   switch(arg1) {
+    if (!lpRect) return FALSE;
+    hWnd = Win32ToOS2Handle(hWnd);
+    rc = OSLibWinQueryUpdateRect(hWnd,&rect);
+    windowH = OSLibGetWindowHeight(hWnd);
+    OS2ToWin32Rect(lpRect,&rect,windowH);
+    return rc;
+}
+//******************************************************************************
+//******************************************************************************
+int WIN32API GetSystemMetrics(int nIndex)
+{
+   int rc = 0;
+
+   switch(nIndex) {
     case SM_CXICONSPACING: //TODO: size of grid cell for large icons
-        //rc = OSLibWinQuerySysValue(HWND_DESKTOP,SV_CXICON);
-        //CB: better: return standard windows icon size
-        rc = 32;
+        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXICON);
+        //CB: return standard windows icon size?
+        //rc = 32;
         break;
     case SM_CYICONSPACING:
+        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYICON);
         //read SM_CXICONSPACING comment
-        rc = 32;
+        //rc = 32;
         break;
     case SM_PENWINDOWS:
@@ -355,7 +427,9 @@
         break;
     case SM_CXMINSPACING: //can be SM_CXMINIMIZED or larger
+        //CB: replace with const
         rc = O32_GetSystemMetrics(SM_CXMINIMIZED);
         break;
     case SM_CYMINSPACING:
+        //CB: replace with const
         rc = GetSystemMetrics(SM_CYMINIMIZED);
         break;
@@ -390,9 +464,9 @@
     case SM_CXMAXTRACK: //max window size
     case SM_CXMAXIMIZED:    //max toplevel window size
-        rc = O32_GetSystemMetrics(SM_CXSCREEN);
+        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXSCREEN);
         break;
     case SM_CYMAXTRACK:
     case SM_CYMAXIMIZED:
-        rc = O32_GetSystemMetrics(SM_CYSCREEN);
+        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN);
         break;
     case SM_NETWORK:
@@ -415,5 +489,5 @@
         break;
     case SM_CYMENUCHECK:
-        rc = O32_GetSystemMetrics(SM_CYMENU);
+        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYMENU);
         break;
     case SM_SLOWMACHINE:
@@ -424,12 +498,14 @@
         break;
     case SM_CMETRICS:
+        //CB: replace with const
         rc = O32_GetSystemMetrics(44);  //Open32 changed this one
         break;
     default:
-        rc = O32_GetSystemMetrics(arg1);
+        //better than nothing
+        rc = O32_GetSystemMetrics(nIndex);
         break;
     }
 #ifdef DEBUG
-    WriteLog("USER32:  GetSystemMetrics %d returned %d\n", arg1, rc);
+    WriteLog("USER32:  GetSystemMetrics %d returned %d\n", nIndex, rc);
 #endif
     return(rc);
@@ -437,31 +513,41 @@
 //******************************************************************************
 //******************************************************************************
-UINT WIN32API SetTimer( HWND arg1, UINT arg2, UINT arg3, TIMERPROC  arg4)
+UINT WIN32API SetTimer( HWND hwnd, UINT idTimer, UINT uTimeout, TIMERPROC  tmprc)
 {
 #ifdef DEBUG
     WriteLog("USER32: SetTimer INCORRECT CALLING CONVENTION FOR HANDLER!!!!!\n");
 #endif
+    hwnd = Win32ToOS2Handle(hwnd);
     //SvL: Write callback handler class for this one
-    return O32_SetTimer(arg1, arg2, arg3, (TIMERPROC_O32)arg4);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API KillTimer(HWND arg1, UINT arg2)
+    //CB: replace
+    return O32_SetTimer(hwnd,idTimer,uTimeout,(TIMERPROC_O32)tmprc);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API KillTimer(HWND hWnd, UINT uIDEvent)
 {
 #ifdef DEBUG
     WriteLog("USER32:  KillTimer\n");
 #endif
+    hWnd = Win32ToOS2Handle(hWnd);
     //WinStopTimer
-    return O32_KillTimer(arg1, arg2);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API InflateRect( PRECT arg1, int arg2, int  arg3)
+    //CB: replace
+    return O32_KillTimer(hWnd,uIDEvent);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API InflateRect( PRECT lprc, int dx, int  dy)
 {
 #ifdef DEBUG
     WriteLog("USER32:  InflateRect\n");
 #endif
-    //don't know how Win32 handles this
-    return O32_InflateRect(arg1, arg2, arg3);
+    if (!lprc) return FALSE;
+    //right?
+    lprc->left   -= dx;
+    lprc->right  += dx;
+    lprc->top    -= dy;
+    lprc->bottom += dy;
+
+    return TRUE;
 }
 //******************************************************************************
@@ -486,5 +572,5 @@
     WriteLog("USER32:  ShowCursor\n");
 #endif
-    //WinShowCursor(HWND_DESKTOP,arg1); //not the same
+    //WinShowCursor(OSLIB_HWND_DESKTOP,arg1); //CB: not the same
     return O32_ShowCursor(arg1);
 }
@@ -497,4 +583,5 @@
 #endif
 
+    if (!lprc) return FALSE;
     lprc->left   = nLeft;
     lprc->top    = nTop;
@@ -506,42 +593,47 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API WinHelpA( HWND arg1, LPCSTR arg2, UINT arg3, DWORD  arg4)
-{
-#ifdef DEBUG
-    WriteLog("USER32:  WinHelp not implemented %s\n", arg2);
-#endif
+BOOL WIN32API WinHelpA( HWND hwnd, LPCSTR lpszHelp, UINT uCommand, DWORD  dwData)
+{
+#ifdef DEBUG
+    WriteLog("USER32:  WinHelp not implemented %s\n", lpszHelp);
+#endif
+//    hwnd = Win32ToOS2Handle(hwnd);
 //    return O32_WinHelp(arg1, arg2, arg3, arg4);
+
     return(TRUE);
 }
 //******************************************************************************
 //******************************************************************************
-int WIN32API TranslateAcceleratorA(HWND arg1, HACCEL arg2, LPMSG  arg3)
+int WIN32API TranslateAcceleratorA(HWND hwnd, HACCEL haccel, LPMSG  lpmsg)
 {
 #ifdef DEBUG
 ////    WriteLog("USER32:  TranslateAccelerator\n");
 #endif
+    //CB: needs more work
     //WinTranslateAccel();
     //get hab, translate
-    return O32_TranslateAccelerator(arg1, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API SubtractRect( PRECT arg1, const RECT * arg2, const RECT * arg3)
+    hwnd = Win32ToOS2Handle(hwnd);
+    return O32_TranslateAccelerator(hwnd,haccel,lpmsg);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API SubtractRect( PRECT lprcDest, const RECT * lprcSrc1, const RECT * lprcSrc2)
 {
 #ifdef DEBUG
     WriteLog("USER32:  SubtractRect");
 #endif
-    // how?
-    return O32_SubtractRect(arg1, arg2, arg3);
+    //CB: how?
+    return O32_SubtractRect(lprcDest,lprcSrc1,lprcSrc2);
 }
 //******************************************************************************
 //SvL: 24-6-'97 - Added
 //******************************************************************************
-BOOL WIN32API ClipCursor(const RECT * arg1)
+BOOL WIN32API ClipCursor(const RECT * lpRect)
 {
 #ifdef DEBUG
     WriteLog("USER32:  ClipCursor\n");
 #endif
-    return O32_ClipCursor(arg1);
+    //CB: how to replace?
+    return O32_ClipCursor(lpRect);
 }
 //******************************************************************************
@@ -569,39 +661,46 @@
 //SvL: 24-6-'97 - Added
 //******************************************************************************
-BOOL WIN32API GetCursorPos( PPOINT arg1)
-{
+BOOL WIN32API GetCursorPos( PPOINT lpPoint)
+{
+    BOOL rc;
+    POINT point;
 #ifdef DEBUG
 ////    WriteLog("USER32:  GetCursorPos\n");
 #endif
-    return O32_GetCursorPos(arg1);
+    if (!lpPoint) return FALSE;
+    if (OSLibWinQueryPointerPos(OSLIB_HWND_DESKTOP,&point)) //POINT == POINTL
+    {
+      OS2ToWin32ScreenPos(lpPoint,&point);
+      return TRUE;
+    } else return FALSE;
 }
 //******************************************************************************
 //SvL: 24-6-'97 - Added
 //******************************************************************************
-WORD WIN32API VkKeyScanA( char arg1)
+WORD WIN32API VkKeyScanA( char ch)
 {
 #ifdef DEBUG
     WriteLog("USER32:  VkKeyScanA\n");
 #endif
-    return O32_VkKeyScan(arg1);
+    return O32_VkKeyScan(ch);
 }
 //******************************************************************************
 //SvL: 24-6-'97 - Added
 //******************************************************************************
-SHORT WIN32API GetKeyState( int arg1)
-{
-#ifdef DEBUG
-    WriteLog("USER32:  GetKeyState %d\n", arg1);
-#endif
-    return O32_GetKeyState(arg1);
-}
-//******************************************************************************
-//******************************************************************************
-HCURSOR WIN32API SetCursor( HCURSOR arg1)
+SHORT WIN32API GetKeyState( int nVirtKey)
+{
+#ifdef DEBUG
+    WriteLog("USER32:  GetKeyState %d\n", nVirtKey);
+#endif
+    return O32_GetKeyState(nVirtKey);
+}
+//******************************************************************************
+//******************************************************************************
+HCURSOR WIN32API SetCursor( HCURSOR hcur)
 {
 #ifdef DEBUG
     WriteLog("USER32:  SetCursor\n");
 #endif
-    return O32_SetCursor(arg1);
+    return O32_SetCursor(hcur);
 }
 //******************************************************************************
@@ -612,4 +711,5 @@
     WriteLog("USER32:  SetCursorPos\n");
 #endif
+//CB:{a} stopped here
     return O32_SetCursorPos(arg1, arg2);
 }
@@ -621,4 +721,5 @@
     WriteLog("USER32:  EnableScrollBar\n");
 #endif
+    //CB: implement in window class
     return O32_EnableScrollBar(arg1, arg2, arg3);
 }
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 326)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.9 1999-07-18 10:39:51 sandervl Exp $ */
+/* $Id: win32wnd.cpp,v 1.10 1999-07-18 13:57:48 cbratschi Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -124,10 +124,10 @@
   if (cs->hwndParent)
   {
-    	Win32Window *window = GetWindowFromHandle(cs->hwndParent);
-    	if(!window) {
+        Win32Window *window = GetWindowFromHandle(cs->hwndParent);
+        if(!window) {
                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
                 SetLastError(ERROR_INVALID_PARAMETER);
-		return FALSE;
-    	}
+                return FALSE;
+        }
         /* Make sure parent is valid */
         if (!window->IsWindow() )
@@ -231,5 +231,5 @@
   if ((cs->style & WS_CHILD) && cs->hwndParent)
   {
-	SetParent(cs->hwndParent);
+        SetParent(cs->hwndParent);
   }
   else
@@ -240,5 +240,5 @@
         else
         {
-		owner = GetWindowFromHandle(cs->hwndParent);
+                owner = GetWindowFromHandle(cs->hwndParent);
                 if(owner == NULL)
                 {
@@ -263,18 +263,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 +337,5 @@
                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
                                  (owner) ? owner->getOS2WindowHandle() : 0,
-				 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
+                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
                                  &OS2HwndFrame);
 
@@ -354,12 +354,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
@@ -378,7 +378,7 @@
   else  windowId = (UINT)cs->hMenu;
 
-  /* Send the WM_CREATE message 
-   * Perhaps we shouldn't allow width/height changes as well. 
-   * See p327 in "Internals". 
+  /* Send the WM_CREATE message
+   * Perhaps we shouldn't allow width/height changes as well.
+   * See p327 in "Internals".
    */
   maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
@@ -389,11 +389,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 +405,5 @@
                 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
 #endif
-	    return TRUE;
+            return TRUE;
         }
   }
@@ -429,88 +429,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 +611,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,
@@ -752,7 +752,7 @@
 {
   if(isUnicode) {
-	return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
-  }
-  else	return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
+        return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
+  }
+  else  return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
 }
 //******************************************************************************
@@ -843,4 +843,5 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
+
         dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
@@ -928,6 +929,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;
@@ -944,6 +945,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;
@@ -984,11 +985,11 @@
  PVOID menutemplate;
 
-   if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 
+   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));
@@ -1004,35 +1005,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);
@@ -1046,45 +1047,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);
@@ -1102,7 +1103,7 @@
 {
   if(getParent()) {
-	return getParent()->getWindowHandle();
-  }
-  else	return 0;
+        return getParent()->getWindowHandle();
+  }
+  else  return 0;
 }
 //******************************************************************************
@@ -1114,10 +1115,10 @@
 
    if(getParent()) {
-    	oldhwnd = getParent()->getWindowHandle();
+        oldhwnd = getParent()->getWindowHandle();
    }
    else oldhwnd = 0;
 
    if(hwndNewParent == 0) {//desktop window = parent
- 	setParent(NULL);
+        setParent(NULL);
         OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
         return oldhwnd;
@@ -1138,7 +1139,7 @@
 {
   if(getParent()) {
-	return getParent()->getWindowHandle() == hwndParent;
-  }
-  else 	return 0;
+        return getParent()->getWindowHandle() == hwndParent;
+  }
+  else  return 0;
 }
 //******************************************************************************
@@ -1154,10 +1155,10 @@
 //******************************************************************************
 BOOL Win32Window::UpdateWindow()
-{  
- RECT rect;
+{
+   OSRECTL 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;
@@ -1182,40 +1183,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();
-	}
+  if(hwndRelated)
+  {
+        win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
+        magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
+        if(CheckMagicDword(magic) && win32wnd)
+        {
+                return win32wnd->getWindowHandle();
+        }
   }
   return 0;
@@ -1254,5 +1255,5 @@
   if(CheckMagicDword(magic) && win32wnd)
   {
-	return win32wnd->getWindowHandle();
+        return win32wnd->getWindowHandle();
   }
   return hwndActive;
@@ -1324,5 +1325,5 @@
                 return oldval;
         case GWL_HWNDPARENT:
-		return SetParent((HWND)value);
+                return SetParent((HWND)value);
 
         case GWL_ID:
@@ -1409,9 +1410,9 @@
 
    if(HIWORD(hwnd) != 0x6800) {
-	return NULL;
+        return NULL;
    }
 
    if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) {
-	return window;
+        return window;
    }
    else return NULL;
@@ -1419,3 +1420,19 @@
 //******************************************************************************
 //******************************************************************************
+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 326)
+++ trunk/src/user32/new/win32wnd.h	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.h,v 1.8 1999-07-18 10:39:52 sandervl Exp $ */
+/* $Id: win32wnd.h,v 1.9 1999-07-18 13:57:48 cbratschi Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -21,62 +21,63 @@
 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 xParent, ULONG yParent);
+         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  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; };
@@ -84,30 +85,31 @@
          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);
@@ -123,46 +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;
+        BOOL    isIcon;
+
+   Win32Window *owner;
+
+        char   *windowName;
+        ULONG   wndNameLength;
+
+        char   *windowText;
+        ULONG   wndTextLength;
+
+        ULONG  *userWindowLong;
+        ULONG   nrUserWindowLong;
+
+        RECT    rectWindow;
+        RECT    rectClient;
 
 Win32WndClass  *windowClass;
@@ -172,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,
@@ -183,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
@@ -191,10 +194,10 @@
 
 
-#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
 
 #endif //__cplusplus
Index: trunk/src/user32/new/windlg.cpp
===================================================================
--- trunk/src/user32/new/windlg.cpp	(revision 326)
+++ trunk/src/user32/new/windlg.cpp	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: windlg.cpp,v 1.1 1999-07-18 10:39:52 sandervl Exp $ */
+/* $Id: windlg.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
 /*
  * Win32 dialog apis for OS/2
@@ -9,4 +9,5 @@
  *
  */
+#include <wchar.h>
 #include <os2win.h>
 #include <misc.h>
@@ -89,11 +90,15 @@
 //******************************************************************************
 //******************************************************************************
-BOOL WIN32API SetDlgItemInt( HWND arg1, int arg2, UINT arg3, BOOL  arg4)
-{
+BOOL WIN32API SetDlgItemInt( HWND hwndDlg, int idControl, UINT uValue, BOOL  fSigned)
+{
+    char buf[30];
+
 #ifdef DEBUG
     WriteLog("USER32:  SetDlgItemInt\n");
 #endif
-    //get item text and translate to int
-    return O32_SetDlgItemInt(arg1, arg2, arg3, arg4);
+    if (fSigned) sprintf(buf,"%u",uValue);
+    else sprintf(buf,"%d",uValue);
+
+    return SetDlgItemTextA(hwndDlg,idControl,buf);
 }
 //******************************************************************************
Index: trunk/src/user32/new/wingdi.cpp
===================================================================
--- trunk/src/user32/new/wingdi.cpp	(revision 326)
+++ trunk/src/user32/new/wingdi.cpp	(revision 327)
@@ -1,3 +1,3 @@
-/* $Id: wingdi.cpp,v 1.1 1999-07-18 10:40:16 sandervl Exp $ */
+/* $Id: wingdi.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
 /*
  * Win32 Window graphics apis for OS/2
@@ -23,16 +23,18 @@
 {
   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(), &lps->rcPaint) == FALSE)
+   if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &rect) == 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);
 
@@ -55,6 +57,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));
