gdi32: Add the ability to disable a DC.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Huw Davies 2017-01-26 09:30:19 +00:00 committed by Alexandre Julliard
parent 1e8f554ef9
commit 0805b0d567
3 changed files with 13 additions and 0 deletions

View File

@ -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 );

View File

@ -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;

View File

@ -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);