Skip to content

Commit

Permalink
fix: overlap notify filter handles by client
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Nov 26, 2024
1 parent 422d099 commit 6f2f5a3
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions src/wayland/protocols/overlap_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,21 @@ impl LayerOverlapNotificationDataInternal {
}

pub fn add_notification(&mut self, new_notification: ZcosmicOverlapNotificationV1) {
for (toplevel, overlap) in &self.last_snapshot.toplevel_overlaps {
if let Ok(toplevel) = toplevel.upgrade() {
new_notification.toplevel_enter(
&toplevel,
overlap.loc.x,
overlap.loc.y,
overlap.size.w,
overlap.size.h,
);
if let Some(client) = new_notification.client() {
for (toplevel, overlap) in &self.last_snapshot.toplevel_overlaps {
if let Some(toplevel) = toplevel
.upgrade()
.ok()
.filter(|handle| handle.client().is_some_and(|c| c == client))
{
new_notification.toplevel_enter(
&toplevel,
overlap.loc.x,
overlap.loc.y,
overlap.size.w,
overlap.size.h,
);
}
}
}
for (_, (identifier, exclusive, layer, overlap)) in &self.last_snapshot.layer_overlaps {
Expand Down Expand Up @@ -207,8 +213,13 @@ impl LayerOverlapNotificationDataInternal {
for toplevel in self.last_snapshot.toplevel_overlaps.keys() {
if !new_snapshot.toplevel_overlaps.contains_key(toplevel) {
if let Ok(toplevel) = toplevel.upgrade() {
for notification in &notifications {
notification.toplevel_leave(&toplevel);
if let Some(client) = toplevel.client() {
for notification in notifications
.iter()
.filter(|n| n.client().is_some_and(|c| c == client))
{
notification.toplevel_leave(&toplevel);
}
}
}
}
Expand All @@ -221,14 +232,19 @@ impl LayerOverlapNotificationDataInternal {
.is_some_and(|old_overlap| old_overlap == overlap)
{
if let Ok(toplevel) = toplevel.upgrade() {
for notification in &notifications {
notification.toplevel_enter(
&toplevel,
overlap.loc.x,
overlap.loc.y,
overlap.size.w,
overlap.size.h,
);
if let Some(client) = toplevel.client() {
for notification in notifications
.iter()
.filter(|n| n.client().is_some_and(|c| c == client))
{
notification.toplevel_enter(
&toplevel,
overlap.loc.x,
overlap.loc.y,
overlap.size.w,
overlap.size.h,
);
}
}
}
}
Expand Down

0 comments on commit 6f2f5a3

Please sign in to comment.