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]]
name = "cosmic-protocols"
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 = [
"bitflags 2.6.0",
"wayland-backend",
@ -1064,7 +1064,7 @@ version = "0.19.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109"
dependencies = [
"bitflags 2.6.0",
"libloading 0.7.4",
"libloading 0.8.5",
"winapi",
]
@ -1199,7 +1199,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading 0.7.4",
"libloading 0.8.5",
]
[[package]]
@ -2162,7 +2162,7 @@ dependencies = [
"bitflags 2.6.0",
"com",
"libc",
"libloading 0.7.4",
"libloading 0.8.5",
"thiserror",
"widestring",
"winapi",
@ -2828,7 +2828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets 0.52.6",
"windows-targets 0.48.5",
]
[[package]]
@ -5879,7 +5879,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libc",
"libloading 0.7.4",
"libloading 0.8.5",
"log",
"metal",
"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(
identifier.clone(),
namespace.clone(),
if *exclusive { 1 } else { 0 },
match layer {
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
.last_snapshot
.layer_overlaps
.get(layer_surface)
.is_some_and(|(_, _, _, old_overlap)| old_overlap == overlap)
.is_some_and(|(_, _, _, _, old_overlap)| old_overlap == overlap)
{
for notification in &notifications {
notification.layer_enter(
identifier.clone(),
namespace.clone(),
if *exclusive { 1 } else { 0 },
match layer {
Layer::Background => WlrLayer::Background,
@ -291,7 +296,7 @@ impl LayerOverlapNotificationDataInternal {
#[derive(Debug, Default, Clone)]
struct OverlapSnapshot {
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 {
@ -322,8 +327,16 @@ impl OverlapSnapshot {
.user_data()
.get_or_insert(|| Identifier::from(id.clone()));
self.layer_overlaps
.insert(id, (identifier.0.clone(), exclusive, layer, overlap));
self.layer_overlaps.insert(
id,
(
identifier.0.clone(),
layer_surface.namespace().to_string(),
exclusive,
layer,
overlap,
),
);
}
}