Module: wine Branch: master Commit: 1ae9fb069985cf3a1c91b83623008dfd97fdc224 URL: https://gitlab.winehq.org/wine/wine/-/commit/1ae9fb069985cf3a1c91b83623008df...
Author: Rémi Bernon rbernon@codeweavers.com Date: Thu Jun 27 14:28:49 2024 +0200
winex11: Rely on win32u layered window surface attribute updates.
---
dlls/winex11.drv/bitblt.c | 16 +++------------- dlls/winex11.drv/window.c | 14 +++++--------- 2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 5c08c1a2120..780b565b744 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1882,7 +1882,7 @@ static const struct window_surface_funcs x11drv_surface_funcs = * create_surface */ static struct window_surface *create_surface( HWND hwnd, Window window, const XVisualInfo *vis, const RECT *rect, - COLORREF color_key, BOOL use_alpha ) + BOOL use_alpha ) { const XPixmapFormatValues *format = pixmap_formats[vis->depth]; char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; @@ -1952,9 +1952,6 @@ static struct window_surface *create_surface( HWND hwnd, Window window, const XV
TRACE( "created %p for %lx %s image %p\n", surface, window, wine_dbgstr_rect(rect), surface->image->ximage->data );
- if (use_alpha) window_surface_set_layered( &surface->header, color_key, -1, 0xff000000 ); - else window_surface_set_layered( &surface->header, color_key, -1, 0 ); - return &surface->header;
failed: @@ -1995,8 +1992,6 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect ) BOOL X11DRV_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ) { struct x11drv_win_data *data; - DWORD flags; - COLORREF key; BOOL layered = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED;
TRACE( "hwnd %p, surface_rect %s, surface %p\n", hwnd, wine_dbgstr_rect( surface_rect ), surface ); @@ -2022,10 +2017,7 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct win } }
- if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, NULL, &flags ) || !(flags & LWA_COLORKEY)) - key = CLR_INVALID; - - *surface = create_surface( data->hwnd, data->whole_window, &data->vis, surface_rect, key, FALSE ); + *surface = create_surface( data->hwnd, data->whole_window, &data->vis, surface_rect, FALSE );
done: release_win_data( data ); @@ -2050,12 +2042,10 @@ BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *surface_rect, COLORREF c surface = data->surface; if (!surface || !EqualRect( &surface->rect, surface_rect )) { - data->surface = create_surface( data->hwnd, data->whole_window, &data->vis, surface_rect, - color_key, data->use_alpha ); + data->surface = create_surface( data->hwnd, data->whole_window, &data->vis, surface_rect, data->use_alpha ); if (surface) window_surface_release( surface ); surface = data->surface; } - else window_surface_set_layered( surface, color_key, -1, 0xff000000 );
if ((*window_surface = surface)) window_surface_add_ref( surface ); release_win_data( data ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 9e51d76e5ab..5135355abfe 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -438,8 +438,7 @@ static void sync_window_region( struct x11drv_win_data *data, HRGN win_region ) /*********************************************************************** * sync_window_opacity */ -static void sync_window_opacity( Display *display, Window win, - COLORREF key, BYTE alpha, DWORD flags ) +static void sync_window_opacity( Display *display, Window win, BYTE alpha, DWORD flags ) { unsigned long opacity = 0xffffffff;
@@ -1794,7 +1793,7 @@ static void create_whole_window( struct x11drv_win_data *data )
/* set the window opacity */ if (!NtUserGetLayeredWindowAttributes( data->hwnd, &key, &alpha, &layered_flags )) layered_flags = 0; - sync_window_opacity( data->display, data->whole_window, key, alpha, layered_flags ); + sync_window_opacity( data->display, data->whole_window, alpha, layered_flags );
XFlush( data->display ); /* make sure the window exists before we start painting to it */
@@ -1919,8 +1918,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) { data->layered = FALSE; set_window_visual( data, &default_visual, FALSE ); - sync_window_opacity( data->display, data->whole_window, 0, 0, 0 ); - if (data->surface) window_surface_set_layered( data->surface, CLR_INVALID, -1, 0 ); + sync_window_opacity( data->display, data->whole_window, 0, 0 ); } done: release_win_data( data ); @@ -2896,9 +2894,7 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO set_window_visual( data, &default_visual, FALSE );
if (data->whole_window) - sync_window_opacity( data->display, data->whole_window, key, alpha, flags ); - if (data->surface) - window_surface_set_layered( data->surface, (flags & LWA_COLORKEY) ? key : CLR_INVALID, alpha << 24, 0 ); + sync_window_opacity( data->display, data->whole_window, alpha, flags );
data->layered = TRUE; if (!data->mapped) /* mapping is delayed until attributes are set */ @@ -2920,7 +2916,7 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO Window win = X11DRV_get_whole_window( hwnd ); if (win) { - sync_window_opacity( gdi_display, win, key, alpha, flags ); + sync_window_opacity( gdi_display, win, alpha, flags ); if (flags & LWA_COLORKEY) FIXME( "LWA_COLORKEY not supported on foreign process window %p\n", hwnd ); }