refactor: add namespace

This commit is contained in:
Ashley Wulber 2024-11-27 10:59:41 -05:00 committed by Victoria Brekenfeld
parent 60558e18fd
commit a14d075aa0
2 changed files with 25 additions and 12 deletions

12
Cargo.lock generated
View file

@ -899,7 +899,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-protocols" name = "cosmic-protocols"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/cosmic-protocols?branch=main#27d70b6eb9c785a2a48341016f32a7b1ac4980ac" source = "git+https://github.com/pop-os/cosmic-protocols?branch=main#d218c76b58c7a3b20dd5e7943f93fc306a1b81b8"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
@ -1064,7 +1064,7 @@ version = "0.19.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"libloading 0.7.4", "libloading 0.8.5",
"winapi", "winapi",
] ]
@ -1199,7 +1199,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [ dependencies = [
"libloading 0.7.4", "libloading 0.8.5",
] ]
[[package]] [[package]]
@ -2162,7 +2162,7 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"com", "com",
"libc", "libc",
"libloading 0.7.4", "libloading 0.8.5",
"thiserror", "thiserror",
"widestring", "widestring",
"winapi", "winapi",
@ -2828,7 +2828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.6", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -5879,7 +5879,7 @@ dependencies = [
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libc", "libc",
"libloading 0.7.4", "libloading 0.8.5",
"log", "log",
"metal", "metal",
"naga", "naga",

View file

@ -184,9 +184,12 @@ impl LayerOverlapNotificationDataInternal {
} }
} }
} }
for (_, (identifier, exclusive, layer, overlap)) in &self.last_snapshot.layer_overlaps { for (_, (identifier, namespace, exclusive, layer, overlap)) in
&self.last_snapshot.layer_overlaps
{
new_notification.layer_enter( new_notification.layer_enter(
identifier.clone(), identifier.clone(),
namespace.clone(),
if *exclusive { 1 } else { 0 }, if *exclusive { 1 } else { 0 },
match layer { match layer {
Layer::Background => WlrLayer::Background, Layer::Background => WlrLayer::Background,
@ -257,17 +260,19 @@ impl LayerOverlapNotificationDataInternal {
} }
} }
} }
for (layer_surface, (identifier, exclusive, layer, overlap)) in &new_snapshot.layer_overlaps for (layer_surface, (identifier, namespace, exclusive, layer, overlap)) in
&new_snapshot.layer_overlaps
{ {
if !self if !self
.last_snapshot .last_snapshot
.layer_overlaps .layer_overlaps
.get(layer_surface) .get(layer_surface)
.is_some_and(|(_, _, _, old_overlap)| old_overlap == overlap) .is_some_and(|(_, _, _, _, old_overlap)| old_overlap == overlap)
{ {
for notification in &notifications { for notification in &notifications {
notification.layer_enter( notification.layer_enter(
identifier.clone(), identifier.clone(),
namespace.clone(),
if *exclusive { 1 } else { 0 }, if *exclusive { 1 } else { 0 },
match layer { match layer {
Layer::Background => WlrLayer::Background, Layer::Background => WlrLayer::Background,
@ -291,7 +296,7 @@ impl LayerOverlapNotificationDataInternal {
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
struct OverlapSnapshot { struct OverlapSnapshot {
toplevel_overlaps: HashMap<Weak<ExtForeignToplevelHandleV1>, Rectangle<i32, Logical>>, toplevel_overlaps: HashMap<Weak<ExtForeignToplevelHandleV1>, Rectangle<i32, Logical>>,
layer_overlaps: HashMap<ObjectId, (String, bool, Layer, Rectangle<i32, Logical>)>, layer_overlaps: HashMap<ObjectId, (String, String, bool, Layer, Rectangle<i32, Logical>)>,
} }
impl OverlapSnapshot { impl OverlapSnapshot {
@ -322,8 +327,16 @@ impl OverlapSnapshot {
.user_data() .user_data()
.get_or_insert(|| Identifier::from(id.clone())); .get_or_insert(|| Identifier::from(id.clone()));
self.layer_overlaps self.layer_overlaps.insert(
.insert(id, (identifier.0.clone(), exclusive, layer, overlap)); id,
(
identifier.0.clone(),
layer_surface.namespace().to_string(),
exclusive,
layer,
overlap,
),
);
} }
} }