Commit 0805b0d5 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Add the ability to disable a DC.

parent 1e8f554e
......@@ -203,6 +203,11 @@ DC *get_dc_ptr( HDC hdc )
{
DC *dc = get_dc_obj( hdc );
if (!dc) return NULL;
if (dc->disabled)
{
GDI_ReleaseObj( hdc );
return NULL;
}
if (!InterlockedCompareExchange( &dc->refcount, 1, 0 ))
{
......@@ -1269,6 +1274,11 @@ WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
else if (flags & DCHF_VALIDATEVISRGN || !flags)
ret = InterlockedExchange( &dc->dirty, 0 );
if (flags & DCHF_DISABLEDC)
ret = InterlockedExchange( &dc->disabled, 1 );
else if (flags & DCHF_ENABLEDC)
ret = InterlockedExchange( &dc->disabled, 0 );
GDI_ReleaseObj( hdc );
if (flags & DCHF_RESETDC) ret = reset_dc_state( hdc );
......
......@@ -65,6 +65,7 @@ typedef struct tagDC
DWORD thread; /* thread owning the DC */
LONG refcount; /* thread refcount */
LONG dirty; /* dirty flag */
LONG disabled; /* get_dc_ptr() will return NULL. Controlled by DCHF_(DISABLE|ENABLE)DC */
INT saveLevel;
struct tagDC *saved_dc;
DWORD_PTR dwHookData;
......
......@@ -266,6 +266,8 @@ static inline ULONG window_surface_release( struct window_surface *surface )
#define DCHF_INVALIDATEVISRGN 0x0001
#define DCHF_VALIDATEVISRGN 0x0002
#define DCHF_RESETDC 0x0004 /* Wine extension */
#define DCHF_DISABLEDC 0x0008 /* Wine extension */
#define DCHF_ENABLEDC 0x0010 /* Wine extension */
typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
......
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