Skip to content

Commit

Permalink
fix: check for layer surface under cursor when clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
calops committed Dec 21, 2024
1 parent d35ad73 commit d62944c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/niri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,18 @@ impl Niri {

// Check if some layer-shell surface is on top.
let layers = layer_map_for_output(output);
let layer_under = |layer| layers.layer_under(layer, pos_within_output).is_some();
let layer_under = |layer| {
layers
.layer_under(layer, pos_within_output)
.and_then(|layer| {
let layer_pos_within_output = layers.layer_geometry(layer)?.loc.to_f64();
layer.surface_under(
pos_within_output - layer_pos_within_output,
WindowSurfaceType::ALL,
)
})
.is_some()
};
if layer_under(Layer::Overlay) {
return None;
}
Expand Down Expand Up @@ -2480,8 +2491,7 @@ impl Niri {
layers
.layer_under(layer, pos_within_output)
.and_then(|layer| {
let layer_pos_within_output =
layers.layer_geometry(layer).unwrap().loc.to_f64();
let layer_pos_within_output = layers.layer_geometry(layer)?.loc.to_f64();
layer
.surface_under(
pos_within_output - layer_pos_within_output,
Expand Down

0 comments on commit d62944c

Please sign in to comment.