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:
parent
6e4164643e
commit
505e36dcda
2 changed files with 35 additions and 36 deletions
|
|
@ -64,7 +64,7 @@ use std::{
|
||||||
fmt,
|
fmt,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
sync::{
|
sync::{
|
||||||
Arc, LazyLock, Mutex,
|
LazyLock, Mutex,
|
||||||
atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering},
|
atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -91,21 +91,21 @@ impl fmt::Debug for CosmicStack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug)]
|
||||||
pub struct CosmicStackInternal {
|
pub struct CosmicStackInternal {
|
||||||
windows: Arc<Mutex<Vec<CosmicSurface>>>,
|
windows: Mutex<Vec<CosmicSurface>>,
|
||||||
active: Arc<AtomicUsize>,
|
active: AtomicUsize,
|
||||||
activated: Arc<AtomicBool>,
|
activated: AtomicBool,
|
||||||
group_focused: Arc<AtomicBool>,
|
group_focused: AtomicBool,
|
||||||
previous_index: Arc<Mutex<Option<(Serial, usize)>>>,
|
previous_index: Mutex<Option<(Serial, usize)>>,
|
||||||
scroll_to_focus: Arc<AtomicBool>,
|
scroll_to_focus: AtomicBool,
|
||||||
previous_keyboard: Arc<AtomicUsize>,
|
previous_keyboard: AtomicUsize,
|
||||||
pointer_entered: Arc<AtomicU8>,
|
pointer_entered: AtomicU8,
|
||||||
reenter: Arc<AtomicBool>,
|
reenter: AtomicBool,
|
||||||
potential_drag: Arc<Mutex<Option<usize>>>,
|
potential_drag: Mutex<Option<usize>>,
|
||||||
override_alive: Arc<AtomicBool>,
|
override_alive: AtomicBool,
|
||||||
geometry: Arc<Mutex<Option<Rectangle<i32, Global>>>>,
|
geometry: Mutex<Option<Rectangle<i32, Global>>>,
|
||||||
mask: Arc<Mutex<Option<tiny_skia::Mask>>>,
|
mask: Mutex<Option<tiny_skia::Mask>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CosmicStackInternal {
|
impl CosmicStackInternal {
|
||||||
|
|
@ -146,19 +146,19 @@ impl CosmicStack {
|
||||||
let width = windows[0].geometry().size.w;
|
let width = windows[0].geometry().size.w;
|
||||||
CosmicStack(IcedElement::new(
|
CosmicStack(IcedElement::new(
|
||||||
CosmicStackInternal {
|
CosmicStackInternal {
|
||||||
windows: Arc::new(Mutex::new(windows)),
|
windows: Mutex::new(windows),
|
||||||
active: Arc::new(AtomicUsize::new(0)),
|
active: AtomicUsize::new(0),
|
||||||
activated: Arc::new(AtomicBool::new(false)),
|
activated: AtomicBool::new(false),
|
||||||
group_focused: Arc::new(AtomicBool::new(false)),
|
group_focused: AtomicBool::new(false),
|
||||||
previous_index: Arc::new(Mutex::new(None)),
|
previous_index: Mutex::new(None),
|
||||||
scroll_to_focus: Arc::new(AtomicBool::new(false)),
|
scroll_to_focus: AtomicBool::new(false),
|
||||||
previous_keyboard: Arc::new(AtomicUsize::new(0)),
|
previous_keyboard: AtomicUsize::new(0),
|
||||||
pointer_entered: Arc::new(AtomicU8::new(0)),
|
pointer_entered: AtomicU8::new(0),
|
||||||
reenter: Arc::new(AtomicBool::new(false)),
|
reenter: AtomicBool::new(false),
|
||||||
potential_drag: Arc::new(Mutex::new(None)),
|
potential_drag: Mutex::new(None),
|
||||||
override_alive: Arc::new(AtomicBool::new(true)),
|
override_alive: AtomicBool::new(true),
|
||||||
geometry: Arc::new(Mutex::new(None)),
|
geometry: Mutex::new(None),
|
||||||
mask: Arc::new(Mutex::new(None)),
|
mask: Mutex::new(None),
|
||||||
},
|
},
|
||||||
(width, TAB_HEIGHT),
|
(width, TAB_HEIGHT),
|
||||||
handle,
|
handle,
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ use std::{
|
||||||
fmt,
|
fmt,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
sync::{
|
sync::{
|
||||||
Arc, Mutex,
|
Mutex,
|
||||||
atomic::{AtomicBool, AtomicU8, Ordering},
|
atomic::{AtomicBool, AtomicU8, Ordering},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -72,13 +72,12 @@ impl fmt::Debug for CosmicWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct CosmicWindowInternal {
|
pub struct CosmicWindowInternal {
|
||||||
pub(super) window: CosmicSurface,
|
pub(super) window: CosmicSurface,
|
||||||
activated: Arc<AtomicBool>,
|
activated: AtomicBool,
|
||||||
/// TODO: This needs to be per seat
|
/// TODO: This needs to be per seat
|
||||||
pointer_entered: Arc<AtomicU8>,
|
pointer_entered: AtomicU8,
|
||||||
last_title: Arc<Mutex<String>>,
|
last_title: Mutex<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for CosmicWindowInternal {
|
impl fmt::Debug for CosmicWindowInternal {
|
||||||
|
|
@ -192,9 +191,9 @@ impl CosmicWindow {
|
||||||
CosmicWindow(IcedElement::new(
|
CosmicWindow(IcedElement::new(
|
||||||
CosmicWindowInternal {
|
CosmicWindowInternal {
|
||||||
window,
|
window,
|
||||||
activated: Arc::new(AtomicBool::new(false)),
|
activated: AtomicBool::new(false),
|
||||||
pointer_entered: Arc::new(AtomicU8::new(0)),
|
pointer_entered: AtomicU8::new(0),
|
||||||
last_title: Arc::new(Mutex::new(last_title)),
|
last_title: Mutex::new(last_title),
|
||||||
},
|
},
|
||||||
(width, SSD_HEIGHT),
|
(width, SSD_HEIGHT),
|
||||||
handle,
|
handle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue