Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/shell/element/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ struct Minimized(AtomicBool);
#[derive(Default)]
struct Sticky(AtomicBool);

#[derive(Default)]
struct Suspended(AtomicBool);

#[derive(Default)]
struct GlobalGeometry(Mutex<Option<Rectangle<i32, Global>>>);

Expand Down Expand Up @@ -448,6 +451,7 @@ impl CosmicSurface {
let _ = surface.set_mapped(true);
}
}
self.update_suspended();
}

pub fn is_sticky(&self) -> bool {
Expand All @@ -466,7 +470,16 @@ impl CosmicSurface {
.store(sticky, Ordering::SeqCst);
}

pub fn set_suspended(&self, suspended: bool) {
fn update_suspended(&self) {
let minimized = self.is_minimized();
let suspended = self
.0
.user_data()
.get_or_insert_threadsafe(Minimized::default)
.0
.load(Ordering::SeqCst);

let suspended = minimized || suspended;
match self.0.underlying_surface() {
WindowSurface::Wayland(window) => window.with_pending_state(|state| {
if suspended {
Expand All @@ -481,6 +494,15 @@ impl CosmicSurface {
}
}

pub fn set_suspended(&self, suspended: bool) {
self.0
.user_data()
.get_or_insert_threadsafe(Suspended::default)
.0
.store(suspended, Ordering::SeqCst);
self.update_suspended();
}

pub fn min_size_without_ssd(&self) -> Option<Size<i32, Logical>> {
match self.0.underlying_surface() {
WindowSurface::Wayland(toplevel) => {
Expand Down
Loading