Ignore:
Timestamp:
May 11, 2001, 10:39:46 AM (24 years ago)
Author:
sandervl
Message:

client/frame rewrite

File:
1 edited

Legend:

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

    r3725 r5685  
    1 /* $Id: dcrgn.cpp,v 1.3 2000-06-17 11:56:14 sandervl Exp $ */
     1/* $Id: dcrgn.cpp,v 1.4 2001-05-11 08:39:42 sandervl Exp $ */
    22
    33/*
     
    4646BOOL WIN32API GetUpdateRect(HWND hwnd, LPRECT pRect, BOOL erase)
    4747{
    48    if (!hwnd)
    49    {
    50         dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
    51         SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    52         return FALSE;
    53    }
    54 
    55    RECTL rectl, rectlClient;
    56    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    57 
    58    if (!wnd)
    59    {
    60         SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    61         dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
    62         return FALSE;
    63    }
    64 
    65    dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));
    66 
    67    BOOL updateRegionExists = WinQueryUpdateRect (wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
    68    if (!pRect) {
    69       return (updateRegionExists);
    70    }
    71 
    72    if(updateRegionExists)
    73    {
     48    if (!hwnd)
     49    {
     50        dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
     51        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     52        return FALSE;
     53    }
     54
     55    RECTL rectl, rectlClient;
     56    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     57
     58    if (!wnd)
     59    {
     60        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     61        dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase));
     62        return FALSE;
     63    }
     64
     65    dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));
     66
     67    BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
     68    if (!pRect) {
     69        return (updateRegionExists);
     70    }
     71
     72    if(updateRegionExists)
     73    {
    7474        //CB: for PM empty rect is valid
    7575        if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) {
    76                 if(pRect) {
    77                         pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    78                 }
    79                 return FALSE;
    80         }
    81         mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
    82         WinIntersectRect(NULL, &rectl, &rectl, &rectlClient);
    83         mapOS2ToWin32RectFrameToClient(wnd, (PRECTLOS2)&rectl, pRect);
     76            if(pRect) {
     77                pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     78            }
     79            return FALSE;
     80        }
     81        mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectl, pRect);
    8482
    8583        if(wnd->isOwnDC() && GetMapMode(wnd->getOwnDC()) != MM_TEXT_W)
    8684        {
    87                 DPtoLP(wnd->getOwnDC(), (LPPOINT)pRect, 2);
     85            DPtoLP(wnd->getOwnDC(), (LPPOINT)pRect, 2);
    8886        }
    8987        if (erase)
    90                 sendEraseBkgnd (wnd);
     88            sendEraseBkgnd (wnd);
    9189   }
    9290   else
    9391   {
    9492        if(pRect) {
    95                 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     93            pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    9694        }
    9795   }
     
    10098}
    10199//******************************************************************************
    102 //******************************************************************************
    103 BOOL GetOS2UpdateRect(Win32BaseWindow *window, LPRECT pRect)
    104 {
    105    RECTL rectl;
    106    BOOL updateRegionExists = WinQueryUpdateRect(window->getOS2WindowHandle(),pRect ? &rectl:NULL);
    107 
    108    if (!pRect)
    109      return (updateRegionExists);
    110 
    111    if (updateRegionExists)
    112    {
    113      //CB: for PM empty rect is valid
    114      if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;
    115      mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectl,pRect);
    116    }
    117    else
    118        pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    119 
    120    return updateRegionExists;
    121 }
    122 //******************************************************************************
    123100//TODO: Seems to return region in window coordinates instead of client coordinates
    124101//******************************************************************************
    125102int WIN32API GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL erase)
    126103{
    127    LONG lComplexity;
    128    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    129 
    130    hrgn = ObjWinToOS2Region(hrgn);
    131    if(!wnd || !hrgn)
    132    {
    133         dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase));
    134         SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    135         return ERROR_W;
    136    }
    137    lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn);
    138    if(lComplexity == RGN_ERROR) {
    139         dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase));
    140         SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    141         return ERROR_W;
    142    }
    143 
    144    if(lComplexity != RGN_NULL)
    145    {
    146         if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle()))
    147         {
    148                 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase));
    149                 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    150                 return ERROR_W;
    151         }
    152 
     104    LONG lComplexity;
     105    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     106
     107    hrgn = ObjWinToOS2Region(hrgn);
     108    if(!wnd || !hrgn)
     109    {
     110        dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase));
     111        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     112        return ERROR_W;
     113    }
     114    lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn);
     115    if(lComplexity == RGN_ERROR) {
     116        dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase));
     117        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     118        return ERROR_W;
     119    }
     120
     121    if(lComplexity != RGN_NULL)
     122    {
     123        if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle()))
     124        {
     125            dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase));
     126            SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     127            return ERROR_W;
     128        }
    153129        if(erase) sendEraseBkgnd(wnd);
    154    }
    155 
    156    return lComplexity;
     130    }
     131    return lComplexity;
    157132}
    158133//******************************************************************************
     
    161136INT WIN32API ExcludeUpdateRgn(HDC hdc, HWND hwnd)
    162137{
    163    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    164    pDCData          pHps = (pDCData)GpiQueryDCData((HPS)hdc);
    165    LONG             lComplexity;
    166 
    167    if(!wnd || !pHps)
    168    {
    169         dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd));
    170         SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    171         return ERROR_W;
    172    }
    173    dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd));
    174 
    175    lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle());
    176    if(lComplexity == RGN_ERROR) {
    177         SetLastError(ERROR_INVALID_HANDLE_W); //todo: correct error
    178    }
    179    else SetLastError(ERROR_SUCCESS_W);
    180    return lComplexity;      // windows and PM values are identical
     138    Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     139    pDCData          pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     140    LONG             lComplexity;
     141
     142    if(!wnd || !pHps)
     143    {
     144        dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd));
     145        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     146        return ERROR_W;
     147    }
     148    dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd));
     149
     150    lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle());
     151    if(lComplexity == RGN_ERROR) {
     152         SetLastError(ERROR_INVALID_HANDLE_W); //todo: correct error
     153    }
     154    else SetLastError(ERROR_SUCCESS_W);
     155    return lComplexity;      // windows and PM values are identical
    181156}
    182157/*****************************************************************************
     
    195170int WIN32API GetWindowRgn(HWND hwnd, HRGN hRgn)
    196171{
    197   Win32BaseWindow *window;
    198   HRGN hWindowRegion;
     172    Win32BaseWindow *window;
     173    HRGN hWindowRegion;
    199174
    200175    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    234209                          BOOL bRedraw)
    235210{
    236   Win32BaseWindow *window;
    237   HRGN hWindowRegion;
     211    Win32BaseWindow *window;
     212    HRGN hWindowRegion;
    238213
    239214    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
Note: See TracChangeset for help on using the changeset viewer.