]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: assign view->surface earlier in map handler
authorJohan Malm <jgm323@gmail.com>
Sat, 25 Nov 2023 17:40:44 +0000 (17:40 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 25 Nov 2023 20:11:43 +0000 (20:11 +0000)
...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

index 96cb6457ac487aa1b9f2da10673b0a1d73d83bbb..74d9394e02d24738dfcdec27aa7d26aeb3eda7ed 100644 (file)
@@ -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);
        }