Changeset 16248


Ignore:
Timestamp:
May 11, 2001, 3:31:54 PM (24 years ago)
Author:
sandervl
Message:

ScrollDC & ScrollWindow fixes

Location:
tags/trunk/src/user32
Files:
2 edited

Legend:

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

    r16246 r16248  
    1 /* $Id: dc.cpp,v 1.99 2001-05-11 08:39:41 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.100 2001-05-11 13:31:54 sandervl Exp $ */
    22
    33/*
     
    13361336         dprintf (("User32: UpdateWindow hwnd %x: update rectangle (%d,%d)(%d,%d)", hwnd, rectUpdate.left, rectUpdate.top, rectUpdate.right, rectUpdate.bottom));
    13371337    }
    1338     else dprintf (("User32: UpdateWindow hwnd %x; EMPTY update rectangle (vis=%d/%d)", hwnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle())));
     1338    else dprintf (("User32: UpdateWindow hwnd %x; EMPTY update rectangle (vis=%d/%d, show=%d/%d)", hwnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle())));
    13391339#endif
    13401340    //SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here)
     
    14261426//TODO: Change for client rectangle!!!!!
    14271427//******************************************************************************
    1428 BOOL setPMRgnIntoWinRgn (HRGN hrgnPM, HRGN hrgnWin, LONG height)
     1428BOOL setPMRgnIntoWinRgn (HPS hps, HRGN hrgnPM, HRGN hrgnWin, LONG height)
    14291429{
    14301430   BOOL    rc;
    1431    HPS     hps = WinGetScreenPS (HWND_DESKTOP);
    14321431   RGNRECT rgnRect;
    14331432   rgnRect.ircStart    = 1;
    14341433   rgnRect.crc         = 0;
    1435    rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT;     // doesn't make a difference because we're getting them all
     1434   rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT;
    14361435
    14371436   rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, NULL);
     
    14471446         rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, Rcls);
    14481447
    1449          rc = SetRectRgn(hrgnWin, pRcl->xLeft,
    1450                          pRcl->xRight,
    1451                          height - pRcl->yTop,
    1452                          height - pRcl->yBottom);
     1448         rc = SetRectRgn(hrgnWin, pRcl->xLeft, height - pRcl->yTop,
     1449                         pRcl->xRight, height - pRcl->yBottom);
    14531450
    14541451         if (rgnRect.crcReturned > 1)
     
    14601457            for (i = 1, pRcl++; rc && (i < rgnRect.crcReturned); i++, pRcl++)
    14611458            {
    1462               rc = SetRectRgn (temp, pRcl->xLeft,
    1463                                pRcl->xRight,
    1464                                height - pRcl->yTop,
    1465                                height - pRcl->yBottom);
     1459              rc = SetRectRgn (temp, pRcl->xLeft, height - pRcl->yTop,
     1460                               pRcl->xRight, height - pRcl->yBottom);
    14661461              rc &= CombineRgn (hrgnWin, hrgnWin, temp, RGN_OR_W);
    14671462            }
     
    14801475   }
    14811476
    1482    WinReleasePS (hps);
    14831477   return (rc);
    14841478}
     
    14901484                       const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
    14911485{
    1492    BOOL rc = TRUE;
    1493 
    1494    dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    1495 
    1496    if (!hDC)
    1497    {
    1498       return (FALSE);
    1499    }
    1500 
    1501    pDCData pHps         = (pDCData)GpiQueryDCData ((HPS)hDC);
    1502    HWND    hwnd         = pHps->hwnd;
    1503    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    1504 
    1505    if((hwnd == NULLHANDLE) || !wnd)
    1506    {
    1507       return (FALSE);
    1508    }
    1509 
    1510    POINTL ptl[2] = { 0, 0, dx, dy };
    1511 
    1512    GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, ptl);
    1513    dx = (int)(ptl[1].x - ptl[0].x);
    1514    dy = (int)(ptl[1].y - ptl[0].y);
    1515 
    1516    RECT scrollRect;
    1517    RECT clipRect;
    1518 
    1519    if (pClip)
    1520    {
    1521       memcpy(&clipRect, pClip, sizeof(clipRect));
    1522 
    1523       if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1524           (clipRect.left   != clipRect.right)   &&
    1525           (clipRect.bottom != clipRect.top))
    1526       {
    1527           if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1528               clipRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    1529           else
    1530               clipRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    1531 
    1532           if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1533               clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
    1534           else
    1535               clipRect.top    += abs(pHps->worldYDeltaFor1Pixel);
    1536       }
    1537       GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
    1538       if (clipRect.right < clipRect.left) {
    1539          ULONG temp     = clipRect.left;
    1540          clipRect.left  = clipRect.right;
    1541          clipRect.right = temp;
    1542       }
    1543       if (clipRect.bottom < clipRect.top) {
    1544          ULONG temp       = clipRect.top;
    1545          clipRect.top     = clipRect.bottom;
    1546          clipRect.bottom  = temp;
    1547       }
    1548    }
    1549 
    1550    if (pScroll)
    1551    {
    1552       memcpy(&scrollRect, pScroll, sizeof(scrollRect));
    1553 
    1554       if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1555           (scrollRect.left != scrollRect.right)   &&
    1556           (scrollRect.top  != scrollRect.bottom))
    1557       {
    1558           if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1559               scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    1560           else
    1561               scrollRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    1562 
    1563           if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1564               scrollRect.bottom  -= abs(pHps->worldYDeltaFor1Pixel);
    1565           else
    1566               scrollRect.top     += abs(pHps->worldYDeltaFor1Pixel);
    1567       }
    1568       GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
    1569       if (scrollRect.right < scrollRect.left) {
    1570          ULONG temp       = scrollRect.left;
    1571          scrollRect.left  = scrollRect.right;
    1572          scrollRect.right = temp;
    1573       }
    1574       if (scrollRect.bottom < scrollRect.top) {
    1575          ULONG temp        = scrollRect.top;
    1576          scrollRect.top    = scrollRect.bottom;
    1577          scrollRect.bottom = temp;
    1578       }
    1579    }
    1580    RECTL  rectlUpdate;
    1581    HRGN   hrgn;
    1582    RECTL  clipOS2;
    1583    RECTL  scrollOS2;
    1584    PRECTL pScrollOS2 = NULL;
    1585    PRECTL pClipOS2   = NULL;
    1586 
    1587    if(pScroll) {
     1486    Win32BaseWindow *wnd;
     1487    BOOL rc = TRUE;
     1488
     1489    dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
     1490
     1491    if (!hDC)
     1492    {
     1493        return (FALSE);
     1494    }
     1495
     1496    pDCData pHps         = (pDCData)GpiQueryDCData ((HPS)hDC);
     1497    HWND    hwnd         = pHps->hwnd;
     1498    if(pHps->isClient) {
     1499        wnd = Win32BaseWindow::GetWindowFromOS2Handle (hwnd);
     1500    }
     1501    else {
     1502        //assume (for now) that this is not allowed (TODO)
     1503        dprintf(("ScrollDC used for frame HDC!!"));
     1504        DebugInt3();
     1505        return FALSE;
     1506    }
     1507
     1508    if((hwnd == NULLHANDLE) || !wnd)
     1509    {
     1510        return (FALSE);
     1511    }
     1512
     1513    POINTL ptl[2] = { 0, 0, dx, dy };
     1514
     1515    GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, ptl);
     1516    dx = (int)(ptl[1].x - ptl[0].x);
     1517    dy = (int)(ptl[1].y - ptl[0].y);
     1518
     1519    RECT scrollRect;
     1520    RECT clipRect;
     1521
     1522    if (pClip)
     1523    {
     1524        memcpy(&clipRect, pClip, sizeof(clipRect));
     1525
     1526        if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
     1527            (clipRect.left   != clipRect.right)   &&
     1528            (clipRect.bottom != clipRect.top))
     1529        {
     1530            if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
     1531                clipRect.right -= abs(pHps->worldXDeltaFor1Pixel);
     1532            else
     1533                clipRect.left  += abs(pHps->worldXDeltaFor1Pixel);
     1534
     1535            if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
     1536                clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
     1537            else
     1538                clipRect.top    += abs(pHps->worldYDeltaFor1Pixel);
     1539        }
     1540        GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
     1541        if (clipRect.right < clipRect.left) {
     1542            ULONG temp     = clipRect.left;
     1543            clipRect.left  = clipRect.right;
     1544            clipRect.right = temp;
     1545        }
     1546        if (clipRect.bottom < clipRect.top) {
     1547            ULONG temp       = clipRect.top;
     1548            clipRect.top     = clipRect.bottom;
     1549            clipRect.bottom  = temp;
     1550        }
     1551    }
     1552
     1553    if (pScroll)
     1554    {
     1555        memcpy(&scrollRect, pScroll, sizeof(scrollRect));
     1556
     1557        if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
     1558            (scrollRect.left != scrollRect.right)   &&
     1559            (scrollRect.top  != scrollRect.bottom))
     1560        {
     1561            if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
     1562                scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel);
     1563            else
     1564                scrollRect.left  += abs(pHps->worldXDeltaFor1Pixel);
     1565
     1566            if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
     1567                scrollRect.bottom  -= abs(pHps->worldYDeltaFor1Pixel);
     1568            else
     1569                scrollRect.top     += abs(pHps->worldYDeltaFor1Pixel);
     1570        }
     1571        GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
     1572        if (scrollRect.right < scrollRect.left) {
     1573            ULONG temp       = scrollRect.left;
     1574            scrollRect.left  = scrollRect.right;
     1575            scrollRect.right = temp;
     1576        }
     1577        if (scrollRect.bottom < scrollRect.top) {
     1578            ULONG temp        = scrollRect.top;
     1579            scrollRect.top    = scrollRect.bottom;
     1580            scrollRect.bottom = temp;
     1581        }
     1582    }
     1583    RECTL  rectlUpdate;
     1584    HRGN   hrgn = NULLHANDLE;
     1585    RECTL  clipOS2;
     1586    RECTL  scrollOS2;
     1587    PRECTL pScrollOS2 = NULL;
     1588    PRECTL pClipOS2   = NULL;
     1589    HPS    hpsScreen  = 0;
     1590
     1591    if(pScroll) {
    15881592        mapWin32ToOS2Rect(wnd->getClientHeight(), &scrollRect, (PRECTLOS2)&scrollOS2);
    15891593        pScrollOS2 = &scrollOS2;
    1590    }
    1591 
    1592    if(pClip) {
     1594    }
     1595
     1596    if(pClip) {
    15931597        mapWin32ToOS2Rect(wnd->getClientHeight(), &clipRect, (PRECTLOS2)&clipOS2);
    15941598        pClipOS2 = &clipOS2;
    1595    }
    1596 
    1597    LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
    1598                                       pClipOS2, hrgn, &rectlUpdate, 0);
    1599    if (lComplexity == RGN_ERROR)
    1600    {
    1601       return (FALSE);
    1602    }
    1603 
    1604    RECT winRectUpdate;
    1605 
    1606    mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
    1607 
    1608    if (pRectUpdate)
    1609       *pRectUpdate = winRectUpdate;
    1610 
    1611    if (hrgnUpdate)
    1612       rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->getClientHeight());
    1613 
    1614    return (rc);
     1599    }
     1600
     1601    if(hrgnUpdate) {
     1602        RECTL rectl = { 1, 1, 2, 2 };
     1603
     1604        hpsScreen = WinGetScreenPS (HWND_DESKTOP);
     1605        hrgn      = GpiCreateRegion(hpsScreen, 1, &rectl);
     1606    }
     1607
     1608    LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
     1609                                       pClipOS2, hrgn, &rectlUpdate, 0);
     1610    if (lComplexity == RGN_ERROR)
     1611    {
     1612        return (FALSE);
     1613    }
     1614
     1615    RECT winRectUpdate;
     1616
     1617    mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
     1618
     1619    if (pRectUpdate)
     1620        *pRectUpdate = winRectUpdate;
     1621
     1622    if (hrgnUpdate) {
     1623        rc = setPMRgnIntoWinRgn(hpsScreen, hrgn, hrgnUpdate, wnd->getClientHeight());
     1624        GpiDestroyRegion(hpsScreen, hrgn);
     1625        WinReleasePS(hpsScreen);
     1626    }
     1627
     1628    return (rc);
    16151629}
    16161630//******************************************************************************
     
    16541668
    16551669    RECTL rectlUpdate;
    1656     HRGN  hrgn;
     1670    HRGN  hrgn = NULLHANDLE;
     1671    HPS   hpsScreen  = 0;
     1672
     1673    if(hrgnUpdate) {
     1674        RECTL rectl = { 1, 1, 2, 2 };
     1675
     1676        hpsScreen = WinGetScreenPS (HWND_DESKTOP);
     1677        hrgn      = GpiCreateRegion(hpsScreen, 1, &rectl);
     1678    }
    16571679
    16581680    if (scrollFlag & SW_SMOOTHSCROLL_W)
    16591681    {
    1660       INT time = (scrollFlag >> 16) & 0xFFFF;
    1661 
    1662       //CB: todo, scroll in several steps
    1663       //    is time in ms? time <-> iteration count?
     1682        INT time = (scrollFlag >> 16) & 0xFFFF;
     1683
     1684        //CB: todo, scroll in several steps
     1685        //    is time in ms? time <-> iteration count?
    16641686    }
    16651687
     
    17141736       *pRectUpdate = winRectUpdate;
    17151737
    1716     if (hrgnUpdate)
    1717        rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, window->getClientHeight());
     1738    if (hrgnUpdate) {
     1739        rc = setPMRgnIntoWinRgn(hpsScreen, hrgn, hrgnUpdate, window->getClientHeight());
     1740        GpiDestroyRegion(hpsScreen, hrgn);
     1741        WinReleasePS(hpsScreen);
     1742    }
    17181743
    17191744#if 0
  • TabularUnified tags/trunk/src/user32/dcrgn.cpp

    r16246 r16248  
    1 /* $Id: dcrgn.cpp,v 1.4 2001-05-11 08:39:42 sandervl Exp $ */
     1/* $Id: dcrgn.cpp,v 1.5 2001-05-11 13:31:54 sandervl Exp $ */
    22
    33/*
     
    6767    BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
    6868    if (!pRect) {
     69        dprintf(("GetUpdateRect returned %d", updateRegionExists));
    6970        return (updateRegionExists);
    7071    }
     
    9596   }
    9697
     98   dprintf(("GetUpdateRect returned (%d,%d)(%d,%d)", pRect->left, pRect->top, pRect->right, pRect->bottom));
    9799   return updateRegionExists;
    98100}
Note: See TracChangeset for help on using the changeset viewer.