From aa14eea31f6da9ad6fccb18f6798d17f609b7182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 20 Jun 2024 09:33:05 +0200 Subject: [PATCH] win32u: Use the default window surface when window is not visible. --- dlls/win32u/driver.c | 2 +- dlls/win32u/window.c | 7 +++++-- dlls/wineandroid.drv/android.h | 2 +- dlls/wineandroid.drv/window.c | 7 ++----- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/surface.c | 6 ++---- dlls/winemac.drv/window.c | 1 - dlls/winewayland.drv/waylanddrv.h | 2 +- dlls/winewayland.drv/window.c | 8 ++------ dlls/winewayland.drv/window_surface.c | 4 ++-- dlls/winex11.drv/bitblt.c | 5 ++--- dlls/winex11.drv/window.c | 1 - dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 ++-- 14 files changed, 22 insertions(+), 31 deletions(-) diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 25ed2af1a17..7918945b625 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -889,7 +889,7 @@ static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *wi return TRUE; } -static BOOL nulldrv_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) +static BOOL nulldrv_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ) { return FALSE; } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 05496418665..841ab220074 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1845,13 +1845,16 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, RECT surface_rect, visible_rect = *window_rect, old_visible_rect, old_window_rect, old_client_rect, extra_rects[3]; struct window_surface *old_surface, *new_surface; - needs_surface = user_driver->pWindowPosChanging( hwnd, swp_flags, window_rect, client_rect, &visible_rect ); + if (!user_driver->pWindowPosChanging( hwnd, swp_flags, window_rect, client_rect, &visible_rect )) needs_surface = FALSE; + else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; + else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; + else needs_surface = !!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE); if (!get_surface_rect( &visible_rect, &surface_rect )) needs_surface = FALSE; if (!get_default_window_surface( hwnd, &surface_rect, &new_surface )) return FALSE; if (!needs_surface || IsRectEmpty( &visible_rect )) needs_surface = FALSE; /* use default surface */ - else needs_surface = !user_driver->pCreateWindowSurface( hwnd, swp_flags, &surface_rect, &new_surface ); + else needs_surface = !user_driver->pCreateWindowSurface( hwnd, &surface_rect, &new_surface ); get_window_rects( hwnd, COORDS_SCREEN, &old_window_rect, NULL, get_thread_dpi() ); if (IsRectEmpty( &valid_rects[0] )) valid_rects = NULL; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index d63f0ee37ec..c92240c40bc 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -102,7 +102,7 @@ extern BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COL struct window_surface **surface ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); -extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ); +extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ); extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, const RECT *visible_rect, const RECT *valid_rects, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 706f050534a..6d2e51ee070 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1136,7 +1136,6 @@ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_re if (!data && !(data = create_win_data( hwnd, window_rect, client_rect ))) return FALSE; /* use default surface */ if (data->parent) goto done; /* use default surface */ - if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (is_argb_surface( data->surface )) goto done; /* use default surface */ ret = TRUE; @@ -1150,7 +1149,7 @@ done: /*********************************************************************** * ANDROID_CreateWindowSurface */ -BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) +BOOL ANDROID_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ) { struct android_win_data *data; DWORD flags; @@ -1158,7 +1157,7 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface BYTE alpha; BOOL layered = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED; - TRACE( "hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( surface_rect ), surface ); + TRACE( "hwnd %p, surface_rect %s, surface %p\n", hwnd, wine_dbgstr_rect( surface_rect ), surface ); if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ @@ -1173,8 +1172,6 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface goto done; } } - if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) - goto done; if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags )) flags = 0; if (!(flags & LWA_ALPHA)) alpha = 255; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 4a92847dba2..8824f3385fa 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -151,7 +151,7 @@ extern void macdrv_UpdateLayeredWindow(HWND hwnd, const RECT *window_rect, COLOR 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, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); -extern BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface); +extern BOOL macdrv_CreateWindowSurface(HWND hwnd, const RECT *surface_rect, struct window_surface **surface); extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, const RECT *visible_rect, const RECT *valid_rects, diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c index d7c76998995..80926760fdf 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -228,12 +228,11 @@ void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha /*********************************************************************** * CreateWindowSurface (MACDRV.@) */ -BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface) +BOOL macdrv_CreateWindowSurface(HWND hwnd, const RECT *surface_rect, struct window_surface **surface) { struct macdrv_win_data *data; - DWORD style = NtUserGetWindowLongW(hwnd, GWL_STYLE); - TRACE("hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(surface_rect), surface); + TRACE("hwnd %p, surface_rect %s, surface %p\n", hwnd, wine_dbgstr_rect(surface_rect), surface); if (!(data = get_win_data(hwnd))) return TRUE; /* use default surface */ @@ -250,7 +249,6 @@ BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_r goto done; } } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(style & WS_VISIBLE)) goto done; *surface = create_surface(data->hwnd, data->cocoa_window, surface_rect, data->surface, FALSE); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 36f3e3053d6..e772adf29b3 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1964,7 +1964,6 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect wine_dbgstr_rect(visible_rect)); if (!data->cocoa_window) goto done; /* use default surface */ - if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (data->ulw_layered) goto done; /* use default surface */ ret = TRUE; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 9cce608ce85..d4ef01a8a1e 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -361,7 +361,7 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *visible_rect, const RECT *valid_rects, struct window_surface *surface); BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface); +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, const RECT *surface_rect, struct window_surface **surface); UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs); struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version); diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 9a77d8cf47e..c1fb5c6e0b5 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -431,7 +431,7 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rec { struct wayland_win_data *data = wayland_win_data_get(hwnd); HWND parent; - BOOL visible, ret = FALSE; + BOOL ret = FALSE; TRACE("hwnd %p window %s client %s visible %s flags %08x\n", hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), @@ -440,11 +440,7 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rec if (!data && !(data = wayland_win_data_create(hwnd, window_rect, client_rect))) return FALSE; /* use default surface */ parent = NtUserGetAncestor(hwnd, GA_PARENT); - visible = ((NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_VISIBLE) || - (swp_flags & SWP_SHOWWINDOW)) && - !(swp_flags & SWP_HIDEWINDOW); - - if ((parent && parent != NtUserGetDesktopWindow()) || !visible) goto done; /* use default surface */ + if ((parent && parent != NtUserGetDesktopWindow())) goto done; /* use default surface */ ret = TRUE; diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index fa4a69d5490..d1ac582e7ec 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -524,11 +524,11 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *window /*********************************************************************** * WAYLAND_CreateWindowSurface */ -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface) +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, const RECT *surface_rect, struct window_surface **surface) { struct wayland_win_data *data; - TRACE("hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(surface_rect), surface); + TRACE("hwnd %p, surface_rect %s, surface %p\n", hwnd, wine_dbgstr_rect(surface_rect), surface); if (!(data = wayland_win_data_get(hwnd))) return TRUE; /* use default surface */ diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 11d37f6bb15..0bc0f02ffd5 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -2187,14 +2187,14 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect ) /*********************************************************************** * CreateWindowSurface (X11DRV.@) */ -BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) +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, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( surface_rect ), surface ); + TRACE( "hwnd %p, surface_rect %s, surface %p\n", hwnd, wine_dbgstr_rect( surface_rect ), surface ); if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ @@ -2216,7 +2216,6 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_ goto done; } } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) goto done; if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, NULL, &flags ) || !(flags & LWA_COLORKEY)) key = CLR_INVALID; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 9564f05f8e9..2a84bc49620 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2599,7 +2599,6 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rec X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect ); if (!data->whole_window && !data->embedded) goto done; /* use default surface */ - if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (data->use_alpha) goto done; /* use default surface */ ret = TRUE; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8b78f9648b2..4a9bdafd449 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -246,7 +246,7 @@ extern void X11DRV_UpdateLayeredWindow( HWND hwnd, const RECT *window_rect, COLO 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, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); -extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ); +extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *rectWindow, const RECT *rectClient, const RECT *visible_rect, const RECT *valid_rects, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 5ee77e25f28..d835e45af3f 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -179,7 +179,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 85 +#define WINE_GDI_DRIVER_VERSION 86 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -338,7 +338,7 @@ struct user_driver_funcs void (*pUpdateLayeredWindow)(HWND,const RECT *,COLORREF,BYTE,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,const RECT *,const RECT *,RECT *); - BOOL (*pCreateWindowSurface)(HWND,UINT,const RECT *,struct window_surface**); + BOOL (*pCreateWindowSurface)(HWND,const RECT *,struct window_surface**); void (*pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *, const RECT *,struct window_surface*); /* system parameters */