Changeset 9933


Ignore:
Timestamp:
Mar 22, 2003, 9:27:12 PM (22 years ago)
Author:
sandervl
Message:

Changes for applications that don't validate the update region of a window during WM_PAINT

Location:
trunk/src/user32
Files:
5 edited

Legend:

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

    r8800 r9933  
    1 /* $Id: dc.cpp,v 1.117 2002-06-28 19:45:00 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.118 2003-03-22 20:27:10 sandervl Exp $ */
    22
    33/*
     
    679679    bIcon = IsIconic(hwnd);
    680680
     681    //check if the application previously didn't handle a WM_PAINT msg properly
     682    wnd->checkForDirtyUpdateRegion();
     683
    681684    HWND hwndClient = (bIcon) ? wnd->getOS2FrameWindowHandle() : wnd->getOS2WindowHandle();
    682685
     
    12071210        else hwnd = wnd->getOS2WindowHandle();
    12081211    }
     1212
     1213    //check if the application previously didn't handle a WM_PAINT msg properly
     1214    wnd->checkForDirtyUpdateRegion();
    12091215
    12101216    BOOL  IncludeChildren = (redraw & RDW_ALLCHILDREN_W) ? TRUE : FALSE;
     
    13831389    }
    13841390
     1391    //check if the application previously didn't handle a WM_PAINT msg properly
     1392    wnd->checkForDirtyUpdateRegion();
     1393
    13851394#ifdef DEBUG
    13861395    if(WinQueryUpdateRect(wnd->getOS2WindowHandle(), &rectl))
  • TabularUnified trunk/src/user32/dcrgn.cpp

    r6902 r9933  
    1 /* $Id: dcrgn.cpp,v 1.7 2001-09-30 22:24:41 sandervl Exp $ */
     1/* $Id: dcrgn.cpp,v 1.8 2003-03-22 20:27:11 sandervl Exp $ */
    22
    33/*
     
    6565    dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));
    6666
     67    //check if the application previously didn't handle a WM_PAINT msg properly
     68    wnd->checkForDirtyUpdateRegion();
     69
    6770    BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);
    6871    if (!pRect) {
     
    118121        return ERROR_W;
    119122    }
     123    //check if the application previously didn't handle a WM_PAINT msg properly
     124    wnd->checkForDirtyUpdateRegion();
     125
    120126    lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn);
    121127    if(lComplexity == RGN_ERROR) {
  • TabularUnified trunk/src/user32/pmwindow.cpp

    r9930 r9933  
    1 /* $Id: pmwindow.cpp,v 1.202 2003-03-20 13:20:44 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.203 2003-03-22 20:27:11 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    866866      BOOL  rc;
    867867
     868        win32wnd->checkForDirtyUpdateRegion();
     869
    868870        rc = WinQueryUpdateRect(hwnd, &rectl);
    869871        dprintf(("OS2: WM_PAINT %x (%d,%d) (%d,%d) rc=%d", win32wnd->getWindowHandle(), rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop, rc));
     
    873875        {
    874876                win32wnd->DispatchMsgA(pWinMsg);
     877                if(WinQueryUpdateRect(hwnd, NULL) == TRUE)
     878                {//the application didn't validate the update region; Windows
     879                 //will only send a WM_PAINT once until another part of the
     880                 //window is invalidated. Unfortunately PM keeps on sending
     881                 //WM_PAINT messages until we validate the update region.
     882
     883                    win32wnd->saveAndValidateUpdateRegion();
     884                }
    875885        }
    876886        else    goto RunDefWndProc;
  • TabularUnified trunk/src/user32/win32wbase.cpp

    r9930 r9933  
    1 /* $Id: win32wbase.cpp,v 1.362 2003-03-20 13:20:45 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.363 2003-03-22 20:27:12 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    119119  fEraseBkgndFlag  = TRUE;
    120120  fIsDragDropActive= FALSE;
     121  fDirtyUpdateRegion = FALSE;
    121122
    122123  state            = STATE_INIT;
     
    174175  hWindowRegion      = 0;
    175176  hClipRegion        = 0;
     177  hUpdateRegion      = 0;
    176178
    177179  hTaskList          = 0;
     
    272274    if(propertyList) {
    273275        removeWindowProps();
     276    }
     277    if(hUpdateRegion) {
     278        DeleteObject(hUpdateRegion);
     279        hUpdateRegion = NULL;
    274280    }
    275281}
     
    11901196    else
    11911197        return SendMessageA(getWindowHandle(),WM_PAINT, 0, 0);
     1198}
     1199//******************************************************************************
     1200//
     1201// Win32BaseWindow::saveAndValidateUpdateRegion
     1202//
     1203//   If an application doesn't validate the update region while processing
     1204//   WM_PAINT, then we must remember it for the next time. Also validates
     1205//   the current update region.
     1206//
     1207// Parameters:
     1208// Returns:
     1209//
     1210// NOTE:
     1211//   Windows will only send a WM_PAINT once until another part of the
     1212//   window is invalidated. Unfortunately PM keeps on sending
     1213//   WM_PAINT messages until we validate the update region.
     1214//
     1215//   This affects UpdateWindow, RedrawWindow, GetUpdateRgn, GetUpdateRect,
     1216//   BeginPaint and the next WM_PAINT message.
     1217//
     1218//******************************************************************************
     1219void Win32BaseWindow::saveAndValidateUpdateRegion()
     1220{
     1221    if(hUpdateRegion == NULL) {
     1222        hUpdateRegion = ::CreateRectRgn(0, 0, 1, 1);
     1223    }
     1224
     1225    dprintf(("Win32BaseWindow::saveAndValidateUpdateRegion; marked dirty!"));
     1226
     1227    //save update region
     1228    ::GetUpdateRgn(getWindowHandle(), hUpdateRegion, FALSE);
     1229
     1230    //and validate it so PM won't bother us again
     1231    ::ValidateRgn(getWindowHandle(), hUpdateRegion);
     1232
     1233    //we just pretend the entire window is invalid. easier this way
     1234    fDirtyUpdateRegion = TRUE;
     1235}
     1236//******************************************************************************
     1237//
     1238// Win32BaseWindow::checkForDirtyUpdateRegion
     1239//
     1240//   If an application doesn't validate the update region while processing
     1241//   WM_PAINT, then we must remember it for the next time. If the window has
     1242//   a dirty update region, then invalidate that region.
     1243//
     1244// Parameters:
     1245// Returns:
     1246//
     1247// NOTE:
     1248//
     1249//******************************************************************************
     1250void Win32BaseWindow::checkForDirtyUpdateRegion()
     1251{
     1252    if(fDirtyUpdateRegion) {
     1253        dprintf(("Win32BaseWindow::checkForDirtyUpdateRegion; marked dirty -> invalidate whole window!"));
     1254        fDirtyUpdateRegion = FALSE;
     1255        ::InvalidateRgn(getWindowHandle(), hUpdateRegion, TRUE);
     1256    }
    11921257}
    11931258//******************************************************************************
  • TabularUnified trunk/src/user32/win32wbase.h

    r9930 r9933  
    1 /* $Id: win32wbase.h,v 1.149 2003-03-20 13:20:46 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.150 2003-03-22 20:27:12 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    230230         void   SetClipRegion(HRGN hRegion)       { hClipRegion = hRegion; };
    231231
     232         void   saveAndValidateUpdateRegion();
     233         void   checkForDirtyUpdateRegion();   
     234         BOOL   hasDirtUpdateRegion()             { return fDirtyUpdateRegion; };
     235
    232236         BOOL   ShowWindow(ULONG nCmdShow);
    233237virtual  BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags, BOOL fShowWindow = FALSE);
     
    416420                 fVisibleRegionChanged:1, //set when visible region has changed -> erase background must be sent during next BeginPaint
    417421                 fEraseBkgndFlag:1,
    418                  fIsDragDropActive:1;
     422                 fIsDragDropActive:1,
     423                 fDirtyUpdateRegion:1;
    419424
    420425        ULONG   state;
    421426        HRGN    hWindowRegion;
    422427        HRGN    hClipRegion;
     428        HRGN    hUpdateRegion;
    423429
    424430        DWORD   dwThreadId;             //id of thread that created this window
Note: See TracChangeset for help on using the changeset viewer.