Ignore:
Timestamp:
Dec 29, 1999, 11:54:04 PM (26 years ago)
Author:
cbratschi
Message:

new mapping functions, fixed 1 pixel and window handle bugs

File:
1 edited

Legend:

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

    r2202 r2257  
    1 /* $Id: dc.cpp,v 1.30 1999-12-24 21:44:03 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.31 1999-12-29 22:53:59 cbratschi Exp $ */
    22
    33/*
     
    302302   {
    303303      if (wnd)
    304          return (wnd->getWindowHeight());
     304         return (wnd->getClientHeight());
    305305      else
    306306         return OSLibQueryScreenHeight();
     
    437437
    438438   if(hWnd == 0x6800003a) {
    439         hwnd = 0x6800003a;
     439        hwnd = 0x6800003a;
    440440   }
    441441   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    443443   if ((hwnd != HWND_DESKTOP) && wnd->isOwnDC())
    444444   {
    445         hPS_ownDC = wnd->getOwnDC();
    446         //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
    447         if(hPS_ownDC) {
    448                 pHps = (pDCData)GpiQueryDCData(hPS_ownDC);
    449                 if (!pHps)
    450                 {
    451                         O32_SetLastError (ERROR_INVALID_PARAMETER);
    452                         return (HDC)NULLHANDLE;
    453                 }
    454         }
     445        hPS_ownDC = wnd->getOwnDC();
     446        //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
     447        if(hPS_ownDC) {
     448                pHps = (pDCData)GpiQueryDCData(hPS_ownDC);
     449                if (!pHps)
     450                {
     451                        O32_SetLastError (ERROR_INVALID_PARAMETER);
     452                        return (HDC)NULLHANDLE;
     453                }
     454        }
    455455   }
    456456
     
    473473
    474474   if(!wnd->isSuppressErase()) {
    475         wnd->setSuppressErase(TRUE);
     475        wnd->setSuppressErase(TRUE);
    476476        wnd->setEraseBkgnd (FALSE, !wnd->MsgEraseBackGround(lpps->hdc));
    477477   }
     
    480480   if (!hPS_ownDC)
    481481   {
    482       long height  = wnd->getWindowHeight();
     482      long height  = wnd->getClientHeight();
    483483      rect.yTop    = height - rect.yTop;
    484484      rect.yBottom = height - rect.yBottom;
     
    531531BOOL WIN32API GetUpdateRect (HWND hwnd, LPRECT pRect, BOOL erase)
    532532{
    533    if (hwnd)
     533   if (!hwnd)
    534534   {
    535535      O32_SetLastError (ERROR_INVALID_HANDLE);
     
    540540   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    541541
    542    BOOL updateRegionExists = WinQueryUpdateRect (hwnd, pRect ? &rectl : NULL);
     542   if (!wnd)
     543   {
     544      O32_SetLastError (ERROR_INVALID_HANDLE);
     545      return FALSE;
     546   }
     547
     548   BOOL updateRegionExists = WinQueryUpdateRect (wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
    543549   if (!pRect) {
    544550      return (updateRegionExists);
     
    562568      else
    563569      {
    564          long height   = wnd->getWindowHeight();
     570         long height   = wnd->getClientHeight();
    565571         rectl.yTop    = height - rectl.yTop;
    566572         rectl.yBottom = height - rectl.yBottom;
     
    586592   LONG Complexity;
    587593
    588    Complexity = O32_GetUpdateRgn (hwnd, hrgn, FALSE);
    589    if (erase && (Complexity > NULLREGION_W)) {
    590        Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    591        sendEraseBkgnd (wnd);
    592    }
     594   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     595
     596   if (!wnd)
     597   {
     598      O32_SetLastError (ERROR_INVALID_HANDLE);
     599      return ERROR_W;
     600   }
     601
     602   Complexity = O32_GetUpdateRgn (wnd->getOS2WindowHandle(), hrgn, FALSE);
     603   if (erase && (Complexity > NULLREGION_W)) sendEraseBkgnd (wnd);
    593604
    594605   return Complexity;
     
    615626   if (hwnd)
    616627   {
    617         wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    618         if(wnd == NULL) {
    619                 dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd));
    620                 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    621                 return 0;
    622         }
     628        wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     629        if(wnd == NULL) {
     630                dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd));
     631                O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     632                return 0;
     633        }
    623634//SvL: Experimental change (doesn't work right)
    624635#if 0
    625         if(wnd->fHasParentDC() && wnd->getParent()) {
    626                 wnd = wnd->getParent();
    627         }
     636        if(wnd->fHasParentDC() && wnd->getParent()) {
     637                wnd = wnd->getParent();
     638        }
    628639#endif
    629         if (flags & DCX_WINDOW_W)
    630                 hWindow = wnd->getOS2FrameWindowHandle();
    631         else
    632                 hWindow = wnd->getOS2WindowHandle();
     640        if (flags & DCX_WINDOW_W)
     641                hWindow = wnd->getOS2FrameWindowHandle();
     642        else
     643                hWindow = wnd->getOS2WindowHandle();
    633644   }
    634645   else
     
    906917      PRECTL pr;
    907918      int i;
    908       LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight();
     919      LONG height = wnd ? wnd->getClientHeight() : OSLibQueryScreenHeight();
    909920
    910921      if (!hrgn)
     
    930941   else if (pRect)
    931942   {
    932       LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight();
     943      LONG height = wnd ? wnd->getClientHeight() : OSLibQueryScreenHeight();
    933944
    934945      PMRECT_FROM_WINRECT (rectl, *pRect);
     
    11971208
    11981209   RECT winRectUpdate;
    1199    LONG height = wnd->getWindowHeight();
     1210   LONG height = wnd->getClientHeight();
    12001211
    12011212   winRectUpdate.left   = rectlUpdate.xLeft;
     
    12321243    }
    12331244    dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
    1234     MapWin32ToOS2Rectl(window->getOS2WindowHandle(),window->getClientRect(), (PRECTLOS2)&clientRect);
     1245    mapWin32ToOS2Rect(window,window->getClientRect(), (PRECTLOS2)&clientRect);
    12351246    //Rectangle could be relative to parent window, so fix this
    12361247    if(clientRect.yBottom != 0) {
     
    12431254    }
    12441255    if(pScroll) {
    1245          MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pScroll, (PRECTLOS2)&scrollRect);
     1256         mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    12461257         pScrollRect = &scrollRect;
    12471258
     
    12561267
    12571268    if(pClip) {
    1258          MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pClip, (PRECTLOS2)&clipRect);
     1269         mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
    12591270         pClipRect = &clipRect;
    12601271
     
    13001311    if (scrollFlag & SW_SCROLLCHILDREN_W)  scrollFlags |= SW_SCROLLCHILDREN;
    13011312
    1302     if(pScroll) MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pScroll, (PRECTLOS2)&scrollRect);
    1303     if(pClip)   MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pClip, (PRECTLOS2)&clipRect);
     1313    if(pScroll) mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
     1314    if(pClip)   mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
    13041315
    13051316    RECTL rectlUpdate;
     
    13241335
    13251336    RECT winRectUpdate;
    1326     LONG height = window->getWindowHeight();
     1337    LONG height = window->getClientHeight();
    13271338
    13281339    winRectUpdate.left   = rectlUpdate.xLeft;
     
    13911402{
    13921403    if(lprc) {
    1393         dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom));
    1394     } 
    1395     else dprintf(("USER32: ValidateRect %x", hwnd)); 
    1396    
     1404        dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom));
     1405    }
     1406    else dprintf(("USER32: ValidateRect %x", hwnd));
     1407
    13971408    return RedrawWindow( hwnd, lprc, 0, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0));
    13981409}
Note: See TracChangeset for help on using the changeset viewer.