From cbd7f3bb2ba1ad5a5c7992eb0f047d736984e23d Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 27 Nov 2024 10:59:41 -0500 Subject: [PATCH] refactor: add namespace --- Cargo.lock | 2 +- Cargo.toml | 58 ++++++++++++++++--------- src/wayland/protocols/overlap_notify.rs | 25 ++++++++--- 3 files changed, 57 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a38c8aa..bd07f751 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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=overlap-namespace#d8f7dab6cc07f46ea7eb9eaa0cf8f87ed00da17e" dependencies = [ "bitflags 2.6.0", "wayland-backend", diff --git a/Cargo.toml b/Cargo.toml index 6b8e669d..0d26ba1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,49 +6,65 @@ name = "cosmic-comp" version = "0.1.0" [workspace] -members = [ - "cosmic-comp-config", -] +members = ["cosmic-comp-config"] [dependencies] -anyhow = {version = "1.0.51", features = ["backtrace"]} +anyhow = { version = "1.0.51", features = ["backtrace"] } bitflags = "2.4" bytemuck = "1.12" -calloop = {version = "0.14.1", features = ["executor"]} -cosmic-comp-config = {path = "cosmic-comp-config"} -cosmic-config = {git = "https://github.com/pop-os/libcosmic/", features = ["calloop", "macro"]} -cosmic-protocols = {git = "https://github.com/pop-os/cosmic-protocols", branch = "main", default-features = false, features = ["server"]} +calloop = { version = "0.14.1", features = ["executor"] } +cosmic-comp-config = { path = "cosmic-comp-config" } +cosmic-config = { git = "https://github.com/pop-os/libcosmic/", features = [ + "calloop", + "macro", +] } +cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "overlap-namespace", default-features = false, features = [ + "server", +] } cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" } -edid-rs = {version = "0.1"} -egui = {version = "0.29.0", optional = true} -egui_plot = {version = "0.29.0", optional = true} +edid-rs = { version = "0.1" } +egui = { version = "0.29.0", optional = true } +egui_plot = { version = "0.29.0", optional = true } glow = "0.12.0" -i18n-embed = {version = "0.14", features = ["fluent-system", "desktop-requester"]} +i18n-embed = { version = "0.14", features = [ + "fluent-system", + "desktop-requester", +] } i18n-embed-fl = "0.8" -iced_tiny_skia = {git = "https://github.com/pop-os/libcosmic/"} +iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/" } indexmap = "2.0" keyframe = "1.1.1" lazy_static = "1.4.0" libc = "0.2.149" -libcosmic = {git = "https://github.com/pop-os/libcosmic/", default-features = false} -libsystemd = {version = "0.7", optional = true} -log-panics = {version = "2", features = ["with-backtrace"]} +libcosmic = { git = "https://github.com/pop-os/libcosmic/", default-features = false } +libsystemd = { version = "0.7", optional = true } +log-panics = { version = "2", features = ["with-backtrace"] } once_cell = "1.18.0" ordered-float = "4.0" png = "0.17.5" regex = "1" ron = "0.8" -rust-embed = {version = "8.0", features = ["debug-embed"]} +rust-embed = { version = "8.0", features = ["debug-embed"] } sanitize-filename = "0.5.0" sendfd = "0.4.1" -serde = {version = "1", features = ["derive"]} +serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "1.0.26" -time = {version = "0.3.30", features = ["macros", "formatting", "local-offset"]} +time = { version = "0.3.30", features = [ + "macros", + "formatting", + "local-offset", +] } tiny-skia = "0.11" -tracing = { version = "0.1.37", features = ["max_level_debug", "release_max_level_info"] } +tracing = { version = "0.1.37", features = [ + "max_level_debug", + "release_max_level_info", +] } tracing-journald = "0.3.0" -tracing-subscriber = {version = "0.3.16", features = ["env-filter", "tracing-log"]} +tracing-subscriber = { version = "0.3.16", features = [ + "env-filter", + "tracing-log", +] } wayland-backend = "0.3.3" wayland-scanner = "0.31.1" xcursor = "0.3.3" diff --git a/src/wayland/protocols/overlap_notify.rs b/src/wayland/protocols/overlap_notify.rs index 4298b6ef..d29102f3 100644 --- a/src/wayland/protocols/overlap_notify.rs +++ b/src/wayland/protocols/overlap_notify.rs @@ -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 ¬ifications { 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, Rectangle>, - layer_overlaps: HashMap)>, + layer_overlaps: HashMap)>, } 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, + ), + ); } }