Make CosmicWindowInternal/CosmicStackInternal not Clone

`IcedElement` uses `Arc` internally (and compares with `Arc::ptr_eq`).
So these structs are never cloned, and probably shouldn't be.
This commit is contained in:
Ian Douglas Scott 2025-10-30 14:54:32 -07:00 committed by Ian Douglas Scott
parent 6e4164643e
commit 505e36dcda
2 changed files with 35 additions and 36 deletions

View file

@ -64,7 +64,7 @@ use std::{
fmt,
hash::Hash,
sync::{
Arc, LazyLock, Mutex,
LazyLock, Mutex,
atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering},
},
};
@ -91,21 +91,21 @@ impl fmt::Debug for CosmicStack {
}
}
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct CosmicStackInternal {
windows: Arc<Mutex<Vec<CosmicSurface>>>,
active: Arc<AtomicUsize>,
activated: Arc<AtomicBool>,
group_focused: Arc<AtomicBool>,
previous_index: Arc<Mutex<Option<(Serial, usize)>>>,
scroll_to_focus: Arc<AtomicBool>,
previous_keyboard: Arc<AtomicUsize>,
pointer_entered: Arc<AtomicU8>,
reenter: Arc<AtomicBool>,
potential_drag: Arc<Mutex<Option<usize>>>,
override_alive: Arc<AtomicBool>,
geometry: Arc<Mutex<Option<Rectangle<i32, Global>>>>,
mask: Arc<Mutex<Option<tiny_skia::Mask>>>,
windows: Mutex<Vec<CosmicSurface>>,
active: AtomicUsize,
activated: AtomicBool,
group_focused: AtomicBool,
previous_index: Mutex<Option<(Serial, usize)>>,
scroll_to_focus: AtomicBool,
previous_keyboard: AtomicUsize,
pointer_entered: AtomicU8,
reenter: AtomicBool,
potential_drag: Mutex<Option<usize>>,
override_alive: AtomicBool,
geometry: Mutex<Option<Rectangle<i32, Global>>>,
mask: Mutex<Option<tiny_skia::Mask>>,
}
impl CosmicStackInternal {
@ -146,19 +146,19 @@ impl CosmicStack {
let width = windows[0].geometry().size.w;
CosmicStack(IcedElement::new(
CosmicStackInternal {
windows: Arc::new(Mutex::new(windows)),
active: Arc::new(AtomicUsize::new(0)),
activated: Arc::new(AtomicBool::new(false)),
group_focused: Arc::new(AtomicBool::new(false)),
previous_index: Arc::new(Mutex::new(None)),
scroll_to_focus: Arc::new(AtomicBool::new(false)),
previous_keyboard: Arc::new(AtomicUsize::new(0)),
pointer_entered: Arc::new(AtomicU8::new(0)),
reenter: Arc::new(AtomicBool::new(false)),
potential_drag: Arc::new(Mutex::new(None)),
override_alive: Arc::new(AtomicBool::new(true)),
geometry: Arc::new(Mutex::new(None)),
mask: Arc::new(Mutex::new(None)),
windows: Mutex::new(windows),
active: AtomicUsize::new(0),
activated: AtomicBool::new(false),
group_focused: AtomicBool::new(false),
previous_index: Mutex::new(None),
scroll_to_focus: AtomicBool::new(false),
previous_keyboard: AtomicUsize::new(0),
pointer_entered: AtomicU8::new(0),
reenter: AtomicBool::new(false),
potential_drag: Mutex::new(None),
override_alive: AtomicBool::new(true),
geometry: Mutex::new(None),
mask: Mutex::new(None),
},
(width, TAB_HEIGHT),
handle,

View file

@ -50,7 +50,7 @@ use std::{
fmt,
hash::Hash,
sync::{
Arc, Mutex,
Mutex,
atomic::{AtomicBool, AtomicU8, Ordering},
},
};
@ -72,13 +72,12 @@ impl fmt::Debug for CosmicWindow {
}
}
#[derive(Clone)]
pub struct CosmicWindowInternal {
pub(super) window: CosmicSurface,
activated: Arc<AtomicBool>,
activated: AtomicBool,
/// TODO: This needs to be per seat
pointer_entered: Arc<AtomicU8>,
last_title: Arc<Mutex<String>>,
pointer_entered: AtomicU8,
last_title: Mutex<String>,
}
impl fmt::Debug for CosmicWindowInternal {
@ -192,9 +191,9 @@ impl CosmicWindow {
CosmicWindow(IcedElement::new(
CosmicWindowInternal {
window,
activated: Arc::new(AtomicBool::new(false)),
pointer_entered: Arc::new(AtomicU8::new(0)),
last_title: Arc::new(Mutex::new(last_title)),
activated: AtomicBool::new(false),
pointer_entered: AtomicU8::new(0),
last_title: Mutex::new(last_title),
},
(width, SSD_HEIGHT),
handle,