From 0e42f3406573c788bc4ff2abee11dabe1bbff13d Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 22 Apr 2022 09:46:29 +0200 Subject: [PATCH] layer_shell: Fixed multi-monitor pointer input bug --- src/input/mod.rs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/input/mod.rs b/src/input/mod.rs index f0403ee3..c62ecf53 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -5,7 +5,7 @@ use smithay::{ backend::input::{Device, DeviceCapability, InputBackend, InputEvent, KeyState}, desktop::{layer_map_for_output, Kind, Space, WindowSurfaceType}, reexports::wayland_server::{protocol::wl_surface::WlSurface, Display}, - utils::{Logical, Point}, + utils::{Logical, Point, Rectangle}, wayland::{ data_device::set_data_device_focus, output::Output, @@ -368,6 +368,7 @@ impl Common { position, relative_pos, &output, + output_geometry, &workspace.space, ); handle_window_movement( @@ -411,6 +412,7 @@ impl Common { position, relative_pos, &output, + geometry, &workspace.space, ); handle_window_movement( @@ -495,7 +497,8 @@ impl Common { layers.layer_geometry(layer).unwrap().loc; under = layer .surface_under( - pos - output_geo.loc.to_f64() - layer_loc.to_f64(), + pos - output_geo.loc.to_f64() + - layer_loc.to_f64(), WindowSurfaceType::ALL, ) .map(|(s, _)| s); @@ -521,7 +524,8 @@ impl Common { layers.layer_geometry(layer).unwrap().loc; under = layer .surface_under( - pos - output_geo.loc.to_f64() - layer_loc.to_f64(), + pos - output_geo.loc.to_f64() + - layer_loc.to_f64(), WindowSurfaceType::ALL, ) .map(|(s, _)| s); @@ -640,10 +644,10 @@ impl Common { global_pos: Point, relative_pos: Point, output: &Output, + output_geo: Rectangle, space: &Space, ) -> Option<(WlSurface, Point)> { let layers = layer_map_for_output(output); - let output_geo = space.output_geometry(output).unwrap(); if let Some(layer) = layers .layer_under(WlrLayer::Overlay, relative_pos) @@ -655,12 +659,7 @@ impl Common { global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(), WindowSurfaceType::ALL, ) - .map(|(s, loc)| { - ( - s, - loc + layer_loc + output_geo.loc, - ) - }) + .map(|(s, loc)| (s, loc + layer_loc + output_geo.loc)) } else if let Some(window) = space.window_under(relative_pos) { let window_loc = space.window_location(window).unwrap(); window @@ -681,12 +680,7 @@ impl Common { global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(), WindowSurfaceType::ALL, ) - .map(|(s, loc)| { - ( - s, - loc + layer_loc + output_geo.loc, - ) - }) + .map(|(s, loc)| (s, loc + layer_loc + output_geo.loc)) } else { None }