Changeset 5899 for trunk/src


Ignore:
Timestamp:
Jun 3, 2001, 2:02:26 PM (24 years ago)
Author:
sandervl
Message:

ScrollDC Wine port + fixes

Location:
trunk/src/user32
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r5685 r5899  
    1 # $Id: Makefile,v 1.83 2001-05-11 08:39:41 sandervl Exp $
     1# $Id: Makefile,v 1.84 2001-06-03 12:02:25 sandervl Exp $
    22
    33#
     
    3030$(OBJDIR)\dc.obj \
    3131$(OBJDIR)\dcrgn.obj \
     32$(OBJDIR)\dcscroll.obj \
    3233$(OBJDIR)\user32.obj \
    3334$(OBJDIR)\loadres.obj \
  • trunk/src/user32/dc.cpp

    r5882 r5899  
    1 /* $Id: dc.cpp,v 1.107 2001-06-02 14:26:52 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.108 2001-06-03 12:02:26 sandervl Exp $ */
    22
    33/*
     
    12831283    if(WinQueryUpdateRect(hwnd, &rectl))
    12841284    {
     1285        dprintf2(("Update region (%d,%d)(%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
    12851286        //TODO: Does this work if RDW_ALLCHILDREN is set??
    12861287        if(redraw & RDW_UPDATENOW_W) {
     
    14881489}
    14891490//******************************************************************************
    1490 //TODO: Check if this one works correctly...
    1491 //Have to check if dc is for frame or client!!
    1492 //******************************************************************************
    1493 BOOL WIN32API ScrollDC(HDC hDC, int dx, int dy, const RECT *pScroll,
    1494                        const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
    1495 {
    1496     Win32BaseWindow *wnd;
    1497     BOOL rc = TRUE;
    1498 
    1499     if (!hDC)
    1500     {
    1501         dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x -> invalid hdc", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    1502         return (FALSE);
    1503     }
    1504 
    1505     pDCData pHps         = (pDCData)GpiQueryDCData ((HPS)hDC);
    1506     HWND    hwnd         = pHps->hwnd;
    1507     if(pHps->isClient) {
    1508         wnd = Win32BaseWindow::GetWindowFromOS2Handle (hwnd);
    1509     }
    1510     else {
    1511         //assume (for now) that this is not allowed (TODO)
    1512         dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    1513         dprintf(("ScrollDC used for frame HDC!!"));
    1514         DebugInt3();
    1515         return FALSE;
    1516     }
    1517     if((hwnd == NULLHANDLE) || !wnd)
    1518     {
    1519         dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x -> invalid window handle", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    1520         return (FALSE);
    1521     }
    1522 
    1523     dprintf (("USER32: ScrollDC %x (hwnd %x) (%d,%d), %x %x %x %x", hDC, wnd->getWindowHandle(), dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
    1524     POINTL ptl[2] = { 0, 0, dx, dy };
    1525 
    1526     GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, ptl);
    1527     dx = (int)(ptl[1].x - ptl[0].x);
    1528     dy = (int)(ptl[1].y - ptl[0].y);
    1529 
    1530     RECT scrollRect;
    1531     RECT clipRect;
    1532 
    1533     if (pClip)
    1534     {
    1535         dprintf (("ScrollDC: Clip rectangle (%d,%d)(%d,%d)", pClip->left, pClip->top, pClip->right, pClip->bottom));
    1536 #if 1
    1537         clipRect = *pClip;
    1538         LPtoDP(hDC, (LPPOINT)&clipRect, 2);
    1539 #else
    1540         memcpy(&clipRect, pClip, sizeof(clipRect));
    1541 
    1542         if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1543             (clipRect.left   != clipRect.right)   &&
    1544             (clipRect.bottom != clipRect.top))
    1545         {
    1546             if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1547                 clipRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    1548             else
    1549                 clipRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    1550 
    1551             if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1552                 clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
    1553             else
    1554                 clipRect.top    += abs(pHps->worldYDeltaFor1Pixel);
    1555         }
    1556         GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
    1557         if (clipRect.right < clipRect.left) {
    1558             ULONG temp     = clipRect.left;
    1559             clipRect.left  = clipRect.right;
    1560             clipRect.right = temp;
    1561         }
    1562         if (clipRect.bottom < clipRect.top) {
    1563             ULONG temp       = clipRect.top;
    1564             clipRect.top     = clipRect.bottom;
    1565             clipRect.bottom  = temp;
    1566         }
    1567 #endif
    1568     }
    1569 
    1570     if (pScroll)
    1571     {
    1572 #if 1
    1573         dprintf (("ScrollDC: Scroll rectangle (%d,%d)(%d,%d)", pScroll->left, pScroll->top, pScroll->right, pScroll->bottom));
    1574         scrollRect = *pScroll;
    1575         LPtoDP(hDC, (LPPOINT)&scrollRect, 2);
    1576 #else
    1577         memcpy(&scrollRect, pScroll, sizeof(scrollRect));
    1578 
    1579         if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
    1580             (scrollRect.left != scrollRect.right)   &&
    1581             (scrollRect.top  != scrollRect.bottom))
    1582         {
    1583             if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
    1584                 scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel);
    1585             else
    1586                 scrollRect.left  += abs(pHps->worldXDeltaFor1Pixel);
    1587 
    1588             if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
    1589                 scrollRect.bottom  -= abs(pHps->worldYDeltaFor1Pixel);
    1590             else
    1591                 scrollRect.top     += abs(pHps->worldYDeltaFor1Pixel);
    1592         }
    1593         GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
    1594         if (scrollRect.right < scrollRect.left) {
    1595             ULONG temp       = scrollRect.left;
    1596             scrollRect.left  = scrollRect.right;
    1597             scrollRect.right = temp;
    1598         }
    1599         if (scrollRect.bottom < scrollRect.top) {
    1600             ULONG temp        = scrollRect.top;
    1601             scrollRect.top    = scrollRect.bottom;
    1602             scrollRect.bottom = temp;
    1603         }
    1604 #endif
    1605     }
    1606     RECTL  rectlUpdate;
    1607     HRGN   hrgn = NULLHANDLE;
    1608     RECTL  clipOS2;
    1609     RECTL  scrollOS2;
    1610     PRECTL pScrollOS2 = NULL;
    1611     PRECTL pClipOS2   = NULL;
    1612     HPS    hpsScreen  = 0;
    1613 
    1614     if(pScroll) {
    1615         mapWin32ToOS2Rect(wnd->getClientHeight(), &scrollRect, (PRECTLOS2)&scrollOS2);
    1616         pScrollOS2 = &scrollOS2;
    1617         dprintf2(("ScrollDC: PM Scroll rectangle (%d,%d)(%d,%d)", pScrollOS2->xLeft, pScrollOS2->yBottom, pScrollOS2->xRight, pScrollOS2->yTop));
    1618     }
    1619 
    1620     if(pClip) {
    1621         mapWin32ToOS2Rect(wnd->getClientHeight(), &clipRect, (PRECTLOS2)&clipOS2);
    1622         pClipOS2 = &clipOS2;
    1623         dprintf2(("ScrollDC: PM Clip rectangle (%d,%d)(%d,%d)", pClipOS2->xLeft, pClipOS2->yBottom, pClipOS2->xRight, pClipOS2->yTop));
    1624     }
    1625 
    1626     if(hrgnUpdate) {
    1627         RECTL rectl = { 1, 1, 2, 2 };
    1628 
    1629         hpsScreen = WinGetScreenPS (HWND_DESKTOP);
    1630         hrgn      = GpiCreateRegion(hpsScreen, 1, &rectl);
    1631     }
    1632 
    1633     LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
    1634                                        pClipOS2, hrgn, &rectlUpdate, 0);
    1635     if (lComplexity == RGN_ERROR)
    1636     {
    1637         dprintf(("ScrollDC: lComplexity == RGN_ERROR" ));
    1638         return (FALSE);
    1639     }
    1640 
    1641     RECT winRectUpdate;
    1642 
    1643     dprintf2(("ScrollDC: PM Update rectangle (%d,%d)(%d,%d)", rectlUpdate.xLeft, rectlUpdate.yBottom, rectlUpdate.xRight, rectlUpdate.yTop));
    1644 
    1645     mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
    1646 
    1647     dprintf2(("ScrollDC: Update rectangle (%d,%d)(%d,%d)", winRectUpdate.left, winRectUpdate.top, winRectUpdate.right, winRectUpdate.bottom));
    1648 
    1649     if (pRectUpdate)
    1650         *pRectUpdate = winRectUpdate;
    1651 
    1652     if (hrgnUpdate) {
    1653         rc = setPMRgnIntoWinRgn(hpsScreen, hrgn, hrgnUpdate, wnd->getClientHeight());
    1654         GpiDestroyRegion(hpsScreen, hrgn);
    1655         WinReleasePS(hpsScreen);
    1656     }
    1657 
    1658     return (rc);
    1659 }
    1660 //******************************************************************************
    16611491//Using WinScrollWindow to scroll child windows is better (smoother).
    16621492//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.