layer_shell: Fixed multi-monitor pointer input bug

This commit is contained in:
Victoria Brekenfeld 2022-04-22 09:46:29 +02:00
parent ff844631ea
commit 0e42f34065

View file

@ -5,7 +5,7 @@ use smithay::{
backend::input::{Device, DeviceCapability, InputBackend, InputEvent, KeyState}, backend::input::{Device, DeviceCapability, InputBackend, InputEvent, KeyState},
desktop::{layer_map_for_output, Kind, Space, WindowSurfaceType}, desktop::{layer_map_for_output, Kind, Space, WindowSurfaceType},
reexports::wayland_server::{protocol::wl_surface::WlSurface, Display}, reexports::wayland_server::{protocol::wl_surface::WlSurface, Display},
utils::{Logical, Point}, utils::{Logical, Point, Rectangle},
wayland::{ wayland::{
data_device::set_data_device_focus, data_device::set_data_device_focus,
output::Output, output::Output,
@ -368,6 +368,7 @@ impl Common {
position, position,
relative_pos, relative_pos,
&output, &output,
output_geometry,
&workspace.space, &workspace.space,
); );
handle_window_movement( handle_window_movement(
@ -411,6 +412,7 @@ impl Common {
position, position,
relative_pos, relative_pos,
&output, &output,
geometry,
&workspace.space, &workspace.space,
); );
handle_window_movement( handle_window_movement(
@ -495,7 +497,8 @@ impl Common {
layers.layer_geometry(layer).unwrap().loc; layers.layer_geometry(layer).unwrap().loc;
under = layer under = layer
.surface_under( .surface_under(
pos - output_geo.loc.to_f64() - layer_loc.to_f64(), pos - output_geo.loc.to_f64()
- layer_loc.to_f64(),
WindowSurfaceType::ALL, WindowSurfaceType::ALL,
) )
.map(|(s, _)| s); .map(|(s, _)| s);
@ -521,7 +524,8 @@ impl Common {
layers.layer_geometry(layer).unwrap().loc; layers.layer_geometry(layer).unwrap().loc;
under = layer under = layer
.surface_under( .surface_under(
pos - output_geo.loc.to_f64() - layer_loc.to_f64(), pos - output_geo.loc.to_f64()
- layer_loc.to_f64(),
WindowSurfaceType::ALL, WindowSurfaceType::ALL,
) )
.map(|(s, _)| s); .map(|(s, _)| s);
@ -640,10 +644,10 @@ impl Common {
global_pos: Point<f64, Logical>, global_pos: Point<f64, Logical>,
relative_pos: Point<f64, Logical>, relative_pos: Point<f64, Logical>,
output: &Output, output: &Output,
output_geo: Rectangle<i32, Logical>,
space: &Space, space: &Space,
) -> Option<(WlSurface, Point<i32, Logical>)> { ) -> Option<(WlSurface, Point<i32, Logical>)> {
let layers = layer_map_for_output(output); let layers = layer_map_for_output(output);
let output_geo = space.output_geometry(output).unwrap();
if let Some(layer) = layers if let Some(layer) = layers
.layer_under(WlrLayer::Overlay, relative_pos) .layer_under(WlrLayer::Overlay, relative_pos)
@ -655,12 +659,7 @@ impl Common {
global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(), global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(),
WindowSurfaceType::ALL, WindowSurfaceType::ALL,
) )
.map(|(s, loc)| { .map(|(s, loc)| (s, loc + layer_loc + output_geo.loc))
(
s,
loc + layer_loc + output_geo.loc,
)
})
} else if let Some(window) = space.window_under(relative_pos) { } else if let Some(window) = space.window_under(relative_pos) {
let window_loc = space.window_location(window).unwrap(); let window_loc = space.window_location(window).unwrap();
window window
@ -681,12 +680,7 @@ impl Common {
global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(), global_pos - output_geo.loc.to_f64() - layer_loc.to_f64(),
WindowSurfaceType::ALL, WindowSurfaceType::ALL,
) )
.map(|(s, loc)| { .map(|(s, loc)| (s, loc + layer_loc + output_geo.loc))
(
s,
loc + layer_loc + output_geo.loc,
)
})
} else { } else {
None None
} }