Set X11Surface hidden when a surface is minimized

This seems for an SDL XWayland client to restore fullscreen after
unminimize, it needs to see the `_NET_WM_STATE_HIDDEN` state get set
and unset.

In general `_NET_WM_STATE_HIDDEN` does not seem to cover all the
cases covered by waylands "suspended" state, so let's not equate them.

https://github.com/pop-os/cosmic-comp/issues/1510
This commit is contained in:
Ian Douglas Scott 2025-10-02 20:24:11 -07:00 committed by Victoria Brekenfeld
parent 1f9c130410
commit 282d76ef34
3 changed files with 8 additions and 10 deletions

View file

@ -416,8 +416,9 @@ impl CosmicSurface {
.get_or_insert_threadsafe(Minimized::default)
.0
.store(minimized, Ordering::SeqCst);
if !minimized {
if let WindowSurface::X11(surface) = self.0.underlying_surface() {
if let WindowSurface::X11(surface) = self.0.underlying_surface() {
let _ = surface.set_hidden(minimized);
if !minimized {
let _ = surface.set_mapped(false);
let _ = surface.set_mapped(true);
}
@ -441,17 +442,14 @@ impl CosmicSurface {
}
pub fn set_suspended(&self, suspended: bool) {
match self.0.underlying_surface() {
WindowSurface::Wayland(window) => window.with_pending_state(|state| {
if let WindowSurface::Wayland(window) = self.0.underlying_surface() {
window.with_pending_state(|state| {
if suspended {
state.states.set(ToplevelState::Suspended);
} else {
state.states.unset(ToplevelState::Suspended);
}
}),
WindowSurface::X11(surface) => {
let _ = surface.set_suspended(suspended);
}
});
}
}