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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.