From 346f055fdcd14c283631e760e85e8e3f71592b0b Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 30 Sep 2025 10:22:10 -0700 Subject: [PATCH] focus: Check if X11 surface matches in `KeyboardFocus::replace()` Tested on `SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=1 supertux2`, using XWayland. If the game starts with fullscreen configured, it minimizes immediately on start. But after this change, this no longer happens. This hopefully will improve behaviors with various X11/wine fullscreen clients. It may fix https://github.com/pop-os/cosmic-comp/issues/1510, though looking at the video the behavior there may be a bit different. --- src/shell/focus/target.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell/focus/target.rs b/src/shell/focus/target.rs index 7f02531f..f4ea9884 100644 --- a/src/shell/focus/target.rs +++ b/src/shell/focus/target.rs @@ -494,7 +494,7 @@ impl KeyboardTarget for KeyboardFocusTarget { } fn replace( &self, - replaced: ::KeyboardFocus, + replaced: Self, seat: &Seat, data: &mut State, keys: Vec>, @@ -504,6 +504,9 @@ impl KeyboardTarget for KeyboardFocusTarget { if !replaced .wl_surface() .is_some_and(|s| Some(s) == self.wl_surface()) + && !replaced + .x11_surface() + .is_some_and(|s| Some(s) == self.x11_surface()) { KeyboardTarget::leave(&replaced, seat, data, serial); KeyboardTarget::enter(self, seat, data, keys, serial);