element: Introduce CosmicMappedKey for safely hashing windows across threads

This commit is contained in:
Victoria Brekenfeld 2024-06-07 19:15:16 +02:00 committed by Victoria Brekenfeld
parent f481112cf9
commit bd58481d19
8 changed files with 75 additions and 20 deletions

View file

@ -4,7 +4,7 @@ use std::{
borrow::{Borrow, BorrowMut},
cell::RefCell,
collections::HashMap,
sync::Weak,
sync::{Arc, RwLock, Weak},
time::Instant,
};
@ -14,6 +14,7 @@ use crate::{
backend::render::element::DamageElement,
config::Config,
shell::{
element::CosmicMappedKey,
focus::target::WindowGroup,
grabs::{SeatMenuGrabState, SeatMoveGrabState},
layout::tiling::ANIMATION_DURATION,
@ -112,7 +113,7 @@ pub enum Usage {
pub enum Key {
Static(Id),
Group(Weak<()>),
Window(Usage, CosmicMapped),
Window(Usage, CosmicMappedKey),
}
impl std::hash::Hash for Key {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {