Index: trunk/src/user32/new/dc.cpp
===================================================================
--- trunk/src/user32/new/dc.cpp	(revision 2444)
+++ trunk/src/user32/new/dc.cpp	(revision 2445)
@@ -1,3 +1,3 @@
-/* $Id: dc.cpp,v 1.13 2000-01-14 14:45:15 sandervl Exp $ */
+/* $Id: dc.cpp,v 1.14 2000-01-15 15:05:36 sandervl Exp $ */
 
 /*
@@ -69,4 +69,6 @@
 LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps);
 
+//******************************************************************************
+//******************************************************************************
 void TestWideLine (pDCData pHps)
 {
@@ -91,5 +93,6 @@
    }
 }
-
+//******************************************************************************
+//******************************************************************************
 void Calculate1PixelDelta(pDCData pHps)
 {
@@ -100,7 +103,6 @@
    pHps->worldXDeltaFor1Pixel = (int)(aptl[1].x - aptl[0].x);                   // 171182
 }
-
-//******************************************************************************
-
+//******************************************************************************
+//******************************************************************************
 int setMapMode(Win32BaseWindow *wnd, pDCData pHps, int mode)
 {
@@ -181,5 +183,6 @@
    return prevMode;
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL setPageXForm(Win32BaseWindow *wnd, pDCData pHps)
 {
@@ -233,5 +236,6 @@
    return rc;
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev)
 {
@@ -293,5 +297,6 @@
    return (result);
 }
-
+//******************************************************************************
+//******************************************************************************
 LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps)
 {
@@ -323,5 +328,6 @@
    }
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL isYup (pDCData pHps)
 {
@@ -340,5 +346,6 @@
    return FALSE;
 }
-
+//******************************************************************************
+//******************************************************************************
 INT revertDy (Win32BaseWindow *wnd, INT dy)
 {
@@ -359,5 +366,6 @@
    return (dy);
 }
-
+//******************************************************************************
+//******************************************************************************
 HDC sendEraseBkgnd (Win32BaseWindow *wnd)
 {
@@ -400,5 +408,6 @@
    return erased;
 }
-
+//******************************************************************************
+//******************************************************************************
 void releaseOwnDC (HDC hps)
 {
@@ -420,5 +429,6 @@
    }
 }
-
+//******************************************************************************
+//******************************************************************************
 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
 {
@@ -496,5 +506,6 @@
    return (HDC)pHps->hps;
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API EndPaint (HWND hwnd, const PAINTSTRUCT_W *pPaint)
 {
@@ -528,5 +539,6 @@
    return TRUE;
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API GetUpdateRect (HWND hwnd, LPRECT pRect, BOOL erase)
 {
@@ -589,12 +601,13 @@
    return updateRegionExists;
 }
-
+//******************************************************************************
 //functions for WM_NCPAINT
-
+//******************************************************************************
 INT SYSTEM GetOS2UpdateRgn(HWND hwnd,HRGN hrgn)
 {
   return O32_GetUpdateRgn(hwnd,hrgn,FALSE);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL SYSTEM GetOS2UpdateRect(HWND hwnd,LPRECT pRect)
 {
@@ -615,5 +628,6 @@
    return updateRegionExists;
 }
-
+//******************************************************************************
+//******************************************************************************
 int WIN32API GetUpdateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
 {
@@ -633,5 +647,5 @@
    return Complexity;
 }
-
+//******************************************************************************
 // This implementation of GetDCEx supports
 // DCX_WINDOW
@@ -639,5 +653,5 @@
 // DCX_EXCLUDERGN (complex regions allowed)
 // DCX_INTERSECTRGN (complex regions allowed)
-
+//******************************************************************************
 HDC WIN32API GetDCEx (HWND hwnd, HRGN hrgn, ULONG flags)
 {
@@ -793,15 +807,18 @@
    return NULL;
 }
-
+//******************************************************************************
+//******************************************************************************
 HDC WIN32API GetDC (HWND hwnd)
 {
   return GetDCEx (hwnd, NULL, 0);
 }
-
+//******************************************************************************
+//******************************************************************************
 HDC WIN32API GetWindowDC (HWND hwnd)
 {
   return GetDCEx (hwnd, NULL, DCX_WINDOW_W);
 }
-
+//******************************************************************************
+//******************************************************************************
 int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
 {
@@ -824,5 +841,6 @@
    return (rc);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API UpdateWindow (HWND hwnd)
 {
@@ -843,5 +861,5 @@
    return (TRUE);
 }
-
+//******************************************************************************
 // This implementation of RedrawWindow supports
 // RDW_ERASE
@@ -853,5 +871,5 @@
 // RDW_ERASENOW
 // RDW_UPDATENOW
-
+//******************************************************************************
 BOOL WIN32API RedrawWindow(HWND hwnd, const RECT* pRect, HRGN hrgn, DWORD redraw)
 {
@@ -913,24 +931,4 @@
 //   else if (redraw & RDW_ERASENOW_W)
 //      wnd->setSuppressErase (FALSE);
-#if 0
-   else
-   {
-      QMSG qmsg;
-      BOOL erase;
-
-      erase = (WinPeekMsg (HABX, &qmsg, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE)
-                && (redraw & RDW_NOERASE_W) == 0);
-
-      wnd->setSuppressErase (!erase);
-   }
-
-   if (redraw & (RDW_NOINTERNALPAINT_W | RDW_INTERNALPAINT_W))
-   {
-      QMSG qmsg;
-
-      WinPeekMsg( (HAB)0, &qmsg, hwnd, WM_VIRTUAL_INTERNALPAINT,
-                  WM_VIRTUAL_INTERNALPAINT, PM_REMOVE );
-   }
-#endif
 
    if (hrgn)
@@ -1033,14 +1031,10 @@
    return (success);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API InvalidateRect (HWND hwnd, const RECT *pRect, BOOL erase)
 {
-//   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    BOOL result;
-
-// todo !!
-//   if ( isFrame without client )
-//      erase = TRUE;
-
+   
    result = RedrawWindow (hwnd, pRect, NULLHANDLE,
                           RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
@@ -1049,13 +1043,9 @@
    return (result);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
 {
-//   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    BOOL result;
-
-// todo !!
-//   if ( isFrame without client )
-//      erase = TRUE;
 
    result = RedrawWindow (hwnd, NULL, hrgn,
@@ -1065,5 +1055,6 @@
    return (result);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL setPMRgnIntoWinRgn (HRGN hrgnPM, HRGN hrgnWin, LONG height)
 {
@@ -1123,5 +1114,6 @@
    return (rc);
 }
-
+//******************************************************************************
+//******************************************************************************
 BOOL WIN32API ScrollDC (HDC hDC, int dx, int dy, const RECT *pScroll,
                         const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
@@ -1246,7 +1238,56 @@
    return (rc);
 }
-
-//******************************************************************************
-//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+#if 1
+BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
+{
+ Win32BaseWindow *window;
+ APIRET  rc;
+ RECTL   clientRect;
+ RECTL   scrollRect;
+ RECTL   clipRect;
+ PRECT   pClientRect;
+ PRECTL  pScrollRect = NULL;
+ PRECTL  pClipRect   = NULL;
+ ULONG   scrollFlags = SW_INVALIDATERGN;
+
+    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
+    if(!window) {
+        dprintf(("ScrollWindow, window %x not found", hwnd));
+        return 0;
+    }
+    dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
+    pClientRect = window->getClientRectPtr();
+    clientRect.xLeft   = 0;
+    clientRect.yBottom = 0;
+    clientRect.xRight  = pClientRect->right - pClientRect->left;
+    clientRect.yTop    = pClientRect->bottom - pClientRect->top;
+    if(pScroll) {
+         mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
+         pScrollRect = &scrollRect;
+
+         //Scroll rectangle relative to client area
+         WinIntersectRect ((HAB) 0, pScrollRect, pScrollRect, &clientRect);
+    }
+    else scrollFlags |= SW_SCROLLCHILDREN;
+
+    if(pClip) {
+         mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
+         pClipRect = &clipRect;
+
+         //Clip rectangle relative to client area
+         WinIntersectRect ((HAB) 0, pClipRect, pClipRect, &clientRect);
+    }
+
+    dy = revertDy (window, dy);
+
+    rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
+                         pScrollRect, pClipRect, NULLHANDLE,
+                         NULL, scrollFlags);
+
+    return (rc != RGN_ERROR);
+}
+#else
 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
 {
@@ -1311,4 +1352,5 @@
     return (rc != RGN_ERROR);
 }
+#endif
 //******************************************************************************
 //******************************************************************************
@@ -1356,5 +1398,5 @@
     if (lComplexity == RGN_ERROR)
     {
-        return (0);
+        return ERROR_W;
     }
 
@@ -1376,5 +1418,5 @@
         ((lComplexity == RGN_RECT) || (lComplexity == RGN_COMPLEX)))
     {
-       rc = InvalidateRect (hwnd, &winRectUpdate, scrollFlag & SW_ERASE_W);
+       rc = InvalidateRect (hwnd, &winRectUpdate, (scrollFlag & SW_ERASE_W) ? 1 : 0);
        if (rc == FALSE)
        {
Index: trunk/src/user32/new/oslibmsg.cpp
===================================================================
--- trunk/src/user32/new/oslibmsg.cpp	(revision 2444)
+++ trunk/src/user32/new/oslibmsg.cpp	(revision 2445)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsg.cpp,v 1.13 2000-01-11 13:06:25 sandervl Exp $ */
+/* $Id: oslibmsg.cpp,v 1.14 2000-01-15 15:05:37 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -248,4 +248,14 @@
 }
 //******************************************************************************
+//PeekMessage retrieves only messages associated with the window identified by the 
+//hwnd parameter or any of its children as specified by the IsChild function, and within 
+//the range of message values given by the uMsgFilterMin and uMsgFilterMax 
+//parameters. If hwnd is NULL, PeekMessage retrieves messages for any window that 
+//belongs to the current thread making the call. (PeekMessage does not retrieve 
+//messages for windows that belong to other threads.) If hwnd is -1, PeekMessage only 
+//returns messages with a hwnd value of NULL, as posted by the PostAppMessage 
+//function. If uMsgFilterMin and uMsgFilterMax are both zero, PeekMessage returns all 
+//available messages (no range filtering is performed). 
+//TODO: Not working as specified right now!
 //******************************************************************************
 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 2444)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 2445)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.42 2000-01-14 14:45:16 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.43 2000-01-15 15:05:37 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -397,4 +397,5 @@
 
     case WM_PAINT:
+        dprintf(("OS2: WM_PAINT"));
         win32wnd->DispatchMsgA(pWinMsg);
         goto RunDefWndProc;
Index: trunk/src/user32/new/win32wbasenonclient.cpp
===================================================================
--- trunk/src/user32/new/win32wbasenonclient.cpp	(revision 2444)
+++ trunk/src/user32/new/win32wbasenonclient.cpp	(revision 2445)
@@ -1,3 +1,3 @@
-/* $Id: win32wbasenonclient.cpp,v 1.8 2000-01-15 14:18:18 cbratschi Exp $ */
+/* $Id: win32wbasenonclient.cpp,v 1.9 2000-01-15 15:05:37 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2 (non-client methods)
@@ -194,5 +194,6 @@
     if ((wParam & 0x0f) != HTHSCROLL) return;
     scrollbar = SB_HORZ;
-  } else  /* SC_VSCROLL */
+  }
+  else  /* SC_VSCROLL */
   {
     if ((wParam & 0x0f) != HTVSCROLL) return;
@@ -203,23 +204,31 @@
   pt.y -= rectWindow.top;
   SCROLL_HandleScrollEvent(Win32Hwnd,0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN);
-  if (GetCapture() != Win32Hwnd) return;
+  if (GetCapture() != getWindowHandle()) return;
   do
   {
-    GetMessageA(&msg,Win32Hwnd,0,0);
-    switch(msg.message)
-    {
-      case WM_LBUTTONUP:
-      case WM_MOUSEMOVE:
-        pt.x = msg.pt.x-rectWindow.left;
-        pt.y = msg.pt.y-rectWindow.top;
-        msg.lParam = MAKELONG(pt.x,pt.y);
-      case WM_SYSTIMER:
-        SCROLL_HandleScrollEvent(Win32Hwnd,msg.wParam,msg.lParam,scrollbar,msg.message);
-        break;
-
-      default:
+    GetMessageA(&msg, 0, 0, 0);
+    if(msg.hwnd == getWindowHandle())
+    {
+        switch(msg.message)
+        {
+        case WM_LBUTTONUP:
+        case WM_MOUSEMOVE:
+            pt.x = msg.pt.x-rectWindow.left;
+            pt.y = msg.pt.y-rectWindow.top;
+            msg.lParam = MAKELONG(pt.x,pt.y);
+
+        case WM_SYSTIMER:
+            SCROLL_HandleScrollEvent(Win32Hwnd,msg.wParam,msg.lParam,scrollbar,msg.message);
+            break;
+
+        default:
+            TranslateMessage(&msg);
+            DispatchMessageA(&msg);
+            break;
+        }
+    }
+    else {
         TranslateMessage(&msg);
         DispatchMessageA(&msg);
-        break;
     }
     if (!IsWindow())
@@ -228,5 +237,6 @@
       break;
     }
-  } while (msg.message != WM_LBUTTONUP);
+  }
+  while (msg.message != WM_LBUTTONUP);
 }
 //******************************************************************************
