Ignore:
Timestamp:
Jun 7, 2000, 4:51:33 PM (25 years ago)
Author:
sandervl
Message:

Major rewrite: frame/client -> frame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/dc.cpp

    r3641 r3662  
    1 /* $Id: dc.cpp,v 1.58 2000-06-01 11:27:56 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.59 2000-06-07 14:51:25 sandervl Exp $ */
    22
    33/*
     
    2222#include <stdlib.h>
    2323
     24#include <string.h>
    2425#include <win32type.h>
    2526#include <win32api.h>
     
    301302//******************************************************************************
    302303//******************************************************************************
     304VOID removeClientArea(pDCData pHps)
     305{
     306 POINTL point;
     307
     308   // This function checks to see if a client area is currently selected, if
     309   // it is the origin plus the visible region of the frame are restored.
     310
     311   pHps->isClient = FALSE;
     312
     313   GreGetDCOrigin(pHps->hps, &point);
     314
     315   if(pHps->isClientArea)
     316   {
     317        dprintf2(("removeClientArea: (%d,%d) -> (%d,%d)", point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
     318        pHps->isClientArea = FALSE;
     319        GreSetupDC(pHps->hps,
     320                   pHps->hrgnVis,
     321                   pHps->ptlOrigin.x,
     322                   pHps->ptlOrigin.y,
     323                   0,
     324                   SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
     325   }
     326   else dprintf(("removeClientArea: (%d,%d)", point.x, point.y));
     327
     328}
     329//******************************************************************************
     330//******************************************************************************
     331HRGN selectClientArea(Win32BaseWindow *window, pDCData pHps, PRECTL prclPaint)
     332{
     333   // This function checks to see if the DC needs to be adjusted to a client
     334   // area and makes the adjustment.
     335   RECTL rcl, rcltemp;
     336   HRGN  hrgnRect, hrgnClip, hrgnOldClip = 0;
     337   HWND  hwnd;
     338   LONG  rc;
     339   PRECT pClient = window->getClientRectPtr();
     340   PRECT pWindow = window->getWindowRect();
     341
     342   if(pClient->left == 0 && pClient->top == 0 &&
     343      window->getClientHeight() == window->getWindowHeight() &&
     344      window->getClientWidth()  == window->getWindowWidth())
     345   {
     346        //client rectangle = frame rectangle -> no change necessary
     347        //only setup the clip region
     348        goto setupclipregion;
     349   }
     350
     351   pHps->isClient = TRUE;
     352
     353   hwnd = window->getOS2WindowHandle();
     354
     355   mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&rcl);
     356
     357   //convert to screen coordinates
     358   GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
     359   rcl.xLeft   += rcltemp.xLeft;
     360   rcl.xRight  += rcltemp.xLeft;
     361   rcl.yTop    += rcltemp.yBottom;
     362   rcl.yBottom += rcltemp.yBottom;
     363       
     364   pHps->ptlOrigin.x = rcltemp.xLeft;
     365   pHps->ptlOrigin.y = rcltemp.yBottom;
     366 
     367   dprintf2(("selectClientArea: (%d,%d) -> (%d,%d)", rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));
     368
     369   if(pHps->hrgnVis == 0)
     370        pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1);
     371
     372   hrgnRect = GreCreateRectRegion(pHps->hps, &rcl, 1);
     373
     374   // Query the visible region
     375   GreCopyClipRegion(pHps->hps, pHps->hrgnVis, 0, COPYCRGN_VISRGN);
     376   GpiQueryRegionBox(pHps->hps, pHps->hrgnVis, &rcltemp);
     377   // And the visible region of the frame with the client rectangle
     378   // to get the new visible region
     379   GreCombineRegion(pHps->hps, hrgnRect, pHps->hrgnVis, hrgnRect, CRGN_AND);
     380     
     381   // Set the new origin plus visible region in the DC
     382   GreSetupDC(pHps->hps,
     383              hrgnRect,
     384              rcl.xLeft,
     385              rcl.yBottom,
     386              NULL,
     387              SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
     388
     389/*
     390        GpiQueryRegionBox(pHps->hps, hrgnClip, &rcltemp);
     391        GpiQueryRegionBox(pHps->hps, hrgnOldClip, &rcltemp);
     392
     393        GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
     394
     395        GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
     396
     397        GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_VISRGN);
     398        GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
     399     
     400        GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_ALLINTERSECT);
     401        GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
     402     
     403        GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_CLIPRGN);
     404        GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
     405*/
     406   pHps->isClientArea = TRUE;
     407
     408   // Destroy the region now we have finished with it.
     409   GreDestroyRegion(pHps->hps, hrgnRect);
     410
     411setupclipregion:
     412   if(prclPaint) {
     413        hrgnClip = GpiQueryClipRegion(pHps->hps);
     414        if(hrgnClip) {
     415                rc = GreIntersectClipRectangle(pHps->hps, prclPaint);
     416                if(rc == RGN_ERROR) {
     417                        dprintf(("selectClientArea: GreIntersectClipRectangle returned RGN_ERROR!"));
     418                }
     419        }
     420        else {
     421                hrgnClip = GreCreateRectRegion(pHps->hps, prclPaint, 1);
     422                GreSelectClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
     423        }
     424   }
     425
     426   return hrgnOldClip;
     427}
     428//******************************************************************************
     429//******************************************************************************
    303430LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps)
    304431{
     
    308435   if ((hwnd != 0) || (pHps == 0))
    309436   {
    310       if (wnd)
    311          return (wnd->getClientHeight());
    312       else
    313          return OSLibQueryScreenHeight();
     437        if(wnd) {
     438                if(pHps && !pHps->isClientArea) {
     439                        return (wnd->getWindowHeight());
     440                }
     441                else    return (wnd->getClientHeight());
     442        }
     443        else    return OSLibQueryScreenHeight();
    314444   }
    315445   else if (pHps->bitmapHandle)
     
    430560//******************************************************************************
    431561//******************************************************************************
    432 #if 0
    433 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
    434 {
    435    HWND     hwnd = hWnd ? hWnd : HWND_DESKTOP;
    436    pDCData  pHps = NULLHANDLE;
    437    RECTL    rect;
    438    HPS      hPS_ownDC = NULLHANDLE;
    439 
    440    if ( !lpps )
    441    {
    442       SetLastError(ERROR_INVALID_PARAMETER_W);
    443       return (HDC)NULLHANDLE;
    444    }
    445 
    446    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    447 
    448 #if 0
    449    if ((hwnd != HWND_DESKTOP) && wnd->isOwnDC())
    450    {
    451         hPS_ownDC = wnd->getOwnDC();
    452         //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
    453         if(hPS_ownDC) {
    454                 pHps = (pDCData)GpiQueryDCData(hPS_ownDC);
    455                 if (!pHps)
    456                 {
    457                         SetLastError(ERROR_INVALID_PARAMETER_W);
    458                         return (HDC)NULLHANDLE;
    459                 }
    460         }
    461    }
    462 #endif
    463 
    464    HWND hwndClient = wnd->getOS2WindowHandle();
    465    HPS  hps = WinBeginPaint(hwndClient, hPS_ownDC, &rect);
    466 
    467    if (!pHps)
    468    {
    469       HDC hdc = HPSToHDC (hwndClient, hps, NULL, NULL);
    470       pHps = (pDCData)GpiQueryDCData(hps);
    471    }
    472 
    473    if (hPS_ownDC == 0)
    474       setMapMode (wnd, pHps, MM_TEXT_W);
    475    else
    476       setPageXForm (wnd, pHps);
    477 
    478    pHps->hdcType = TYPE_3;
    479 
    480    HideCaret(hwnd);
    481 
    482    if(wnd->needsEraseBkgnd()) {
    483         wnd->setEraseBkgnd(FALSE);
    484         lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) != 0);
    485    }
    486    else lpps->fErase = TRUE;
    487    lpps->hdc = (HDC)hps;
    488 
    489    if (!hPS_ownDC)
    490    {
    491       long height  = wnd->getClientHeight();
    492 
    493       rect.yTop    = height - rect.yTop;
    494       rect.yBottom = height - rect.yBottom;
    495    }
    496    else
    497    {
    498       rect.yTop--;
    499       rect.yBottom--;
    500       GpiConvert(pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rect);
    501    }
    502 
    503    WINRECT_FROM_PMRECT(lpps->rcPaint, rect);
    504    dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom));
    505 
    506    SetLastError(0);
    507    return (HDC)pHps->hps;
    508 }
    509 
    510 BOOL WIN32API EndPaint (HWND hwnd, const PAINTSTRUCT_W *pPaint)
    511 {
    512  pDCData pHps;
    513 
    514    dprintf (("USER32: EndPaint(%x)", hwnd));
    515 
    516    ShowCaret(hwnd);
    517    if (!pPaint || !pPaint->hdc )
    518       return TRUE;
    519 
    520    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    521 
    522    if (!wnd) goto exit;
    523 
    524    //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
    525    pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc);
    526    if (pHps && (pHps->hdcType == TYPE_3)) {
    527           WinEndPaint (pHps->hps);
    528    }
    529    wnd->setEraseBkgnd(TRUE);
    530 
    531 exit:
    532    SetLastError(0);
    533    return TRUE;
    534 }
    535 #else
    536562HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
    537563{
     
    540566 HPS      hPS_ownDC = NULLHANDLE, hpsPaint = 0;
    541567 RECTL    rectl = {0, 0, 1, 1};
    542  HRGN     hrgnUpdate, hrgnOld;
     568 HRGN     hrgnUpdate, hrgnOld, hrgnOldClip;
    543569 LONG     lComplexity;
    544 
     570 RECTL    rectlClient;
     571 RECTL    rectlClip;
     572
     573   memset(lpps, 0, sizeof(*lpps));
    545574   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    546575   if(!lpps || !wnd) {
     
    567596   }
    568597   if(!hpsPaint) {
    569         hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W);
     598        hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_WINDOW_W|DCX_USESTYLE_W));
    570599        pHps = (pDCData)GpiQueryDCData(hpsPaint);
    571600        if (!pHps)
     
    577606   }
    578607
    579 #if 0
    580    HPS  hps = WinBeginPaint(hwndClient, hPS_ownDC, &rect);
    581 
    582    if (!pHps)
    583    {
    584       HDC hdc = HPSToHDC (hwndClient, hps, NULL, NULL);
    585       pHps = (pDCData)GpiQueryDCData(hps);
    586    }
    587 #endif
    588 
    589    if (hPS_ownDC == 0)
     608   if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) {
     609        memset(&rectl, 0, sizeof(rectl));
     610        dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!"));
     611
     612        mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
     613        WinOffsetRect(NULL, &rectlClient, -rectlClient.xLeft, -rectlClient.yBottom);
     614
     615        hrgnOldClip = selectClientArea(wnd, pHps, &rectlClient);
     616        //save old clip region (restored for CS_OWNDC windows in EndPaint)
     617        wnd->SetClipRegion(hrgnOldClip);
     618        lComplexity = RGN_NULL;
     619   }
     620   else {
     621        HRGN hrgnTmp = GpiCreateRegion(pHps->hps, 1, &rectl);
     622
     623        WinQueryUpdateRegion(hwndClient, hrgnTmp);
     624
     625        RGNRECT rgnrect = {0, 12, 0, RECTDIR_LFRT_TOPBOT};
     626        RECTL   rectls[12], rcltemp;
     627        GpiQueryRegionRects(pHps->hps, hrgnTmp, &rcltemp, &rgnrect, &rectls[0]);
     628        GpiDestroyRegion(pHps->hps, hrgnTmp);
     629
     630        WinValidateRect(hwndClient, &rectl, FALSE);
     631
     632        mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
     633        WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient);
     634        WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom);
     635 
     636        hrgnOldClip = selectClientArea(wnd, pHps, &rectlClip);
     637
     638        //save old clip region (restored for CS_OWNDC windows in EndPaint)
     639        wnd->SetClipRegion(hrgnOldClip);
     640        memcpy(&rectl, &rectlClip, sizeof(RECTL));
     641        lComplexity = RGN_RECT;
     642   }
     643
     644   if(hPS_ownDC == 0)
    590645      setMapMode (wnd, pHps, MM_TEXT_W);
    591646   else
    592       setPageXForm (wnd, pHps);
     647      setPageXForm(wnd, pHps);
    593648
    594649   pHps->hdcType = TYPE_3;
    595650
    596    hrgnUpdate  = GpiCreateRegion(pHps->hps, 1, &rectl);
    597    lComplexity = WinQueryUpdateRegion(hwndClient, hrgnUpdate);
    598    if(lComplexity == RGN_ERROR) {
    599         dprintf (("USER32: BeginPaint update region error!!"));
    600         SetLastError(ERROR_INVALID_PARAMETER_W);
    601         return 0;
    602    }
    603    WinQueryUpdateRect(hwndClient, &rectl);
    604 
    605    if(lComplexity != RGN_NULL) {
    606         WinValidateRegion(hwndClient, hrgnUpdate, FALSE);
    607 
    608         GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld);
    609         //save old clip region (restored for CS_OWNDC windows in EndPaint)
    610         wnd->SetClipRegion(hrgnOld);
    611    }
     651   HideCaret(hwnd);
     652   WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE);
    612653
    613654   if(wnd->needsEraseBkgnd() && lComplexity != RGN_NULL) {
     
    631672   }
    632673
    633    HideCaret(hwnd);
    634 
    635674   SetLastError(0);
    636675   dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom));
     
    657696   if (pHps && (pHps->hdcType == TYPE_3))
    658697   {
    659         GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld);
     698        removeClientArea(pHps);
    660699        if(hrgnOld) {
     700                GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld);
    661701                GpiDestroyRegion(pHps->hps, hrgnOld);
    662702        }
    663703        if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) {
     704                pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails
    664705                ReleaseDC(hwnd, pPaint->hdc);
    665706        }
     
    671712                pHps->hdcType = TYPE_1;
    672713        }
    673 
    674 ////    WinEndPaint (pHps->hps);
    675714   }
    676715   else {
     
    679718   wnd->setEraseBkgnd(TRUE);
    680719   ShowCaret(hwnd);
     720   WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE);
    681721
    682722exit:
     
    684724   return TRUE;
    685725}
     726//******************************************************************************
     727//******************************************************************************
     728int WIN32API GetClipBox( HDC hdc, PRECT lpRect)
     729{
     730 pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     731 RECTL    rectl;
     732 LONG     lComplexity;
     733 int      rc;
     734
     735    if(!hdc || !lpRect || !pHps) {
     736        dprintf(("GDI32: GetClipBox %x %x ERROR_INVALID_PARAMETER", hdc, lpRect));
     737        SetLastError(ERROR_INVALID_PARAMETER_W);
     738        return ERROR_W;
     739    }
     740    if(pHps->isPrinter)
     741    {
     742        lpRect->left   = 0;
     743        lpRect->top    = 0;
     744        lpRect->right  = GetDeviceCaps( hdc, HORZRES_W);
     745        lpRect->bottom = GetDeviceCaps( hdc, VERTRES_W);
     746
     747        rc = SIMPLEREGION_W;
     748    }
     749    else {
     750        lComplexity = GpiQueryClipBox(pHps->hps, &rectl);
     751        if(lComplexity == RGN_ERROR)
     752        {
     753                rc = ERROR_W;
     754        }
     755        else
     756        if(lComplexity == RGN_NULL)
     757        {
     758                memset(lpRect, 0, sizeof(*lpRect));
     759                rc = NULLREGION_W;
     760        }
     761        else {
     762                lpRect->left   = rectl.xLeft;
     763                lpRect->right  = rectl.xRight;
     764#if 0
     765                lpRect->top    = pHps->height - rectl.yTop;
     766                lpRect->bottom = pHps->height - rectl.yBottom;
     767#else
     768                //No conversion required as GpiQueryClipBox is affected by
     769                //the y-inversion of the window
     770                lpRect->top    = rectl.yBottom;
     771                lpRect->bottom = rectl.yTop;
    686772#endif
    687 //******************************************************************************
    688 //******************************************************************************
    689 int WIN32API GetClipBox( HDC arg1, PRECT  arg2)
     773                //Convert including/including to including/excluding
     774                if(lpRect->left != lpRect->right) {
     775                        lpRect->right++;
     776                }
     777                if(lpRect->top != lpRect->bottom) {
     778                        lpRect->bottom++;
     779                }
     780                rc = (lComplexity == RGN_RECT) ? SIMPLEREGION_W : COMPLEXREGION_W;
     781        }
     782    }
     783    dprintf(("GDI32: GetClipBox of %X returned %d\n", hdc, rc));
     784    return rc;
     785}
     786//******************************************************************************
     787//******************************************************************************
     788int WIN32API GetClipRgn( HDC hdc, HRGN hRgn)
    690789{
    691790 int rc;
    692791
    693   rc = O32_GetClipBox(arg1, arg2);
    694   dprintf(("GDI32: GetClipBox of %X returned %d\n", arg1, rc));
    695   return(rc);
    696 }
    697 //******************************************************************************
    698 //******************************************************************************
    699 int WIN32API GetClipRgn( HDC hdc, HRGN hRgn)
    700 {
    701     dprintf(("GDI32: GetClipRgn"));
    702     return O32_GetClipRgn(hdc, hRgn);
     792    rc = O32_GetClipRgn(hdc, hRgn);
     793    dprintf(("GDI32: GetClipRgn %x %x returned %x", hdc, hRgn, rc));
     794    return rc;
    703795}
    704796//******************************************************************************
     
    708800   if (!hwnd)
    709801   {
    710       SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    711       return FALSE;
     802        dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
     803        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     804        return FALSE;
    712805   }
    713806
     
    717810   if (!wnd)
    718811   {
    719       SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    720       return FALSE;
    721    }
     812        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     813        dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
     814        return FALSE;
     815   }
     816
     817   dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));
    722818
    723819   BOOL updateRegionExists = WinQueryUpdateRect (wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
     
    781877//******************************************************************************
    782878//******************************************************************************
    783 BOOL SYSTEM GetOS2UpdateRect(HWND hwnd,LPRECT pRect)
     879BOOL GetOS2UpdateRect(Win32BaseWindow *window, LPRECT pRect)
    784880{
    785881   RECTL rectl;
    786    BOOL updateRegionExists = WinQueryUpdateRect(hwnd,pRect ? &rectl:NULL);
     882   BOOL updateRegionExists = WinQueryUpdateRect(window->getOS2WindowHandle(),pRect ? &rectl:NULL);
    787883
    788884   if (!pRect)
     
    793889     //CB: for PM empty rect is valid
    794890     if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;
    795      mapOS2ToWin32Rect(hwnd,(PRECTLOS2)&rectl,pRect);
     891     mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectl,pRect);
    796892   }
    797893   else
     
    836932//      isOwnDC = wnd->isOwnDC() && wnd->getOwnDC();
    837933        isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
    838    }
    839    if (isOwnDC)
    840       rc = TRUE;
    841    else
    842       rc = O32_ReleaseDC (0, hdc);
     934        if(!isOwnDC)
     935        {
     936                pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     937                if(pHps && pHps->psType == MICRO_CACHED) {
     938                        removeClientArea(pHps);
     939                        if(pHps->hrgnVis) {
     940                                GreDestroyRegion(pHps->hps, pHps->hrgnVis);
     941                                pHps->hrgnVis = 0;
     942                        }
     943                }       
     944                else {
     945                        dprintf(("ERROR: ReleaseDC: pHps == NULL!!"));
     946                        DebugInt3();
     947                }
     948        }
     949   }
     950
     951   if(isOwnDC) {
     952        rc = TRUE;
     953   }
     954   else {
     955        rc = O32_ReleaseDC (0, hdc);
     956   }
    843957
    844958   dprintf(("ReleaseDC %x %x", hwnd, hdc));
     
    851965// DCX_EXCLUDERGN (complex regions allowed)
    852966// DCX_INTERSECTRGN (complex regions allowed)
     967// DCX_USESTYLE
     968// DCX_CLIPSIBLINGS
     969// DCX_CLIPCHILDREN
     970// DCX_PARENTCLIP
    853971//
    854972//TODO: WM_SETREDRAW affects drawingAllowed flag!!
     
    880998                return 0;
    881999        }
    882 //SvL: Experimental change (doesn't work right)
    883 #if 0
    884         if(wnd->fHasParentDC() && wnd->getParent()) {
    885                 wnd = wnd->getParent();
    886         }
    887 #endif
    888         if (flags & DCX_WINDOW_W)
    889                 hWindow = wnd->getOS2FrameWindowHandle();
    890         else
    891                 hWindow = wnd->getOS2WindowHandle();
     1000        hWindow = wnd->getOS2WindowHandle();
    8921001   }
    8931002
    8941003   isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC()))
    895                  && !(flags & (DCX_CACHE_W | DCX_WINDOW_W)));
    896 
    897    if (isWindowOwnDC)
     1004                 && !(flags & DCX_CACHE_W));
     1005
     1006   if(isWindowOwnDC)
    8981007   {
    8991008      hps = wnd->getOwnDC();
     
    9041013            goto error;
    9051014
     1015         if(flags & DCX_WINDOW_W)
     1016            removeClientArea(pHps);
     1017         else
     1018            selectClientArea(wnd, pHps, NULL);
     1019
    9061020         setPageXForm (wnd, pHps);
    907 
    9081021         pHps->hdcType = TYPE_1;
     1022
    9091023         dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
    9101024         return (HDC)hps;
     
    9141028   }
    9151029
    916    if (isWindowOwnDC)
     1030   if(isWindowOwnDC)
    9171031   {
    9181032      SIZEL sizel = {0,0};
     
    9241038   else
    9251039   {
    926       if (hWindow == HWND_DESKTOP)
     1040      if (hWindow == HWND_DESKTOP) {
    9271041         hps = WinGetScreenPS (hWindow);
    928       else
    929          hps = WinGetPS (hWindow);
    930 
     1042      }
     1043      else {
     1044        int clipstyle = 0;
     1045        int clipwnd   = HWND_TOP;
     1046        if(flags & (DCX_USESTYLE_W)) {
     1047                int style = wnd->getStyle();
     1048                if(style & WS_CLIPCHILDREN_W) {
     1049                        clipstyle |= PSF_CLIPCHILDREN;
     1050                }
     1051                if(style & WS_CLIPSIBLINGS_W) {
     1052                        clipstyle |= PSF_CLIPSIBLINGS;
     1053                }
     1054                if(wnd->fHasParentDC()) {
     1055                        clipstyle |= PSF_PARENTCLIP;
     1056                }
     1057        }
     1058        if(flags & DCX_CLIPSIBLINGS_W) {
     1059                clipstyle |= PSF_CLIPSIBLINGS;
     1060        }
     1061        if(flags & DCX_CLIPCHILDREN_W) {
     1062                clipstyle |= PSF_CLIPCHILDREN;
     1063        }
     1064        if(flags & DCX_PARENTCLIP_W) {
     1065                clipstyle |= PSF_PARENTCLIP;
     1066        }
     1067        if(clipstyle) {
     1068                dprintf2(("WinGetClipPS style %x", clipstyle));
     1069                hps = WinGetClipPS(hWindow, clipwnd, clipstyle);
     1070        }
     1071        else    hps = WinGetPS (hWindow);
     1072      }
    9311073      psType = MICRO_CACHED;
    9321074   }
     
    9371079   HPSToHDC (hWindow, hps, NULL, NULL);
    9381080   pHps = (pDCData)GpiQueryDCData (hps);
     1081
     1082   if(!(flags & DCX_WINDOW_W))
     1083   {
     1084        selectClientArea(wnd, pHps, NULL);
     1085   }
     1086   else removeClientArea(pHps);
     1087
     1088
     1089   setMapMode(wnd, pHps, MM_TEXT_W);
    9391090
    9401091   if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W))
     
    10371188{
    10381189  if (!hwnd) hwnd = GetDesktopWindow();
    1039   return GetDCEx (hwnd, NULL, DCX_USESTYLE_W | DCX_WINDOW_W);
     1190  return GetDCEx (hwnd, NULL, DCX_WINDOW_W);
    10401191}
    10411192//******************************************************************************
     
    10911242        //TODO: If frame, exclude client window from update
    10921243        if(redraw & RDW_FRAME_W) {
    1093                 hwnd = wnd->getOS2FrameWindowHandle();
     1244                hwnd = wnd->getOS2WindowHandle();
    10941245        }
    10951246        else    hwnd = wnd->getOS2WindowHandle();
     
    12541405}
    12551406//******************************************************************************
     1407//TODO: Change for client rectangle!!!!!
    12561408//******************************************************************************
    12571409BOOL setPMRgnIntoWinRgn (HRGN hrgnPM, HRGN hrgnWin, LONG height)
     
    13131465}
    13141466//******************************************************************************
    1315 //******************************************************************************
    1316 BOOL WIN32API ScrollDC (HDC hDC, int dx, int dy, const RECT *pScroll,
    1317                         const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
     1467//TODO: Check if this one works correctly...
     1468//******************************************************************************
     1469BOOL WIN32API ScrollDC(HDC hDC, int dx, int dy, const RECT *pScroll,
     1470                       const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
    13181471{
    13191472   BOOL rc = TRUE;
    13201473
    1321    dprintf (("USER32:  ScrollDC"));
     1474   dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    13221475
    13231476   if (!hDC)
     
    13411494   dy = (int)(ptl[1].y - ptl[0].y);
    13421495
    1343    RECTL scrollRect;
    1344    RECTL clipRect;
     1496   RECT scrollRect;
     1497   RECT clipRect;
    13451498
    13461499   if (pClip)
    13471500   {
    1348       clipRect.xLeft   = min (pClip->left, pClip->right);
    1349       clipRect.xRight  = max (pClip->left, pClip->right);
    1350       clipRect.yTop    = max (pClip->top,  pClip->bottom);
    1351       clipRect.yBottom = min (pClip->top,  pClip->bottom);
     1501      memcpy(&clipRect, pClip, sizeof(clipRect));
    13521502
    13531503      if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1354           (clipRect.xLeft   != clipRect.xRight)   &&
    1355           (clipRect.yBottom != clipRect.yTop))
     1504          (clipRect.left   != clipRect.right)   &&
     1505          (clipRect.bottom != clipRect.top))
    13561506      {
    13571507          if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1358               clipRect.xRight -= abs(pHps->worldXDeltaFor1Pixel);
     1508              clipRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    13591509          else
    1360               clipRect.xLeft  += abs(pHps->worldXDeltaFor1Pixel);
     1510              clipRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    13611511
    13621512          if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1363               clipRect.yTop    -= abs(pHps->worldYDeltaFor1Pixel);
     1513              clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
    13641514          else
    1365               clipRect.yBottom += abs(pHps->worldYDeltaFor1Pixel);
    1366       }
    1367       GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
    1368       if (clipRect.xRight < clipRect.xLeft) {
    1369          ULONG temp      = clipRect.xLeft;
    1370          clipRect.xLeft  = clipRect.xRight;
    1371          clipRect.xRight = temp;
    1372       }
    1373       if (clipRect.yTop < clipRect.yBottom) {
    1374          ULONG temp       = clipRect.yBottom;
    1375          clipRect.yBottom = clipRect.yTop;
    1376          clipRect.yTop    = temp;
     1515              clipRect.top    += abs(pHps->worldYDeltaFor1Pixel);
     1516      }
     1517      GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
     1518      if (clipRect.right < clipRect.left) {
     1519         ULONG temp     = clipRect.left;
     1520         clipRect.left  = clipRect.right;
     1521         clipRect.right = temp;
     1522      }
     1523      if (clipRect.bottom < clipRect.top) {
     1524         ULONG temp       = clipRect.top;
     1525         clipRect.top     = clipRect.bottom;
     1526         clipRect.bottom  = temp;
    13771527      }
    13781528   }
     
    13801530   if (pScroll)
    13811531   {
    1382       scrollRect.xLeft   = min (pScroll->left, pScroll->right);
    1383       scrollRect.xRight  = max (pScroll->left, pScroll->right);
    1384       scrollRect.yTop    = max (pScroll->top,  pScroll->bottom);
    1385       scrollRect.yBottom = min (pScroll->top,  pScroll->bottom);
     1532      memcpy(&scrollRect, pScroll, sizeof(scrollRect));
    13861533
    13871534      if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1388           (scrollRect.xLeft   != scrollRect.xRight)   &&
    1389           (scrollRect.yBottom != scrollRect.yTop))
     1535          (scrollRect.left != scrollRect.right)   &&
     1536          (scrollRect.top  != scrollRect.bottom))
    13901537      {
    13911538          if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1392               scrollRect.xRight -= abs(pHps->worldXDeltaFor1Pixel);
     1539              scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    13931540          else
    1394               scrollRect.xLeft  += abs(pHps->worldXDeltaFor1Pixel);
     1541              scrollRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    13951542
    13961543          if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1397               scrollRect.yTop    -= abs(pHps->worldYDeltaFor1Pixel);
     1544              scrollRect.bottom  -= abs(pHps->worldYDeltaFor1Pixel);
    13981545          else
    1399               scrollRect.yBottom += abs(pHps->worldYDeltaFor1Pixel);
     1546              scrollRect.top    += abs(pHps->worldYDeltaFor1Pixel);
    14001547      }
    14011548      GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
    1402       if (scrollRect.xRight < scrollRect.xLeft) {
    1403          ULONG temp        = scrollRect.xLeft;
    1404          scrollRect.xLeft  = scrollRect.xRight;
    1405          scrollRect.xRight = temp;
    1406       }
    1407       if (scrollRect.yTop < scrollRect.yBottom) {
    1408          ULONG temp         = scrollRect.yBottom;
    1409          scrollRect.yBottom = scrollRect.yTop;
    1410          scrollRect.yTop    = temp;
    1411       }
    1412    }
    1413    RECTL rectlUpdate;
    1414    HRGN  hrgn;
    1415 
    1416    LONG lComplexity = WinScrollWindow (hwnd, dx, dy, (pScroll) ? &scrollRect : NULL, (pClip) ? &clipRect : NULL, hrgn, &rectlUpdate, 0);
     1549      if (scrollRect.right < scrollRect.left) {
     1550         ULONG temp       = scrollRect.left;
     1551         scrollRect.left  = scrollRect.right;
     1552         scrollRect.right = temp;
     1553      }
     1554      if (scrollRect.bottom < scrollRect.top) {
     1555         ULONG temp        = scrollRect.top;
     1556         scrollRect.top    = scrollRect.bottom;
     1557         scrollRect.bottom = temp;
     1558      }
     1559   }
     1560   RECTL  rectlUpdate;
     1561   HRGN   hrgn;
     1562   RECTL  clientRect;
     1563   RECTL  clipOS2;
     1564   RECTL  scrollOS2;
     1565   PRECTL pScrollOS2 = NULL;
     1566   PRECTL pClipOS2   = NULL;
     1567
     1568   mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&clientRect);
     1569
     1570   if(pScroll) {
     1571        mapWin32ToOS2RectClientToFrame(wnd, &scrollRect, (PRECTLOS2)&scrollOS2);
     1572        pScrollOS2 = &scrollOS2;
     1573
     1574        //Scroll rectangle relative to client area
     1575        WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
     1576   }
     1577   else {
     1578        pScrollOS2 = &clientRect;
     1579   }
     1580
     1581   if(pClip) {
     1582         mapWin32ToOS2RectClientToFrame(wnd, &clipRect, (PRECTLOS2)&clipOS2);
     1583         pClipOS2 = &clipOS2;
     1584
     1585         //Clip rectangle relative to client area
     1586         WinIntersectRect((HAB) 0, pClipOS2, pClipOS2, &clientRect);
     1587   }
     1588   else {
     1589         pClipOS2 = &clientRect;
     1590   }
     1591
     1592   LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
     1593                                      pClipOS2, hrgn, &rectlUpdate, 0);
    14171594   if (lComplexity == RGN_ERROR)
    14181595   {
     
    14211598
    14221599   RECT winRectUpdate;
    1423    LONG height = wnd->getClientHeight();
    1424 
    1425    winRectUpdate.left   = rectlUpdate.xLeft;
    1426    winRectUpdate.right  = rectlUpdate.xRight;
    1427    winRectUpdate.top    = height - rectlUpdate.yTop;
    1428    winRectUpdate.bottom = height - rectlUpdate.yBottom;
     1600
     1601   mapOS2ToWin32Rect(wnd->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
    14291602
    14301603   if (pRectUpdate)
     
    14321605
    14331606   if (hrgnUpdate)
    1434       rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, height);
     1607      rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->getWindowHeight());
    14351608
    14361609   return (rc);
     
    14381611//******************************************************************************
    14391612//******************************************************************************
    1440 #if 1
    1441 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
    1442 {
    1443  Win32BaseWindow *window;
    1444  APIRET  rc;
    1445  RECTL   clientRect;
    1446  PRECT   pClientRect;
    1447  RECTL   scrollRect;
    1448  RECTL   clipRect;
    1449  PRECTL  pScrollRect = NULL;
    1450  PRECTL  pClipRect   = NULL;
    1451  ULONG   scrollFlags = SW_INVALIDATERGN;
    1452 
    1453     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    1454     if(!window) {
    1455         dprintf(("ScrollWindow, window %x not found", hwnd));
    1456         return 0;
    1457     }
    1458     dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
    1459 
    1460     pClientRect = window->getClientRectPtr();
    1461     clientRect.xLeft   = 0;
    1462     clientRect.yBottom = 0;
    1463     clientRect.xRight  = pClientRect->right - pClientRect->left;
    1464     clientRect.yTop    = pClientRect->bottom - pClientRect->top;
    1465 
    1466     if(pScroll) {
    1467          mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    1468          pScrollRect = &scrollRect;
    1469 
    1470          //Scroll rectangle relative to client area
    1471          WinIntersectRect ((HAB) 0, pScrollRect, pScrollRect, &clientRect);
    1472     }
    1473     else scrollFlags |= SW_SCROLLCHILDREN;
    1474 
    1475     if(pClip) {
    1476          mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
    1477          pClipRect = &clipRect;
    1478 
    1479          //Clip rectangle relative to client area
    1480          WinIntersectRect ((HAB) 0, pClipRect, pClipRect, &clientRect);
    1481     }
    1482 
    1483     dy = revertDy (window, dy);
    1484 
    1485     rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
    1486                          pScrollRect, pClipRect, NULLHANDLE,
    1487                          NULL, scrollFlags);
    1488 
    1489     return (rc != RGN_ERROR);
    1490 }
    1491 #else
    14921613BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
    14931614{
     
    14971618 RECTL   scrollRect;
    14981619 RECTL   clipRect;
    1499  PRECTL  pScrollRect = NULL;
    1500  PRECTL  pClipRect   = NULL;
     1620 PRECTL  pScrollOS2 = NULL;
     1621 PRECTL  pClipOS2   = NULL;
    15011622 ULONG   scrollFlags = SW_INVALIDATERGN;
    15021623
     
    15071628    }
    15081629    dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
    1509     mapWin32ToOS2Rect(window,window->getClientRectPtr(),(PRECTLOS2)&clientRect);
    1510 #if 0
    1511     //Rectangle could be relative to parent window, so fix this
    1512     if(clientRect.yBottom != 0) {
    1513         clientRect.yTop   -= clientRect.yBottom;
    1514         clientRect.yBottom = 0;
    1515     }
    1516     if(clientRect.xLeft != 0) {
    1517         clientRect.xRight -= clientRect.xLeft;
    1518         clientRect.xLeft   = 0;
    1519     }
    1520 #endif
     1630
     1631    mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
     1632
    15211633    if(pScroll) {
    1522          mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    1523          pScrollRect = &scrollRect;
    1524 
    1525          //Scroll rectangle relative to client area
    1526          pScrollRect->xLeft   += clientRect.xLeft;
    1527          pScrollRect->xRight  += clientRect.xLeft;
    1528          pScrollRect->yTop    += clientRect.yBottom;
    1529          pScrollRect->yBottom += clientRect.yBottom;
    1530          WinIntersectRect ((HAB) 0, pScrollRect, pScrollRect, &clientRect);
    1531     }
    1532     else scrollFlags |= SW_SCROLLCHILDREN;
     1634        mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
     1635        pScrollOS2 = &scrollRect;
     1636
     1637        //Scroll rectangle relative to client area
     1638        WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
     1639    }
     1640    else {
     1641        pScrollOS2 = &clientRect;
     1642        scrollFlags |= SW_SCROLLCHILDREN;
     1643    }
    15331644
    15341645    if(pClip) {
    1535          mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
    1536          pClipRect = &clipRect;
     1646         mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
     1647         pClipOS2 = &clipRect;
    15371648
    15381649         //Clip rectangle relative to client area
    1539          pClipRect->xLeft     += clientRect.xLeft;
    1540          pClipRect->xRight    += clientRect.xLeft;
    1541          pClipRect->yTop      += clientRect.yBottom;
    1542          pClipRect->yBottom   += clientRect.yBottom;
    1543          WinIntersectRect ((HAB) 0, pClipRect, pClipRect, &clientRect);
     1650         WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect);
     1651    }
     1652    else {
     1653         pClipOS2 = &clientRect;
    15441654    }
    15451655
     
    15471657
    15481658    rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
    1549                          pScrollRect, pClipRect, NULLHANDLE,
     1659                         pScrollOS2, pClipOS2, NULLHANDLE,
    15501660                         NULL, scrollFlags);
    15511661
    15521662    return (rc != RGN_ERROR);
    15531663}
    1554 #endif
    15551664//******************************************************************************
    15561665//******************************************************************************
     
    15581667                            HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag)
    15591668{
    1560     Win32BaseWindow *window;
    1561     APIRET  rc;
    1562     RECTL   scrollRect;
    1563     RECTL   clipRect;
    1564     ULONG   scrollFlags = 0;
    1565     int     regionType = ERROR_W;
     1669 Win32BaseWindow *window;
     1670 APIRET  rc;
     1671 RECTL   clientRect;
     1672 RECTL   scrollRect;
     1673 RECTL   clipRect;
     1674 PRECTL  pScrollOS2 = NULL;
     1675 PRECTL  pClipOS2   = NULL;
     1676 ULONG   scrollFlags = 0;
     1677 int     regionType = ERROR_W;
    15661678
    15671679    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    15781690    if (scrollFlag & SW_SCROLLCHILDREN_W)  scrollFlags |= SW_SCROLLCHILDREN;
    15791691
    1580     if(pScroll) mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    1581     if(pClip)   mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
     1692    mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
     1693
     1694    if(pScroll) {
     1695        mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
     1696        pScrollOS2 = &scrollRect;
     1697
     1698        //Scroll rectangle relative to client area
     1699        WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
     1700    }
     1701    else {
     1702        pScrollOS2 = &clientRect;
     1703        scrollFlags |= SW_SCROLLCHILDREN;  //TODO: ?????
     1704    }
     1705
     1706    if(pClip) {
     1707         mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
     1708         pClipOS2 = &clipRect;
     1709
     1710         //Clip rectangle relative to client area
     1711         WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect);
     1712    }
     1713    else {
     1714         pClipOS2 = &clientRect;
     1715    }
    15821716
    15831717    RECTL rectlUpdate;
     
    15931727
    15941728    LONG lComplexity = WinScrollWindow (window->getOS2WindowHandle(), dx, dy,
    1595                                         (pScroll) ? &scrollRect : NULL,
    1596                                         (pClip) ? &clipRect : NULL,
     1729                                        pScrollOS2,
     1730                                        pClipOS2,
    15971731                                        hrgn, &rectlUpdate, scrollFlags);
    15981732    if (lComplexity == RGN_ERROR)
     
    16021736
    16031737    RECT winRectUpdate;
    1604     LONG height = window->getClientHeight();
    1605 
    1606     winRectUpdate.left   = rectlUpdate.xLeft;
    1607     winRectUpdate.right  = rectlUpdate.xRight;
    1608     winRectUpdate.top    = height - rectlUpdate.yTop;
    1609     winRectUpdate.bottom = height - rectlUpdate.yBottom;
     1738
     1739    mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
    16101740
    16111741    if (pRectUpdate)
     
    16131743
    16141744    if (hrgnUpdate)
    1615        rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, height);
    1616 
     1745       rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, window->getWindowHeight());
     1746
     1747#if 0
    16171748    //SvL: WinScrollWindow already invalidates the area; no need to do it again
    16181749    //(call to invalidateRect was wrong; has to include erase flag)
    1619 #if 0
    16201750    if ((scrollFlag & SW_INVALIDATE_W) &&
    16211751        ((lComplexity == RGN_RECT) || (lComplexity == RGN_COMPLEX)))
Note: See TracChangeset for help on using the changeset viewer.