From 26ee83aaa7a5dc9016d0d871df53bec04ceec3a5 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 6 Jul 2026 12:34:21 -0700 Subject: [PATCH] Implement `Debug` and comparison with `CosmicMapped` for `CosmicMappedKey` --- src/shell/element/mod.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/shell/element/mod.rs b/src/shell/element/mod.rs index 8639aeb6..4c8ca171 100644 --- a/src/shell/element/mod.rs +++ b/src/shell/element/mod.rs @@ -125,9 +125,9 @@ impl fmt::Debug for CosmicMapped { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct CosmicMappedKey(CosmicMappedKeyInner); -#[derive(Clone)] +#[derive(Clone, Debug)] enum CosmicMappedKeyInner { Window(Weak>>), Stack(Weak>>), @@ -166,6 +166,20 @@ impl PartialEq for CosmicMappedKey { } impl Eq for CosmicMappedKey {} +impl PartialEq for CosmicMapped { + fn eq(&self, other: &CosmicMappedKey) -> bool { + match (&self.element, &other.0) { + (CosmicMappedInternal::Window(window), CosmicMappedKeyInner::Window(weak)) => { + Arc::as_ptr(&window.0.0) == weak.as_ptr() + } + (CosmicMappedInternal::Stack(stack), CosmicMappedKeyInner::Stack(weak)) => { + Arc::as_ptr(&stack.0.0) == weak.as_ptr() + } + _ => false, + } + } +} + impl PartialEq for CosmicMapped { fn eq(&self, other: &Self) -> bool { self.element == other.element