From 1475e183293df0b2617f6e962c8f14f6cd7f7fda Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 7 Oct 2025 12:13:58 -0700 Subject: [PATCH] xwm: Use `hidden` in method names instead of `minimized`/`suspended` https://github.com/Smithay/smithay/pull/1482 renamed `set_minimized()` to `set_suspended()`, but didn't rename `is_minimized()`. But the name may not be ideal either. https://specifications.freedesktop.org/wm-spec/latest/ar01s05.html says > _NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate > that a window would not be visible on the screen if its > desktop/viewport were active and its coordinates were within the > screen bounds. The canonical example is that minimized windows should > be in the _NET_WM_STATE_HIDDEN state. Pagers and similar applications > should use _NET_WM_STATE_HIDDEN instead of WM_STATE to decide whether > to display a window in miniature representations of the windows on a > desktop. While https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state:entry:suspended says: > The surface is currently not ordinarily being repainted; for example > because its content is occluded by another window, or its outputs are > switched off due to screen locking. So `_NET_WM_STATE_HIDDEN` shouldn't be set merely because a window is occluded, or on a different workspace? Both definitions could perhaps be a bit more precise. It seems to me `_NET_WM_STATE_HIDDEN` is broader than "minimized", but more specific than the xdg-shell "suspended" state. So just call it "hidden" instead of using some other name. --- src/xwayland/xwm/surface.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xwayland/xwm/surface.rs b/src/xwayland/xwm/surface.rs index fbc4148a48f2..3de806b6a45c 100644 --- a/src/xwayland/xwm/surface.rs +++ b/src/xwayland/xwm/surface.rs @@ -502,8 +502,8 @@ impl X11Surface { .contains(&self.atoms._NET_WM_STATE_FULLSCREEN) } - /// Returns if the window is in the minimized state - pub fn is_minimized(&self) -> bool { + /// Returns if the window is in the hidden state + pub fn is_hidden(&self) -> bool { self.state .lock() .unwrap() @@ -565,10 +565,10 @@ impl X11Surface { Ok(()) } - /// Sets the window as suspended/hidden or not. + /// Sets the window as hidden or not. /// /// Allows the client to e.g. stop rendering. - pub fn set_suspended(&self, suspended: bool) -> Result<(), ConnectionError> { + pub fn set_hidden(&self, suspended: bool) -> Result<(), ConnectionError> { if suspended { self.change_net_state(&[self.atoms._NET_WM_STATE_HIDDEN], &[])?; } else {