Based on a patch by Dmitry Timoshkov.
Supersedes https://gitlab.winehq.org/wine/wine/-/merge_requests/7344
From: Sebastian Lackner sebastian@fds-team.de
Based on a patch by Dmitry Timoshkov. --- dlls/win32u/driver.c | 6 +++--- dlls/win32u/window.c | 9 ++++++--- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/window.c | 4 ++-- dlls/winex11.drv/window.c | 6 +++++- dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 ++-- 7 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 22e48fa6782..5edac6a0c8a 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -862,7 +862,7 @@ static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam, cons return -1; }
-static void nulldrv_UpdateLayeredWindow( HWND hwnd, UINT flags ) +static void nulldrv_UpdateLayeredWindow( HWND hwnd, BYTE alpha, UINT flags ) { }
@@ -1221,9 +1221,9 @@ static void loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) load_driver()->pSetWindowRgn( hwnd, hrgn, redraw ); }
-static void loaderdrv_UpdateLayeredWindow( HWND hwnd, UINT flags ) +static void loaderdrv_UpdateLayeredWindow( HWND hwnd, BYTE alpha, UINT flags ) { - load_driver()->pUpdateLayeredWindow( hwnd, flags ); + load_driver()->pUpdateLayeredWindow( hwnd, alpha, flags ); }
static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs ) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 0a3d6b28e47..c681333aa4a 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2481,7 +2481,11 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects, NULL ); if (!surface) return FALSE;
- if (!hdc_src || surface == &dummy_surface) ret = TRUE; + if (!hdc_src || surface == &dummy_surface) + { + user_driver->pUpdateLayeredWindow( hwnd, blend->SourceConstantAlpha, flags ); + ret = TRUE; + } else { BLENDFUNCTION src_blend = { AC_SRC_OVER, 0, 255, 0 }; @@ -2502,7 +2506,6 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ if (pts_src) OffsetRect( &src_rect, pts_src->x, pts_src->y ); NtGdiTransformPoints( hdc_src, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP );
- if (flags & ULW_ALPHA) src_blend = *blend; ret = NtGdiAlphaBlend( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hdc_src, src_rect.left, src_rect.top, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, *(DWORD *)&src_blend, 0 ); @@ -2514,7 +2517,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ if (!(flags & ULW_COLORKEY)) key = CLR_INVALID; window_surface_set_layered( surface, key, -1, 0xff000000 );
- user_driver->pUpdateLayeredWindow( hwnd, flags ); + user_driver->pUpdateLayeredWindow( hwnd, blend->SourceConstantAlpha, flags ); window_surface_flush( surface ); }
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 4457a7e186c..4673d69654a 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -145,7 +145,7 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern void macdrv_SetWindowText(HWND hwnd, LPCWSTR text); extern UINT macdrv_ShowWindow(HWND hwnd, INT cmd, RECT *rect, UINT swp); extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos); -extern void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags); +extern void macdrv_UpdateLayeredWindow(HWND hwnd, BYTE alpha, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects); extern BOOL macdrv_GetWindowStyleMasks(HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 05126678264..272cdd67912 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1627,7 +1627,7 @@ done: /*********************************************************************** * UpdateLayeredWindow (MACDRV.@) */ -void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags) +void macdrv_UpdateLayeredWindow(HWND hwnd, BYTE alpha, UINT flags) { struct macdrv_win_data *data;
@@ -1638,7 +1638,7 @@ void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags) show_window(data);
/* The ULW flags are a superset of the LWA flags. */ - sync_window_opacity(data, 255, TRUE, flags); + sync_window_opacity(data, alpha, TRUE, flags); release_win_data(data); } } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f2de8a23ff6..f70e74296cd 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3204,12 +3204,16 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO /*********************************************************************** * UpdateLayeredWindow (X11DRV.@) */ -void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ) +void X11DRV_UpdateLayeredWindow( HWND hwnd, BYTE alpha, UINT flags ) { struct x11drv_win_data *data; BOOL mapped;
if (!(data = get_win_data( hwnd ))) return; + + if (data->whole_window) + sync_window_opacity( data->display, data->whole_window, alpha, flags ); + mapped = data->desired_state.wm_state != WithdrawnState; release_win_data( data );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 91811cfd766..a5bab864ad9 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -239,7 +239,7 @@ extern UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); extern LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam, const POINT *pos ); extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern void X11DRV_UpdateClipboard(void); -extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); +extern void X11DRV_UpdateLayeredWindow( HWND hwnd, BYTE alpha, UINT flags ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ); extern BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 51a095fd2b0..efee8d1af4d 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -219,7 +219,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 102 +#define WINE_GDI_DRIVER_VERSION 103
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -381,7 +381,7 @@ struct user_driver_funcs void (*pSetWindowText)(HWND,LPCWSTR); UINT (*pShowWindow)(HWND,INT,RECT*,UINT); LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM,const POINT*); - void (*pUpdateLayeredWindow)(HWND,UINT); + void (*pUpdateLayeredWindow)(HWND,BYTE,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const struct window_rects *); BOOL (*pGetWindowStyleMasks)(HWND,UINT,UINT,UINT*,UINT*);
This merge request was approved by Rémi Bernon.
Just in case it matters: