Changeset 5152 for trunk/src


Ignore:
Timestamp:
Feb 17, 2001, 8:25:08 PM (25 years ago)
Author:
sandervl
Message:

ScrollWindow(Ex) bugfix for scrolling child windows

File:
1 edited

Legend:

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

    r5146 r5152  
    1 /* $Id: dc.cpp,v 1.84 2001-02-17 14:49:25 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.85 2001-02-17 19:25:08 sandervl Exp $ */
    22
    33/*
     
    8686   rc = GpiQueryRegionRects(hps, hrgnClip, NULL, &rgnRect, &rectRegion[0]);
    8787   for(int i=0;i<rgnRect.crcReturned;i++) {
    88         dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
     88        dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
    8989   }
    9090}
     
    354354   if(pHps->isClientArea)
    355355   {
    356         dprintf2(("removeClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
    357         pHps->isClientArea = FALSE;
    358         GreSetupDC(pHps->hps,
     356        dprintf2(("removeClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
     357        pHps->isClientArea = FALSE;
     358        GreSetupDC(pHps->hps,
    359359                   pHps->hrgnVis,
    360360                   pHps->ptlOrigin.x,
     
    380380
    381381   if(pClient->left == 0 && pClient->top == 0 &&
    382       window->getClientHeight() == window->getWindowHeight() && 
     382      window->getClientHeight() == window->getWindowHeight() &&
    383383      window->getClientWidth()  == window->getWindowWidth())
    384384   {
    385         //client rectangle = frame rectangle -> no change necessary
    386         return;
     385        //client rectangle = frame rectangle -> no change necessary
     386        return;
    387387   }
    388388   pHps->isClient = TRUE;
     
    395395   GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
    396396
    397    if(pHps->isClientArea) 
    398    {
    399         //TODO: counter
    400         dprintf2(("WARNING: selectClientArea %x; already selected! origin (%d,%d) original origin (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
    401         RECT rectWindow;
     397   if(pHps->isClientArea)
     398   {
     399        //TODO: counter
     400        dprintf2(("WARNING: selectClientArea %x; already selected! origin (%d,%d) original origin (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
     401        RECT rectWindow;
    402402        RECTL rectWindowOS2;
    403         GetWindowRect(window->getWindowHandle(), &rectWindow);
    404         mapWin32ToOS2Rect(OSLibGetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);
    405         if(rectWindowOS2.xLeft + rcl.xLeft != rcltemp.xLeft ||
    406            rectWindowOS2.yBottom + rcl.yBottom != rcltemp.yBottom) 
     403        GetWindowRect(window->getWindowHandle(), &rectWindow);
     404        mapWin32ToOS2Rect(OSLibGetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);
     405        if(rectWindowOS2.xLeft + rcl.xLeft != rcltemp.xLeft ||
     406           rectWindowOS2.yBottom + rcl.yBottom != rcltemp.yBottom)
    407407        {
    408                 dprintf2(("WARNING: origin changed (%d,%d) instead of (%d,%d)!", rcltemp.xLeft, rcltemp.yBottom, rectWindowOS2.xLeft + rcl.xLeft, rectWindowOS2.yBottom + rcl.yBottom));
    409                 rcl.xLeft   += rectWindowOS2.xLeft;
    410                 rcl.xRight  += rectWindowOS2.xLeft;
    411                 rcl.yTop    += rectWindowOS2.yBottom;
    412                 rcl.yBottom += rectWindowOS2.yBottom;
    413         }
    414         else    return;
     408                dprintf2(("WARNING: origin changed (%d,%d) instead of (%d,%d)!", rcltemp.xLeft, rcltemp.yBottom, rectWindowOS2.xLeft + rcl.xLeft, rectWindowOS2.yBottom + rcl.yBottom));
     409                rcl.xLeft   += rectWindowOS2.xLeft;
     410                rcl.xRight  += rectWindowOS2.xLeft;
     411                rcl.yTop    += rectWindowOS2.yBottom;
     412                rcl.yBottom += rectWindowOS2.yBottom;
     413        }
     414        else    return;
    415415   }
    416416   else {
     
    423423        pHps->ptlOrigin.y = rcltemp.yBottom;
    424424   }
    425  
     425
    426426   dprintf2(("selectClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));
    427427
    428428   if(pHps->hrgnVis == 0)
    429         pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1);
     429        pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1);
    430430
    431431   hrgnRect = GreCreateRectRegion(pHps->hps, &rcl, 1);
     
    440440   dprintfRegion1(pHps->hps, window->getWindowHandle(), hrgnRect);
    441441#endif
    442      
     442
    443443   // Set the new origin plus visible region in the DC
    444444   GreSetupDC(pHps->hps,
     
    463463   if ((hwnd != 0) || (pHps == 0))
    464464   {
    465         if(wnd) {
    466                 if(pHps && !pHps->isClientArea) {
    467                         return (wnd->getWindowHeight());
    468                 }
    469                 else    return (wnd->getClientHeight());
    470         }
    471         else    return OSLibQueryScreenHeight();
     465        if(wnd) {
     466                if(pHps && !pHps->isClientArea) {
     467                        return (wnd->getWindowHeight());
     468                }
     469                else    return (wnd->getClientHeight());
     470        }
     471        else    return OSLibQueryScreenHeight();
    472472   }
    473473   else if (pHps->bitmapHandle)
     
    631631{
    632632   pDCData pHps = (pDCData)GpiQueryDCData ((HPS)hps);
    633  
     633
    634634   dprintf2(("releaseOwnDC %x", hps));
    635635
     
    695695
    696696   if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) {
    697         memset(&rectl, 0, sizeof(rectl));
     697        memset(&rectl, 0, sizeof(rectl));
    698698        dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!"));
    699699
    700         HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl);
    701         GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
    702 
    703         selectClientArea(wnd, pHps);
     700        HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl);
     701        GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
     702
     703        selectClientArea(wnd, pHps);
    704704
    705705        //save old clip region (restored for CS_OWNDC windows in EndPaint)
    706706        wnd->SetClipRegion(hrgnOldClip);
    707         lComplexity = RGN_NULL;
     707        lComplexity = RGN_NULL;
    708708   }
    709709   else {
    710         rectlClip.yBottom = rectlClip.xLeft = 0;
    711         rectlClip.yTop = rectlClip.xRight = 1;
    712 
    713         //Query update region
    714         HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectlClip);
    715         WinQueryUpdateRegion(hwndClient, hrgnClip);
     710        rectlClip.yBottom = rectlClip.xLeft = 0;
     711        rectlClip.yTop = rectlClip.xRight = 1;
     712
     713        //Query update region
     714        HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectlClip);
     715        WinQueryUpdateRegion(hwndClient, hrgnClip);
    716716        WinValidateRegion(hwndClient, hrgnClip, FALSE);
    717717
    718         mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
    719         WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient);
    720         WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom);
    721 
    722         //clip update region with client window rectangle
    723         HRGN hrgnClient = GpiCreateRegion(pHps->hps, 1, &rectlClient);
    724         GpiCombineRegion(pHps->hps, hrgnClip, hrgnClip, hrgnClient, CRGN_AND);
    725         GpiDestroyRegion(pHps->hps, hrgnClient);
    726 
    727         //change origin of clip region (window -> client)
    728         POINTL point = {-rectlClient.xLeft, -rectlClient.yBottom};
    729         GpiOffsetRegion(pHps->hps, hrgnClip, &point);
     718        mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
     719        WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient);
     720        WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom);
     721
     722        //clip update region with client window rectangle
     723        HRGN hrgnClient = GpiCreateRegion(pHps->hps, 1, &rectlClient);
     724        GpiCombineRegion(pHps->hps, hrgnClip, hrgnClip, hrgnClient, CRGN_AND);
     725        GpiDestroyRegion(pHps->hps, hrgnClient);
     726
     727        //change origin of clip region (window -> client)
     728        POINTL point = {-rectlClient.xLeft, -rectlClient.yBottom};
     729        GpiOffsetRegion(pHps->hps, hrgnClip, &point);
    730730#ifdef DEBUG
    731731        dprintfRegion1(pHps->hps, hWnd, hrgnClip);
    732732#endif
    733         //set clip region
    734         lComplexity = GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
    735 
    736         //change presentation space for client window
     733        //set clip region
     734        lComplexity = GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
     735
     736        //change presentation space for client window
    737737        //NOTE: MUST do this after GpiSetClipRegion call!
    738738        //      When a window with CS_OWNDC looses focus, for some reason
    739739        //      GpiSetClipRegion resets the window dc origin back to (0,0)
    740         selectClientArea(wnd, pHps);
     740        selectClientArea(wnd, pHps);
    741741
    742742        GpiQueryClipBox(pHps->hps, &rectl);
     
    745745        //save old clip region (restored for CS_OWNDC windows in EndPaint)
    746746        wnd->SetClipRegion(hrgnOldClip);
    747         memcpy(&rectl, &rectlClip, sizeof(RECTL));
    748         lComplexity = RGN_RECT;
     747        memcpy(&rectl, &rectlClip, sizeof(RECTL));
     748        lComplexity = RGN_RECT;
    749749   }
    750750
     
    809809   if (pHps && (pHps->hdcType == TYPE_3))
    810810   {
    811         GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld);
     811        GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld);
    812812        wnd->SetClipRegion(0);
    813813        if(hrgnOld) {
    814814                GpiDestroyRegion(pHps->hps, hrgnOld);
    815815        }
    816         pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails
     816        pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails
    817817        ReleaseDC(hwnd, pPaint->hdc);
    818818   }
     
    843843        }
    844844        isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
    845         if(!isOwnDC)
    846         {
    847                 pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
    848                 if(pHps && pHps->psType == MICRO_CACHED) {
    849                         removeClientArea(wnd, pHps);
    850                         if(pHps->hrgnVis) {
    851                                 GreDestroyRegion(pHps->hps, pHps->hrgnVis);
    852                                 pHps->hrgnVis = 0;
    853                         }
    854                 }       
    855                 else {
    856                         dprintf(("ERROR: ReleaseDC: pHps == NULL!!"));
    857                         DebugInt3();
    858                 }
    859         }
    860         else {
    861                 dprintf2(("ReleaseDC: CS_OWNDC, not released"));
    862         }
     845        if(!isOwnDC)
     846        {
     847                pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     848                if(pHps && pHps->psType == MICRO_CACHED) {
     849                        removeClientArea(wnd, pHps);
     850                        if(pHps->hrgnVis) {
     851                                GreDestroyRegion(pHps->hps, pHps->hrgnVis);
     852                                pHps->hrgnVis = 0;
     853                        }
     854                }
     855                else {
     856                        dprintf(("ERROR: ReleaseDC: pHps == NULL!!"));
     857                        DebugInt3();
     858                }
     859        }
     860        else {
     861                dprintf2(("ReleaseDC: CS_OWNDC, not released"));
     862        }
    863863   }
    864864
    865865   if(isOwnDC) {
    866         rc = TRUE;
     866        rc = TRUE;
    867867   }
    868868   else {
    869         rc = O32_ReleaseDC (0, hdc);
     869        rc = O32_ReleaseDC (0, hdc);
    870870   }
    871871
     
    929929        selectClientArea(wnd, pHps);
    930930
    931         //TODO: Is this always necessary??
     931        //TODO: Is this always necessary??
    932932        setPageXForm (wnd, pHps);
    933933        pHps->hdcType = TYPE_1;
    934934
    935         //TODO: intersect/exclude clip region?
     935        //TODO: intersect/exclude clip region?
    936936        dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
    937937        return (HDC)hps;
     
    957957      }
    958958      else {
    959         int clipstyle = 0;
    960         int clipwnd   = HWND_TOP;
    961         if(flags & (DCX_USESTYLE_W)) {
    962                 int style = wnd->getStyle();
    963                 if(style & WS_CLIPCHILDREN_W) {
    964                         clipstyle |= PSF_CLIPCHILDREN;
    965                 }
    966                 if(style & WS_CLIPSIBLINGS_W) {
    967                         clipstyle |= PSF_CLIPSIBLINGS;
    968                 }
    969                 if(wnd->fHasParentDC()) {
    970                         clipstyle |= PSF_PARENTCLIP;
    971                 }
    972         }
    973         if(flags & DCX_CLIPSIBLINGS_W) {
    974                 clipstyle |= PSF_CLIPSIBLINGS;
    975         }
    976         if(flags & DCX_CLIPCHILDREN_W) {
    977                 clipstyle |= PSF_CLIPCHILDREN;
    978         }
    979         if(flags & DCX_PARENTCLIP_W) {
    980                 clipstyle |= PSF_PARENTCLIP;
    981         }
     959        int clipstyle = 0;
     960        int clipwnd   = HWND_TOP;
     961        if(flags & (DCX_USESTYLE_W)) {
     962                int style = wnd->getStyle();
     963                if(style & WS_CLIPCHILDREN_W) {
     964                        clipstyle |= PSF_CLIPCHILDREN;
     965                }
     966                if(style & WS_CLIPSIBLINGS_W) {
     967                        clipstyle |= PSF_CLIPSIBLINGS;
     968                }
     969                if(wnd->fHasParentDC()) {
     970                        clipstyle |= PSF_PARENTCLIP;
     971                }
     972        }
     973        if(flags & DCX_CLIPSIBLINGS_W) {
     974                clipstyle |= PSF_CLIPSIBLINGS;
     975        }
     976        if(flags & DCX_CLIPCHILDREN_W) {
     977                clipstyle |= PSF_CLIPCHILDREN;
     978        }
     979        if(flags & DCX_PARENTCLIP_W) {
     980                clipstyle |= PSF_PARENTCLIP;
     981        }
    982982        if(clipstyle) {
    983                 dprintf2(("WinGetClipPS style %x", clipstyle));
    984                 hps = WinGetClipPS(hWindow, clipwnd, clipstyle);
    985         }
    986         else    hps = WinGetPS (hWindow);
     983                dprintf2(("WinGetClipPS style %x", clipstyle));
     984                hps = WinGetClipPS(hWindow, clipwnd, clipstyle);
     985        }
     986        else    hps = WinGetPS (hWindow);
    987987
    988988        // default cp is OS/2 one: set to windows default (ODIN.INI)
     
    10001000   if(!(flags & DCX_WINDOW_W))
    10011001   {
    1002         selectClientArea(wnd, pHps);
     1002        selectClientArea(wnd, pHps);
    10031003   }
    10041004   else removeClientArea(wnd, pHps);
     
    11681168            return FALSE;
    11691169        }
    1170         hwnd = wnd->getOS2WindowHandle();
     1170        hwnd = wnd->getOS2WindowHandle();
    11711171   }
    11721172
     
    11861186
    11871187      if(wnd) {
    1188                 height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight();
    1189       }
    1190       else      height = OSLibQueryScreenHeight();
     1188                height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight();
     1189      }
     1190      else      height = OSLibQueryScreenHeight();
    11911191
    11921192      if (!hrgn)
     
    12131213   {
    12141214      if(wnd) {
    1215                 if(redraw & RDW_FRAME_W) {
    1216                         mapWin32ToOS2Rect(wnd->getWindowHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
    1217                 }
    1218                 else    mapWin32ToOS2RectClientToFrame(wnd, (PRECT)pRect, (PRECTLOS2)&rectl);
    1219       }
    1220       else      mapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
     1215                if(redraw & RDW_FRAME_W) {
     1216                        mapWin32ToOS2Rect(wnd->getWindowHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
     1217                }
     1218                else    mapWin32ToOS2RectClientToFrame(wnd, (PRECT)pRect, (PRECTLOS2)&rectl);
     1219      }
     1220      else      mapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
    12211221   }
    12221222
     
    12271227             wnd->setEraseBkgnd(TRUE);
    12281228        }
    1229         else
     1229        else
    12301230        if (redraw & RDW_NOERASE_W)
    12311231            wnd->setEraseBkgnd(FALSE);
     
    12371237            success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
    12381238            if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
    1239                 dprintf(("WARNING: WinQueryUpdateRect %x region %x returned false even though we just invalidated part of a window!!!", hwnd, hrgnTemp));
     1239                dprintf(("WARNING: WinQueryUpdateRect %x region %x returned false even though we just invalidated part of a window!!!", hwnd, hrgnTemp));
    12401240                success = success = WinInvalidateRegion (hwnd, hrgnTemp, FALSE);
    12411241            }
     
    12461246//SvL: If all children are included, then WinInvalidateRect is called
    12471247//     with fIncludeChildren=1 -> rect of hwnd isn't invalidated if child(ren)
    1248 //     overlap(s) the specified rectangle completely (EVEN if window doesn't 
     1248//     overlap(s) the specified rectangle completely (EVEN if window doesn't
    12491249//     have WS_CLIPCHILREN!)
    12501250//     -> example: XWing vs Tie Fighter install window
     
    12591259//
    12601260            if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
    1261                 dprintf(("WARNING: WinQueryUpdateRect %x (%d,%d)(%d,%d) returned false even though we just invalidated part of a window!!!", hwnd, rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
     1261                dprintf(("WARNING: WinQueryUpdateRect %x (%d,%d)(%d,%d) returned false even though we just invalidated part of a window!!!", hwnd, rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
    12621262                success = WinInvalidateRect (hwnd, &rectl, FALSE);
    12631263            }
     
    12911291        //TODO: Does this work if RDW_ALLCHILDREN is set??
    12921292        if(redraw & RDW_UPDATENOW_W) {
    1293                 wnd->MsgNCPaint();
     1293                wnd->MsgNCPaint();
    12941294                wnd->MsgPaint(0, FALSE);
    12951295        }
     
    12981298        if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd())
    12991299                wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0);
    1300 //      if(redraw & RDW_ALLCHILDREN_W) {
    1301 //              EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
    1302 //      }
     1300//      if(redraw & RDW_ALLCHILDREN_W) {
     1301//              EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
     1302//      }
    13031303   }
    13041304   else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
    13051305   {
    13061306        if(redraw & RDW_UPDATENOW_W) {
    1307                 wnd->MsgNCPaint();
     1307                wnd->MsgNCPaint();
    13081308                wnd->MsgPaint (0, FALSE);
    1309         }
     1309        }
    13101310        else    PostMessageA(hwnd, WINWM_PAINT, 0, 0);
    13111311   }
     
    13201320
    13211321   if (!success) {
    1322         dprintf(("RedrawWindow failure!"));
    1323         SetLastError(ERROR_INVALID_PARAMETER_W);
     1322        dprintf(("RedrawWindow failure!"));
     1323        SetLastError(ERROR_INVALID_PARAMETER_W);
    13241324   }
    13251325   return (success);
     
    13711371
    13721372   if(pRect) {
    1373         dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase));
     1373        dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase));
    13741374   }
    13751375   else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase));
     
    15801580   }
    15811581   else {
    1582         pScrollOS2 = &clientRect;
     1582        pScrollOS2 = &clientRect;
    15831583   }
    15841584
     
    15911591   }
    15921592   else {
    1593         pClipOS2 = &clientRect;
    1594    }
    1595 
    1596    LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2, 
     1593        pClipOS2 = &clientRect;
     1594   }
     1595
     1596   LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
    15971597                                      pClipOS2, hrgn, &rectlUpdate, 0);
    15981598   if (lComplexity == RGN_ERROR)
     
    16151615//******************************************************************************
    16161616//******************************************************************************
    1617 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
     1617INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip,
     1618                            HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag)
    16181619{
    16191620 Win32BaseWindow *window;
     
    16241625 PRECTL  pScrollOS2 = NULL;
    16251626 PRECTL  pClipOS2   = NULL;
    1626  ULONG   scrollFlags = SW_INVALIDATERGN;
    1627 
    1628     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    1629     if(!window) {
    1630         dprintf(("ScrollWindow, window %x not found", hwnd));
    1631         return 0;
    1632     }
    1633     dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
    1634 
    1635     mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
    1636 
    1637     if(pScroll) {
    1638         mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    1639         pScrollOS2 = &scrollRect;
    1640 
    1641         //Scroll rectangle relative to client area
    1642         WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
    1643     }
    1644     else {
    1645         pScrollOS2 = &clientRect;
    1646         scrollFlags |= SW_SCROLLCHILDREN;
    1647     }
    1648 
    1649     if(pClip) {
    1650          mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
    1651          pClipOS2 = &clipRect;
    1652 
    1653          //Clip rectangle relative to client area
    1654          WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect);
    1655     }
    1656     else {
    1657          pClipOS2 = &clientRect;
    1658     }
    1659 
    1660     dy = revertDy (window, dy);
    1661 
    1662     rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
    1663                          pScrollOS2, pClipOS2, NULLHANDLE,
    1664                          NULL, scrollFlags);
    1665 
    1666     return (rc != RGN_ERROR);
    1667 }
    1668 //******************************************************************************
    1669 //******************************************************************************
    1670 INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip,
    1671                             HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag)
    1672 {
    1673  Win32BaseWindow *window;
    1674  APIRET  rc;
    1675  RECTL   clientRect;
    1676  RECTL   scrollRect;
    1677  RECTL   clipRect;
    1678  PRECTL  pScrollOS2 = NULL;
    1679  PRECTL  pClipOS2   = NULL;
    1680  ULONG   scrollFlags = 0;
     1627 ULONG   scrollFlagsOS2 = 0;
     1628 int     orgdy = dy;
    16811629 int     regionType = ERROR_W;
    16821630
     
    16911639    dy = revertDy (window, dy);
    16921640
    1693     if (scrollFlag & SW_INVALIDATE_W)      scrollFlags |= SW_INVALIDATERGN;
    1694     if (scrollFlag & SW_SCROLLCHILDREN_W)  scrollFlags |= SW_SCROLLCHILDREN;
     1641    if (scrollFlag & SW_INVALIDATE_W)      scrollFlagsOS2 |= SW_INVALIDATERGN;
    16951642
    16961643    mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
     
    17041651    }
    17051652    else {
    1706         pScrollOS2 = &clientRect;
    1707         scrollFlags |= SW_SCROLLCHILDREN;  //TODO: ?????
     1653        pScrollOS2 = &clientRect;
    17081654    }
    17091655
     
    17161662    }
    17171663    else {
    1718         pClipOS2 = &clientRect;
     1664        pClipOS2 = &clientRect;
    17191665    }
    17201666
     
    17301676    }
    17311677
     1678    // Scroll children first
     1679    if (scrollFlag & SW_SCROLLCHILDREN_W)
     1680    {
     1681        HWND hwndChild;
     1682        RECT rectChild, rc;
     1683
     1684            dprintf(("ScrollWindowEx: Scroll child windows"));
     1685            GetClientRect(hwnd, &rc);
     1686            if (pScroll) IntersectRect(&rc, &rc, pScroll);
     1687
     1688            hwndChild = GetWindow(hwnd, GW_CHILD_W);
     1689
     1690            while(hwndChild)
     1691            {
     1692                Win32BaseWindow *child;
     1693
     1694                child = Win32BaseWindow::GetWindowFromHandle(hwndChild);
     1695                if(!child) {
     1696                    dprintf(("ScrollWindowEx, child %x not found", hwnd));
     1697                    return 0;
     1698                }
     1699                rectChild = *child->getWindowRect();
     1700                if(pRectUpdate || IntersectRect(&rectChild, &rectChild, &rc))
     1701                {
     1702                     dprintf(("ScrollWindowEx: Scroll child window %x", hwndChild));
     1703                     SetWindowPos(hwndChild, 0, rectChild.left + dx,
     1704                                  rectChild.top + orgdy, 0, 0, SWP_NOZORDER_W |
     1705                                  SWP_NOSIZE_W | SWP_NOACTIVATE_W | SWP_NOREDRAW);
     1706                }
     1707                hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W);
     1708            }
     1709            dprintf(("***ScrollWindowEx: Scroll child windows DONE"));
     1710    }
     1711
    17321712    LONG lComplexity = WinScrollWindow (window->getOS2WindowHandle(), dx, dy,
    17331713                                        pScrollOS2,
    17341714                                        pClipOS2,
    1735                                         hrgn, &rectlUpdate, scrollFlags);
     1715                                        hrgn, &rectlUpdate, scrollFlagsOS2);
    17361716    if (lComplexity == RGN_ERROR)
    17371717    {
     
    17831763//******************************************************************************
    17841764//******************************************************************************
     1765BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
     1766{
     1767 Win32BaseWindow *window;
     1768
     1769    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     1770    if(!window) {
     1771        dprintf(("ScrollWindow, window %x not found", hwnd));
     1772        return 0;
     1773    }
     1774    dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
     1775    return (ERROR_W != ScrollWindowEx(hwnd, dx, dy, pScroll, pClip, 0, NULL,
     1776                                      (pScroll ? 0 : SW_SCROLLCHILDREN_W) |
     1777                                      SW_INVALIDATE_W ));
     1778}
     1779//******************************************************************************
     1780//******************************************************************************
    17851781HWND WIN32API WindowFromDC(HDC hdc)
    17861782{
Note: See TracChangeset for help on using the changeset viewer.