Ignore:
Timestamp:
Feb 14, 2000, 6:30:11 PM (26 years ago)
Author:
cbratschi
Message:

merged combobox with core 20000212

File:
1 edited

Legend:

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

    r2705 r2781  
    1 /* $Id: dc.cpp,v 1.46 2000-02-09 15:56:16 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.47 2000-02-14 17:30:11 cbratschi Exp $ */
    22
    33/*
     
    549549   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    550550   if(!lpps || !wnd) {
    551         dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
    552         O32_SetLastError (ERROR_INVALID_PARAMETER);
    553         return (HDC)0;
     551        dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
     552        O32_SetLastError (ERROR_INVALID_PARAMETER);
     553        return (HDC)0;
    554554   }
    555555   HWND hwndClient = wnd->getOS2WindowHandle();
     
    563563                if (!pHps)
    564564                {
    565                         dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
     565                        dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
    566566                        O32_SetLastError (ERROR_INVALID_PARAMETER);
    567567                        return (HDC)NULLHANDLE;
    568568                }
    569                 hpsPaint = hPS_ownDC;
     569                hpsPaint = hPS_ownDC;
    570570        }
    571571   }
    572572   if(!hpsPaint) {
    573         hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W);
     573        hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W);
    574574        pHps = (pDCData)GpiQueryDCData(hpsPaint);
    575575        if (!pHps)
    576576        {
    577                 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
     577                dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
    578578                O32_SetLastError (ERROR_INVALID_PARAMETER);
    579579                return (HDC)NULLHANDLE;
    580580        }
    581    } 
     581   }
    582582
    583583#if 0
     
    601601   lComplexity = WinQueryUpdateRegion(hwndClient, hrgnUpdate);
    602602   if(lComplexity == RGN_ERROR) {
    603         dprintf (("USER32: BeginPaint update region error!!"));
     603        dprintf (("USER32: BeginPaint update region error!!"));
    604604        O32_SetLastError (ERROR_INVALID_PARAMETER);
    605         return 0;
     605        return 0;
    606606   }
    607607   WinQueryUpdateRect(hwndClient, &rectl);
    608608
    609    if(lComplexity != RGN_NULL) { 
    610         WinValidateRegion(hwndClient, hrgnUpdate, FALSE);
    611 
    612         GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld);
    613         //save old clip region (restored for CS_OWNDC windows in EndPaint)
    614         wnd->SetClipRegion(hrgnOld);
     609   if(lComplexity != RGN_NULL) {
     610        WinValidateRegion(hwndClient, hrgnUpdate, FALSE);
     611
     612        GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld);
     613        //save old clip region (restored for CS_OWNDC windows in EndPaint)
     614        wnd->SetClipRegion(hrgnOld);
    615615   }
    616616
     
    621621   lpps->fErase = wnd->isPSErase(); //correct ??
    622622   lpps->hdc    = (HDC)pHps->hps;
    623    
     623
    624624   if(lComplexity != RGN_NULL) {
    625         long height  = wnd->getClientHeight();
    626         lpps->rcPaint.top    = height - rectl.yTop;
    627         lpps->rcPaint.left   = rectl.xLeft;
    628         lpps->rcPaint.bottom = height - rectl.yBottom;
    629         lpps->rcPaint.right  = rectl.xRight;
     625        long height  = wnd->getClientHeight();
     626        lpps->rcPaint.top    = height - rectl.yTop;
     627        lpps->rcPaint.left   = rectl.xLeft;
     628        lpps->rcPaint.bottom = height - rectl.yBottom;
     629        lpps->rcPaint.right  = rectl.xRight;
    630630   }
    631631   else {
    632         lpps->rcPaint.bottom = lpps->rcPaint.top = 0;
    633         lpps->rcPaint.right = lpps->rcPaint.left = 0;
    634    }
    635    
     632        lpps->rcPaint.bottom = lpps->rcPaint.top = 0;
     633        lpps->rcPaint.right = lpps->rcPaint.left = 0;
     634   }
     635
    636636   HideCaret(hwnd);
    637637
     
    660660   if (pHps && (pHps->hdcType == TYPE_3))
    661661   {
    662         GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld);
    663         if(hrgnOld) {
    664                 GpiDestroyRegion(pHps->hps, hrgnOld);
    665         }
    666         if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) {
    667                 ReleaseDC(hwnd, pPaint->hdc);
    668         }
    669         else
    670         if(wnd->GetClipRegion()) {
    671                 //TODO: What else do we need to restore here???
    672                 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld);
    673                 wnd->SetClipRegion(0);
    674                 pHps->hdcType = TYPE_1;
    675         }
    676 
    677 ////    WinEndPaint (pHps->hps);
     662        GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld);
     663        if(hrgnOld) {
     664                GpiDestroyRegion(pHps->hps, hrgnOld);
     665        }
     666        if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) {
     667                ReleaseDC(hwnd, pPaint->hdc);
     668        }
     669        else
     670        if(wnd->GetClipRegion()) {
     671                //TODO: What else do we need to restore here???
     672                GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld);
     673                wnd->SetClipRegion(0);
     674                pHps->hdcType = TYPE_1;
     675        }
     676
     677////    WinEndPaint (pHps->hps);
    678678   }
    679679   else {
    680         dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc));
     680        dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc));
    681681   }
    682682   wnd->setSuppressErase(FALSE);
     
    714714   if (updateRegionExists)
    715715   {
    716         //CB: for PM empty rect is valid
    717         if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) {
    718                 if(pRect) {
    719                         pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    720                 }
    721                 return FALSE;
    722         }
     716        //CB: for PM empty rect is valid
     717        if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) {
     718                if(pRect) {
     719                        pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     720                }
     721                return FALSE;
     722        }
    723723#if 0
    724         //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
     724        //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
    725725//      if (wnd->isOwnDC() && wnd->getOwnDC())
    726         if (wnd->isOwnDC())
    727         {
    728                 pDCData pHps = NULL;
    729                 pHps = (pDCData)GpiQueryDCData(wnd->getOwnDC());
    730                 if (!pHps)
    731                 {
    732                         O32_SetLastError (ERROR_INVALID_HANDLE);
    733                         return FALSE;
    734                 }
    735                 GpiConvert (pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rectl);
    736         }
    737         else
    738         {
     726        if (wnd->isOwnDC())
     727        {
     728                pDCData pHps = NULL;
     729                pHps = (pDCData)GpiQueryDCData(wnd->getOwnDC());
     730                if (!pHps)
     731                {
     732                        O32_SetLastError (ERROR_INVALID_HANDLE);
     733                        return FALSE;
     734                }
     735                GpiConvert (pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rectl);
     736        }
     737        else
     738        {
    739739#endif
    740                 long height   = wnd->getClientHeight();
    741                 rectl.yTop    = height - rectl.yTop;
    742                 rectl.yBottom = height - rectl.yBottom;
    743 //////////              }
    744 
    745         if (pRect)
    746                 WINRECT_FROM_PMRECT (*pRect, rectl);
    747 
    748         if (erase)
    749                 sendEraseBkgnd (wnd);
     740                long height   = wnd->getClientHeight();
     741                rectl.yTop    = height - rectl.yTop;
     742                rectl.yBottom = height - rectl.yBottom;
     743//////////              }
     744
     745        if (pRect)
     746                WINRECT_FROM_PMRECT (*pRect, rectl);
     747
     748        if (erase)
     749                sendEraseBkgnd (wnd);
    750750   }
    751751   else
    752752   {
    753         if(pRect) {
    754                 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    755         }
     753        if(pRect) {
     754                pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     755        }
    756756   }
    757757
     
    780780     if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;
    781781     mapOS2ToWin32Rect(hwnd,(PRECTLOS2)&rectl,pRect);
    782    } 
     782   }
    783783   else
    784784       pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     
    827827
    828828   if(hwnd == 0) {
    829         dprintf(("error: GetDCEx window %x not found", hwnd));
    830         O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    831         return 0;
     829        dprintf(("error: GetDCEx window %x not found", hwnd));
     830        O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     831        return 0;
    832832   }
    833833
     
    867867
    868868         pHps->hdcType = TYPE_1;
    869         dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
     869        dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
    870870         return (HDC)hps;
    871871      }
     
    913913      {
    914914#if 0 //CB: todo
    915         long height;
    916 
    917         BytesNeeded = GetRegionData (hrgn, 0, NULL);
    918         RgnData = (PRGNDATA_W)_alloca (BytesNeeded);
    919         if (RgnData == NULL)
    920                 goto error;
    921         GetRegionData (hrgn, BytesNeeded, RgnData);
    922 
    923         i = RgnData->rdh.nCount;
    924         pr = (PRECT)(RgnData->Buffer);
     915        long height;
     916
     917        BytesNeeded = GetRegionData (hrgn, 0, NULL);
     918        RgnData = (PRGNDATA_W)_alloca (BytesNeeded);
     919        if (RgnData == NULL)
     920                goto error;
     921        GetRegionData (hrgn, BytesNeeded, RgnData);
     922
     923        i = RgnData->rdh.nCount;
     924        pr = (PRECT)(RgnData->Buffer);
    925925
    926926         if (flags & DCX_WINDOW_W)
    927                 height = wnd->getWindowHeight();
    928         else   height = wnd->getClientHeight();
     927                height = wnd->getWindowHeight();
     928        else   height = wnd->getClientHeight();
    929929
    930930         for (; (i > 0) && success; i--, pr++) {
     
    936936         }
    937937#endif
    938       } 
     938      }
    939939      else //DCX_INTERSECTRGN_W
    940940      {
    941941         if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) {
    942                 dprintf(("ExtSelectClipRgn failed!!"));
    943         }
     942                dprintf(("ExtSelectClipRgn failed!!"));
     943        }
    944944      }
    945945      if (!success)
     
    10361036
    10371037   if(pRect) {
    1038           dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw));
     1038          dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw));
    10391039   }
    10401040   else   dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw));
     
    10901090   //     deciding to skip erase?
    10911091   if(redraw & RDW_NOERASE_W || ((redraw & (RDW_INVALIDATE_W|RDW_ERASE_W|RDW_ERASENOW_W)) == RDW_INVALIDATE_W)) {
    1092         wnd->setSuppressErase(TRUE);
    1093    }
    1094    else wnd->setSuppressErase(FALSE);
     1092        wnd->setSuppressErase(TRUE);
     1093   }
     1094   else wnd->setSuppressErase(FALSE);
    10951095
    10961096   if (hrgn)
     
    11601160   if(WinQueryUpdateRect(hwnd, NULL))
    11611161   {
    1162         if(redraw & RDW_UPDATENOW_W) {
    1163                 wnd->MsgPaint (0, FALSE);
    1164         }
    1165         else
    1166         if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
    1167                 wnd->setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd));
     1162        if(redraw & RDW_UPDATENOW_W) {
     1163                wnd->MsgPaint (0, FALSE);
     1164        }
     1165        else
     1166        if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
     1167                wnd->setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd));
    11681168   }
    11691169   else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
    11701170   {
    1171         if(redraw & RDW_UPDATENOW_W)
    1172                 wnd->MsgPaint (0, FALSE);
    1173         else    PostMessageA(hwnd, WINWM_PAINT, 0, 0);
     1171        if(redraw & RDW_UPDATENOW_W)
     1172                wnd->MsgPaint (0, FALSE);
     1173        else    PostMessageA(hwnd, WINWM_PAINT, 0, 0);
    11741174   }
    11751175
     
    12001200
    12011201   if(!wnd) {
    1202         O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    1203         return FALSE;
     1202        O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1203        return FALSE;
    12041204   }
    12051205
Note: See TracChangeset for help on using the changeset viewer.