1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-01 07:14:31 +00:00

win32u: Use the default window surface when window is not visible.

This commit is contained in:
Rémi Bernon 2024-06-20 09:33:05 +02:00 committed by Alexandre Julliard
parent 63b0a187bd
commit aa14eea31f
14 changed files with 22 additions and 31 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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 */