Changeset 10060 for trunk/src


Ignore:
Timestamp:
May 2, 2003, 5:33:17 PM (22 years ago)
Author:
sandervl
Message:

Keep track of all open DCs and query the visible region during WM_VRNENABLED to work around a PM bug

Location:
trunk/src/user32
Files:
4 edited

Legend:

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

    r9933 r10060  
    1 /* $Id: dc.cpp,v 1.118 2003-03-22 20:27:10 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.119 2003-05-02 15:33:15 sandervl Exp $ */
    22
    33/*
     
    885885            dprintf2(("ReleaseDC: CS_OWNDC, not released"));
    886886        }
     887        if(!isOwnDC && !wnd->isDesktopWindow()) {
     888            //remove from list of open DCs for this window
     889            wnd->removeOpenDC(hdc);
     890        }
    887891        RELEASE_WNDOBJ(wnd);
    888892    }
     
    11031107
    11041108    dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps));
     1109
     1110    //add to list of open DCs for this window
     1111    if(wnd->isDesktopWindow() == FALSE) {//not relevant for the desktop window
     1112         wnd->addOpenDC((HDC)pHps->hps);
     1113    }
     1114
    11051115    RELEASE_WNDOBJ(wnd);
    11061116
  • trunk/src/user32/pmwindow.cpp

    r10045 r10060  
    1 /* $Id: pmwindow.cpp,v 1.212 2003-04-28 08:41:07 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.213 2003-05-02 15:33:15 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    655655
    656656        win32wnd->callVisibleRgnNotifyProc(TRUE);
     657
     658        //Workaround for PM/GPI bug when moving/sizing a window with open DCs
     659        //
     660        //Windows applictions often get a DC and keep it open for the duration
     661        //of the application. When the DC's window is moved (full window dragging on)
     662        //PM/GPI doesn't seem to update the DC properly/in time.
     663        //This can result is visible distortions on the screen.
     664        //Debugging showed that querying the visible region of a DC will cure
     665        //this problem (GPI probably recalculates the visible region).
     666        int  nrdcs = 0;
     667        HDC  hdcWindow[MAX_OPENDCS];
     668
     669        if(win32wnd->queryOpenDCs(hdcWindow, MAX_OPENDCS, &nrdcs))
     670        {
     671            RECTL rcl = {0,0,1,1};
     672            HRGN hrgnRect;
     673
     674            for(int i=0;i<nrdcs;i++) {
     675                dprintf(("Recalc visible region of DC %x for window %x", hdcWindow[i], win32wnd->getWindowHandle()));
     676                hrgnRect = GreCreateRectRegion(hdcWindow[i], &rcl, 1);
     677                GreCopyClipRegion(hdcWindow[i], hrgnRect, 0, COPYCRGN_VISRGN);
     678                GreDestroyRegion(hdcWindow[i], hrgnRect);
     679            }
     680        }
     681
     682        //Workaround END
     683
    657684        if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W))
    658685        {
  • trunk/src/user32/win32wbase.cpp

    r10045 r10060  
    1 /* $Id: win32wbase.cpp,v 1.369 2003-04-28 08:41:08 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.370 2003-05-02 15:33:16 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    199199
    200200  pfnOldPMWndProc     = NULL;
     201
     202  memset(hdcWindow, 0, sizeof(hdcWindow));
     203  nrOpenDCs           = 0;
    201204}
    202205//******************************************************************************
     
    40784081        lpVisRgnNotifyProc(getWindowHandle(), fDrawingAllowed, dwVisRgnNotifyParam);
    40794082    }
     4083}
     4084//******************************************************************************
     4085// Win32BaseWindow::queryOpenDCs
     4086//
     4087// Return the DCs that are currently open for this window
     4088//
     4089// Parameters:
     4090//    HDC *phdcWindow   - pointer to HDC array    (IN)
     4091//    int  chdcWindow   - size of HDC array       (IN)
     4092//    int *pnrdcs       - number of HDCs returned (OUT)
     4093//
     4094// Returns:
     4095//    TRUE              - Success
     4096//    FALSE             - Failure
     4097//
     4098//******************************************************************************
     4099BOOL Win32BaseWindow::queryOpenDCs(HDC *phdcWindow, int  chdcWindow, int *pnrdcs)
     4100{
     4101    if(nrOpenDCs == 0) return FALSE;
     4102
     4103    if(chdcWindow < nrOpenDCs) {
     4104        DebugInt3();
     4105        return FALSE;
     4106    }
     4107
     4108    int j = 0;
     4109    for(int i=0;i<MAX_OPENDCS && j<nrOpenDCs;i++) {
     4110        if(hdcWindow[i] != 0) {
     4111            phdcWindow[j] = hdcWindow[i];
     4112            j++;
     4113        }
     4114    }
     4115    *pnrdcs = nrOpenDCs;
     4116    return TRUE;
     4117}
     4118//******************************************************************************
     4119// Win32BaseWindow::addOpenDC
     4120//
     4121// Add DC to list of open DCS
     4122//
     4123// Parameters:
     4124//    HDC hdc            - HDC to be added to our list of open DCs
     4125//
     4126// Returns:
     4127//
     4128//******************************************************************************
     4129void Win32BaseWindow::addOpenDC(HDC hdc)
     4130{
     4131    for(int i=0;i<MAX_OPENDCS;i++) {
     4132        if(hdcWindow[i] == 0) {
     4133            hdcWindow[i] = hdc;
     4134            break;
     4135        }
     4136    }
     4137    if(i == MAX_OPENDCS) {
     4138        DebugInt3(); //no room!
     4139        return;
     4140    }
     4141
     4142    nrOpenDCs++;
     4143}
     4144//******************************************************************************
     4145// Win32BaseWindow::removeOpenDC
     4146//
     4147// Remove DC from list of open DCS
     4148//
     4149// Parameters:
     4150//    HDC hdc            - HDC to be removed from our list of open DCs
     4151//
     4152// Returns:
     4153//
     4154//******************************************************************************
     4155void Win32BaseWindow::removeOpenDC(HDC hdc)
     4156{
     4157    if(nrOpenDCs == 0) {
     4158        DebugInt3();
     4159        return;
     4160    }
     4161    for(int i=0;i<MAX_OPENDCS;i++) {
     4162        if(hdcWindow[i] == hdc) {
     4163            hdcWindow[i] = 0;
     4164            break;
     4165        }
     4166    }
     4167    if(i == MAX_OPENDCS) {
     4168        DebugInt3(); //not found
     4169        return;
     4170    }
     4171    nrOpenDCs--;
    40804172}
    40814173//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r9953 r10060  
    1 /* $Id: win32wbase.h,v 1.152 2003-03-29 16:38:01 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.153 2003-05-02 15:33:17 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    3535#define WIN32PM_MAGIC             0x12345678
    3636#define CheckMagicDword(a)        (a==WIN32PM_MAGIC)
     37
     38#define MAX_OPENDCS               8
    3739
    3840#define TYPE_ASCII                0
     
    288290         BOOL   setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData);
    289291         void   callVisibleRgnNotifyProc(BOOL fDrawingAllowed);
     292         BOOL   isLocked()                            { return fWindowLocked; };
     293
     294         BOOL   queryOpenDCs(HDC *phdcWindow, int chdcWindow, int *pnrdcs);
     295         void   addOpenDC(HDC hdc);
     296         void   removeOpenDC(HDC hdc);
    290297
    291298         int    GetWindowTextLength(BOOL fUnicode);
     
    423430        DWORD   dwThreadId;             //id of thread that created this window
    424431        DWORD   dwProcessId;            //id of process that created this window
     432
     433        //array of open window DCs
     434        HDC     hdcWindow[MAX_OPENDCS];
     435        int     nrOpenDCs;
    425436
    426437   Win32BaseWindow *owner;
Note: See TracChangeset for help on using the changeset viewer.