diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index 1a6de871ac8..2a634fbe7cf 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -191,12 +191,9 @@ static void reset_dce_attrs( struct dce *dce ) */ static void release_dce( struct dce *dce ) { - RECT vis_rect; - if (!dce->hwnd) return; /* already released */ - vis_rect = get_virtual_screen_rect(); - __wine_set_visible_region( dce->hdc, 0, &vis_rect, &vis_rect, NULL ); + __wine_set_visible_region( dce->hdc, 0, &dummy_surface.rect, &dummy_surface.rect, &dummy_surface ); USER_Driver->pReleaseDC( dce->hwnd, dce->hdc ); if (dce->clip_rgn) DeleteObject( dce->clip_rgn ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 88188680d43..0faf02d0833 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -486,6 +486,67 @@ BOOL is_desktop_window( HWND hwnd ) } +/******************************************************************* + * Dummy window surface for windows that shouldn't get painted. + */ + +static void dummy_surface_lock( struct window_surface *window_surface ) +{ + /* nothing to do */ +} + +static void dummy_surface_unlock( struct window_surface *window_surface ) +{ + /* nothing to do */ +} + +static void *dummy_surface_get_bitmap_info( struct window_surface *window_surface, BITMAPINFO *info ) +{ + static DWORD dummy_data; + + info->bmiHeader.biSize = sizeof( info->bmiHeader ); + info->bmiHeader.biWidth = dummy_surface.rect.right; + info->bmiHeader.biHeight = dummy_surface.rect.bottom; + info->bmiHeader.biPlanes = 1; + info->bmiHeader.biBitCount = 32; + info->bmiHeader.biCompression = BI_RGB; + info->bmiHeader.biSizeImage = 0; + info->bmiHeader.biXPelsPerMeter = 0; + info->bmiHeader.biYPelsPerMeter = 0; + info->bmiHeader.biClrUsed = 0; + info->bmiHeader.biClrImportant = 0; + return &dummy_data; +} + +static RECT *dummy_surface_get_bounds( struct window_surface *window_surface ) +{ + static RECT dummy_bounds; + return &dummy_bounds; +} + +static void dummy_surface_flush( struct window_surface *window_surface ) +{ + /* nothing to do */ +} + +static void dummy_surface_destroy( struct window_surface *window_surface ) +{ + /* nothing to do */ +} + +static const struct window_surface_funcs dummy_surface_funcs = +{ + dummy_surface_lock, + dummy_surface_unlock, + dummy_surface_get_bitmap_info, + dummy_surface_get_bounds, + dummy_surface_flush, + dummy_surface_destroy +}; + +struct window_surface dummy_surface = { &dummy_surface_funcs, { NULL, NULL }, 1, { 0, 0, 1, 1 } }; + + /******************************************************************* * register_window_surface * @@ -495,8 +556,8 @@ void register_window_surface( struct window_surface *old, struct window_surface { if (old == new) return; EnterCriticalSection( &surfaces_section ); - if (old) list_remove( &old->entry ); - if (new) list_add_tail( &window_surfaces, &new->entry ); + if (old && old != &dummy_surface) list_remove( &old->entry ); + if (new && new != &dummy_surface) list_add_tail( &window_surfaces, &new->entry ); LeaveCriticalSection( &surfaces_section ); } diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 4bbe7aed49e..b35fc006b07 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -80,6 +80,7 @@ typedef struct tagWND /* Window functions */ extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; +extern struct window_surface dummy_surface DECLSPEC_HIDDEN; extern void register_window_surface( struct window_surface *old, struct window_surface *new ) DECLSPEC_HIDDEN; extern void flush_window_surfaces( BOOL idle ) DECLSPEC_HIDDEN; extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN;