@@ -994,6 +994,34 @@ impl MoonshineCompositor {
994994 self . clear_dropdowns ( ) ;
995995 }
996996
997+ // Raise the focused window to the top of the stack.
998+ //
999+ // Stacking order is otherwise fixed at map time and never revisited,
1000+ // so focus and z-order can disagree indefinitely: a window mapped
1001+ // earlier keeps covering the focused one. Launching a game from Steam
1002+ // Big Picture hits this — Big Picture stays mapped and on top, and
1003+ // blanks its own surface while the game starts, so the composited
1004+ // output is black even though the game renders correctly underneath.
1005+ //
1006+ // `activate: false` reorders the stack without touching activation
1007+ // state, preserving the `_NET_WM_STATE_FOCUSED` handling that Wine
1008+ // depends on for input delivery (see `mapped_override_redirect_window`).
1009+ self . space . raise_element ( best, false ) ;
1010+
1011+ // Overlays and dropdowns belong above the focused window — gamescope
1012+ // layers base < overlay < external overlay. Re-raise them so the line
1013+ // above cannot bury the Steam overlay behind the game.
1014+ for layer in [
1015+ self . overlay_window . clone ( ) ,
1016+ self . external_overlay_window . clone ( ) ,
1017+ self . override_window . clone ( ) ,
1018+ ]
1019+ . into_iter ( )
1020+ . flatten ( )
1021+ {
1022+ self . space . raise_element ( & layer, false ) ;
1023+ }
1024+
9971025 // Find the overlay window with input_focus_mode != 0.
9981026 // Gamescope: looks for overlayWindow with inputFocusMode set.
9991027 let overlay_with_input_focus: Option < Window > = self . overlay_window . as_ref ( ) . and_then ( |w| {
0 commit comments