Skip to content

Commit

Permalink
anvil: Subtract output.geo.loc in calls to layer_under
Browse files Browse the repository at this point in the history
Fixes input to layer-shell surfaces that are not on the first output.
  • Loading branch information
ids1024 authored and Drakulix committed Dec 27, 2024
1 parent 2eddf12 commit 5186cf7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions anvil/src/input_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {

let layers = layer_map_for_output(output);
if let Some(layer) = layers
.layer_under(WlrLayer::Overlay, location)
.or_else(|| layers.layer_under(WlrLayer::Top, location))
.layer_under(WlrLayer::Overlay, location - output_geo.loc.to_f64())
.or_else(|| layers.layer_under(WlrLayer::Top, location - output_geo.loc.to_f64()))
{
if layer.can_receive_keyboard_focus() {
if let Some((_, _)) = layer.surface_under(
Expand Down Expand Up @@ -313,8 +313,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {
let output_geo = self.space.output_geometry(output).unwrap();
let layers = layer_map_for_output(output);
if let Some(layer) = layers
.layer_under(WlrLayer::Bottom, location)
.or_else(|| layers.layer_under(WlrLayer::Background, location))
.layer_under(WlrLayer::Bottom, location - output_geo.loc.to_f64())
.or_else(|| layers.layer_under(WlrLayer::Background, location - output_geo.loc.to_f64()))
{
if layer.can_receive_keyboard_focus() {
if let Some((_, _)) = layer.surface_under(
Expand Down Expand Up @@ -351,8 +351,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {
{
under = Some((surface, loc + output_geo.loc));
} else if let Some(focus) = layers
.layer_under(WlrLayer::Overlay, pos)
.or_else(|| layers.layer_under(WlrLayer::Top, pos))
.layer_under(WlrLayer::Overlay, pos - output_geo.loc.to_f64())
.or_else(|| layers.layer_under(WlrLayer::Top, pos - output_geo.loc.to_f64()))
.and_then(|layer| {
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
layer
Expand All @@ -376,8 +376,8 @@ impl<BackendData: Backend> AnvilState<BackendData> {
}) {
under = Some(focus);
} else if let Some(focus) = layers
.layer_under(WlrLayer::Bottom, pos)
.or_else(|| layers.layer_under(WlrLayer::Background, pos))
.layer_under(WlrLayer::Bottom, pos - output_geo.loc.to_f64())
.or_else(|| layers.layer_under(WlrLayer::Background, pos - output_geo.loc.to_f64()))
.and_then(|layer| {
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
layer
Expand Down

0 comments on commit 5186cf7

Please sign in to comment.