Commit f1ea0637 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: DCX_NORESETATTRS should be applied at DC release time.

parent e79af2f0
...@@ -168,6 +168,16 @@ static void update_visible_region( struct dce *dce ) ...@@ -168,6 +168,16 @@ static void update_visible_region( struct dce *dce )
/*********************************************************************** /***********************************************************************
* reset_dce_attrs
*/
static void reset_dce_attrs( struct dce *dce )
{
RestoreDC( dce->hdc, 1 ); /* initial save level is always 1 */
SaveDC( dce->hdc ); /* save the state again for next time */
}
/***********************************************************************
* release_dce * release_dce
*/ */
static void release_dce( struct dce *dce ) static void release_dce( struct dce *dce )
...@@ -329,6 +339,7 @@ void free_dce( struct dce *dce, HWND hwnd ) ...@@ -329,6 +339,7 @@ void free_dce( struct dce *dce, HWND hwnd )
if (!--dce->count) if (!--dce->count)
{ {
/* turn it into a cache entry */ /* turn it into a cache entry */
reset_dce_attrs( dce );
release_dce( dce ); release_dce( dce );
dce->flags |= DCX_CACHE; dce->flags |= DCX_CACHE;
} }
...@@ -455,6 +466,7 @@ static INT release_dc( HWND hwnd, HDC hdc, BOOL end_paint ) ...@@ -455,6 +466,7 @@ static INT release_dc( HWND hwnd, HDC hdc, BOOL end_paint )
dce = (struct dce *)GetDCHook( hdc, NULL ); dce = (struct dce *)GetDCHook( hdc, NULL );
if (dce && dce->count) if (dce && dce->count)
{ {
if (!(dce->flags & DCX_NORESETATTRS)) reset_dce_attrs( dce );
if (end_paint || (dce->flags & DCX_CACHE)) delete_clip_rgn( dce ); if (end_paint || (dce->flags & DCX_CACHE)) delete_clip_rgn( dce );
if (dce->flags & DCX_CACHE) dce->count = 0; if (dce->flags & DCX_CACHE) dce->count = 0;
ret = TRUE; ret = TRUE;
...@@ -898,6 +910,7 @@ BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps ) ...@@ -898,6 +910,7 @@ BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{ {
static const DWORD clip_flags = DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW; static const DWORD clip_flags = DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW;
static const DWORD user_flags = clip_flags | DCX_NORESETATTRS; /* flags that can be set by user */
struct dce *dce; struct dce *dce;
BOOL bUpdateVisRgn = TRUE; BOOL bUpdateVisRgn = TRUE;
HWND parent; HWND parent;
...@@ -1021,18 +1034,12 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -1021,18 +1034,12 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
} }
dce->hwnd = hwnd; dce->hwnd = hwnd;
dce->flags = (dce->flags & ~clip_flags) | (flags & clip_flags); dce->flags = (dce->flags & ~user_flags) | (flags & user_flags);
if (SetHookFlags( dce->hdc, DCHF_VALIDATEVISRGN )) bUpdateVisRgn = TRUE; /* DC was dirty */ if (SetHookFlags( dce->hdc, DCHF_VALIDATEVISRGN )) bUpdateVisRgn = TRUE; /* DC was dirty */
if (bUpdateVisRgn) update_visible_region( dce ); if (bUpdateVisRgn) update_visible_region( dce );
if (!(flags & DCX_NORESETATTRS))
{
RestoreDC( dce->hdc, 1 ); /* initial save level is always 1 */
SaveDC( dce->hdc ); /* save the state again for next time */
}
TRACE("(%p,%p,0x%x): returning %p\n", hwnd, hrgnClip, flags, dce->hdc); TRACE("(%p,%p,0x%x): returning %p\n", hwnd, hrgnClip, flags, dce->hdc);
return dce->hdc; return dce->hdc;
} }
......
...@@ -66,10 +66,7 @@ static void test_dc_attributes(void) ...@@ -66,10 +66,7 @@ static void test_dc_attributes(void)
hdc = hdcs[i] = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS ); hdc = hdcs[i] = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
if (!hdc) break; if (!hdc) break;
rop = GetROP2( hdc ); rop = GetROP2( hdc );
if (hdc == old_hdc) ok( rop == def_rop, "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
todo_wine ok( rop == def_rop, "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
else
ok( rop == def_rop, "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
if (hdc == old_hdc) if (hdc == old_hdc)
{ {
found_dc = 1; found_dc = 1;
...@@ -104,8 +101,8 @@ static void test_dc_attributes(void) ...@@ -104,8 +101,8 @@ static void test_dc_attributes(void)
rop = GetROP2( hdc ); rop = GetROP2( hdc );
if (hdc == old_hdc) if (hdc == old_hdc)
{ {
todo_wine ok( rop == R2_WHITE || broken( rop == def_rop), ok( rop == R2_WHITE || broken( rop == def_rop),
"wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc ); "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
SetROP2( old_hdc, def_rop ); SetROP2( old_hdc, def_rop );
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment