Skip to content

Commit

Permalink
refactor: add namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and Drakulix committed Nov 27, 2024
1 parent 60558e1 commit a14d075
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions src/wayland/protocols/overlap_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
),
);
}
}

Expand Down

0 comments on commit a14d075

Please sign in to comment.