Ignore:
Timestamp:
Oct 8, 2000, 4:03:49 PM (25 years ago)
Author:
sandervl
Message:

GetMinMaxInfo fix (border) + CS_OWNDC fix (origin)

File:
1 edited

Legend:

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

    r4434 r4452  
    1 /* $Id: dc.cpp,v 1.71 2000-10-05 18:37:25 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.72 2000-10-08 14:03:48 sandervl Exp $ */
    22
    33/*
     
    7272LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps);
    7373
     74#ifdef DEBUG
     75#define dprintfRegion(a,b,c) if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
     76
     77void dprintfRegion1(HPS hps, HWND hWnd, HRGN hrgnClip)
     78{
     79 RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT};
     80 RECTL   rectRegion[16];
     81 APIRET  rc;
     82
     83   dprintf(("dprintfRegion %x %x", hWnd, hps));
     84   rc = GpiQueryRegionRects(hps, hrgnClip, NULL, &rgnRect, &rectRegion[0]);
     85   for(int i=0;i<rgnRect.crcReturned;i++) {
     86        dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
     87   }
     88}
     89#else
     90#define dprintfRegion(a,b,c)
     91#endif
     92
    7493//******************************************************************************
    7594//******************************************************************************
     
    302321//******************************************************************************
    303322//******************************************************************************
    304 VOID removeClientArea(pDCData pHps)
     323VOID removeClientArea(Win32BaseWindow *window, pDCData pHps)
    305324{
    306325 POINTL point;
     
    315334   if(pHps->isClientArea)
    316335   {
    317         dprintf2(("removeClientArea: (%d,%d) -> (%d,%d)", point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
     336        dprintf2(("removeClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
    318337        pHps->isClientArea = FALSE;
    319338        GreSetupDC(pHps->hps,
     
    324343                   SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
    325344   }
    326    else dprintf(("removeClientArea: (%d,%d)", point.x, point.y));
     345   else dprintf(("removeClientArea: %x (%d,%d)", window->getWindowHandle(), point.x, point.y));
    327346
    328347}
     
    347366        return;
    348367   }
    349    if(pHps->isClientArea) {
    350         //TODO: counter
    351         dprintf(("WARNING: selectClientArea; already selected!!"));
    352         return;
    353    }
    354368   pHps->isClient = TRUE;
    355369
     
    360374   //convert to screen coordinates
    361375   GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
    362    rcl.xLeft   += rcltemp.xLeft;
    363    rcl.xRight  += rcltemp.xLeft;
    364    rcl.yTop    += rcltemp.yBottom;
    365    rcl.yBottom += rcltemp.yBottom;
    366        
     376
     377   if(pHps->isClientArea)
     378   {
     379        //TODO: counter
     380        dprintf(("WARNING: selectClientArea %x; already selected! origin (%d,%d) original origin (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
     381        RECT rectWindow;
     382        RECTL rectWindowOS2;
     383        GetWindowRect(window->getWindowHandle(), &rectWindow);
     384        mapWin32ToOS2Rect(OSLibGetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);
     385        if(rectWindowOS2.xLeft + rcl.xLeft != rcltemp.xLeft ||
     386           rectWindowOS2.yBottom + rcl.yBottom != rcltemp.yBottom)
     387        {
     388                dprintf(("WARNING: origin changed (%d,%d) instead of (%d,%d)!", rcltemp.xLeft, rcltemp.yBottom, rectWindowOS2.xLeft + rcl.xLeft, rectWindowOS2.yBottom + rcl.yBottom));
     389                rcl.xLeft   += rectWindowOS2.xLeft;
     390                rcl.xRight  += rectWindowOS2.xLeft;
     391                rcl.yTop    += rectWindowOS2.yBottom;
     392                rcl.yBottom += rectWindowOS2.yBottom;
     393        }
     394        else    return;
     395   }
     396   else {
     397        rcl.xLeft   += rcltemp.xLeft;
     398        rcl.xRight  += rcltemp.xLeft;
     399        rcl.yTop    += rcltemp.yBottom;
     400        rcl.yBottom += rcltemp.yBottom;
     401   }
    367402   pHps->ptlOrigin.x = rcltemp.xLeft;
    368403   pHps->ptlOrigin.y = rcltemp.yBottom;
    369404 
    370    dprintf2(("selectClientArea: (%d,%d) -> (%d,%d)", rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));
     405   dprintf2(("selectClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));
    371406
    372407   if(pHps->hrgnVis == 0)
     
    390425              SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
    391426
    392 /*
    393         GpiQueryRegionBox(pHps->hps, hrgnClip, &rcltemp);
    394         GpiQueryRegionBox(pHps->hps, hrgnOldClip, &rcltemp);
    395 
    396         GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
    397 
    398         GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
    399 
    400         GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_VISRGN);
    401         GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
    402      
    403         GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_ALLINTERSECT);
    404         GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
    405      
    406         GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_CLIPRGN);
    407         GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp);
    408 */
    409427   pHps->isClientArea = TRUE;
    410428
     
    531549{
    532550   pDCData pHps = (pDCData)GpiQueryDCData ((HPS)hps);
     551 
     552   dprintf2(("releaseOwnDC %x", hps));
    533553
    534554   if (pHps) {
     
    544564   }
    545565}
    546 //******************************************************************************
    547 //******************************************************************************
    548 #ifdef DEBUG
    549 #define dprintfRegion(a,b,c) if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
    550 
    551 void dprintfRegion1(HPS hps, HWND hWnd, HRGN hrgnClip)
    552 {
    553  RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT};
    554  RECTL   rectRegion[16];
    555  APIRET  rc;
    556 
    557    dprintf(("dprintfRegion %x %x", hWnd, hps));
    558    rc = GpiQueryRegionRects(hps, hrgnClip, NULL, &rgnRect, &rectRegion[0]);
    559    for(int i=0;i<rgnRect.crcReturned;i++) {
    560         dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
    561    }
    562 }
    563 #else
    564 #define dprintfRegion(a,b,c)
    565 #endif
    566566//******************************************************************************
    567567//******************************************************************************
     
    751751                pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
    752752                if(pHps && pHps->psType == MICRO_CACHED) {
    753                         removeClientArea(pHps);
     753                        removeClientArea(wnd, pHps);
    754754                        if(pHps->hrgnVis) {
    755755                                GreDestroyRegion(pHps->hps, pHps->hrgnVis);
     
    762762                }
    763763        }
     764        else {
     765                dprintf2(("ReleaseDC: CS_OWNDC, not released"));
     766        }
    764767   }
    765768
     
    898901        selectClientArea(wnd, pHps);
    899902   }
    900    else removeClientArea(pHps);
     903   else removeClientArea(wnd, pHps);
    901904
    902905   setMapMode(wnd, pHps, MM_TEXT_W);
Note: See TracChangeset for help on using the changeset viewer.