From 49365b26d766b50ca326a1ebc4cacd92f9047535 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sat, 25 Nov 2023 17:40:44 +0000 Subject: [PATCH] xwayland: assign view->surface earlier in map handler ...as it needs to be set before honouring xwayland_surface->fullscreen because that calls desktop_update_top_layer_visiblity() which relies on view->surface being set in view_is_focusable() since 13d0b14. Fix bug introduced by PR #1237 which fails to hide the xfce4-panel (or any other layer-shell client in the top layer) whilst gaming in fullscreen. The bug can be observed with the following games: - Alan Wake 2 (wine) - Starfield (steam+proton) - Cyberpunk (steam+proton) - Quake 1 Remaster (steam-native) Fixes: #661 (the last bit of it) Reported-by: @ScarecrowDM Helped-by: @Consolatis --- src/xwayland.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/xwayland.c b/src/xwayland.c index 96cb6457..74d9394e 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -518,6 +518,27 @@ xwayland_view_map(struct view *view) ensure_initial_geometry_and_output(view); wlr_scene_node_set_enabled(&view->scene_tree->node, true); + if (view->surface != xwayland_surface->surface) { + if (view->surface) { + wl_list_remove(&view->surface_destroy.link); + } + view->surface = xwayland_surface->surface; + + /* Required to set the surface to NULL when destroyed by the client */ + view->surface_destroy.notify = handle_surface_destroy; + wl_signal_add(&view->surface->events.destroy, &view->surface_destroy); + + /* Will be free'd automatically once the surface is being destroyed */ + struct wlr_scene_tree *tree = wlr_scene_subsurface_tree_create( + view->scene_tree, view->surface); + if (!tree) { + /* TODO: might need further clean up */ + wl_resource_post_no_memory(view->surface->resource); + return; + } + view->scene_node = &tree->node; + } + /* * Per the Extended Window Manager Hints (EWMH) spec: "The Window * Manager SHOULD honor _NET_WM_STATE whenever a withdrawn window @@ -542,27 +563,6 @@ xwayland_view_map(struct view *view) } view_maximize(view, axis, /*store_natural_geometry*/ true); - if (view->surface != xwayland_surface->surface) { - if (view->surface) { - wl_list_remove(&view->surface_destroy.link); - } - view->surface = xwayland_surface->surface; - - /* Required to set the surface to NULL when destroyed by the client */ - view->surface_destroy.notify = handle_surface_destroy; - wl_signal_add(&view->surface->events.destroy, &view->surface_destroy); - - /* Will be free'd automatically once the surface is being destroyed */ - struct wlr_scene_tree *tree = wlr_scene_subsurface_tree_create( - view->scene_tree, view->surface); - if (!tree) { - /* TODO: might need further clean up */ - wl_resource_post_no_memory(view->surface->resource); - return; - } - view->scene_node = &tree->node; - } - if (!view->toplevel.handle) { init_foreign_toplevel(view); }