From: Paul Gofman <pgofman@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59109 --- dlls/win32u/dce.c | 25 +++++++++++++++++++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 2 ++ 3 files changed, 28 insertions(+) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 5d6cbb70194..720d911b1f0 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -608,6 +608,31 @@ void *window_surface_get_color( struct window_surface *surface, BITMAPINFO *info return gdi_bits.ptr; } +void window_surface_clear( HWND hwnd ) +{ + char color_buf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; + BITMAPINFO *color_info = (BITMAPINFO *)color_buf; + struct window_surface *surface; + void *color_bits; + + pthread_mutex_lock( &surfaces_lock ); + LIST_FOR_EACH_ENTRY( surface, &window_surfaces, struct window_surface, entry ) + { + if (surface->hwnd == hwnd) + { + if (!surface->alpha_mask) /* ULW layered window surfaces are only updated from NtUserUpdateLayeredWindow(). */ + { + window_surface_lock( surface ); + if ((color_bits = window_surface_get_color( surface, color_info ))) + memset( color_bits, 0, color_info->bmiHeader.biSizeImage ); + window_surface_unlock( surface ); + } + break; + } + } + pthread_mutex_unlock( &surfaces_lock ); +} + W32KAPI void window_surface_flush( struct window_surface *surface ) { char color_buf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 71b497604a0..7f4bf2d1dac 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -55,6 +55,7 @@ extern void move_window_bits_surface( HWND hwnd, const RECT *window_rect, struct extern void register_window_surface( struct window_surface *old, struct window_surface *new ); extern void *window_surface_get_color( struct window_surface *surface, BITMAPINFO *info ); +extern void window_surface_clear( HWND hwnd ); /* defwnd.c */ extern BOOL adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD ex_style, UINT dpi ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 4bceb90fcd2..6f4396b3ecb 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -327,6 +327,8 @@ void *client_surface_create( UINT size, const struct client_surface_funcs *funcs surface->ref = 1; surface->hwnd = hwnd; + window_surface_clear( hwnd ); + pthread_mutex_lock( &surfaces_lock ); list_add_tail( &client_surfaces, &surface->entry ); pthread_mutex_unlock( &surfaces_lock ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9864