Skip to content

Commit

Permalink
fix: overlap notify positions
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Nov 25, 2024
1 parent eaede14 commit 422d099
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/wayland/protocols/overlap_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ impl OverlapNotifyState {
if inner.has_active_notifications() {
let mut new_snapshot = OverlapSnapshot::default();

let layer_geo = layer_surface.bbox().as_local().to_global(&output);
let layer_geo = map
.layer_geometry(layer_surface)
.unwrap_or_default()
.as_local()
.to_global(&output);

for window in state.toplevel_info_state().registered_toplevels() {
if let Some(window_geo) = window.global_geometry() {
if let Some(intersection) = layer_geo.intersection(window_geo) {
// relative to window location
// relative to layer location
let region = Rectangle::from_loc_and_size(
intersection.loc - window_geo.loc,
intersection.loc - layer_geo.loc,
intersection.size,
)
.as_logical();
Expand All @@ -114,11 +118,15 @@ impl OverlapNotifyState {
if other_surface.wl_surface().id() == layer_surface.wl_surface().id() {
continue;
}
let other_geo = other_surface.bbox().as_local().to_global(&output);
let other_geo = map
.layer_geometry(other_surface)
.unwrap_or_default()
.as_local()
.to_global(&output);
if let Some(intersection) = layer_geo.intersection(other_geo) {
// relative to window location
// relative to layer location
let region = Rectangle::from_loc_and_size(
intersection.loc - other_geo.loc,
intersection.loc - layer_geo.loc,
intersection.size,
)
.as_logical();
Expand Down

0 comments on commit 422d099

Please sign in to comment.