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

2
Cargo.lock generated
View file

@ -4961,7 +4961,7 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "smithay"
version = "0.7.0"
source = "git+https://github.com/smithay/smithay.git?rev=15e3fcd#15e3fcde99deb1adfab4c63be0a06783b780e963"
source = "git+https://github.com/smithay/smithay.git?rev=d40ada5#d40ada55eceac04fb1c752f0f17b0c32cf24fbb1"
dependencies = [
"aliasable",
"appendlist",

View file

@ -145,4 +145,4 @@ cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch
cosmic-client-toolkit = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }
[patch.crates-io]
smithay = { git = "https://github.com/smithay/smithay.git", rev = "15e3fcd" }
smithay = { git = "https://github.com/smithay/smithay.git", rev = "d40ada5" }

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);
}
});
}
}