fix(input): pointer clamping
- Reduces the max clamp value by 1, since it previously ended up 1 pixel off screen. Fixes #981. - Moves clamping to before `new_under`, since it previously ignored any motion that goes off screen, causing issues in some fullscreen clients. Fixes #1286.
This commit is contained in:
parent
bb05037db2
commit
9e143da814
1 changed files with 11 additions and 12 deletions
|
|
@ -23,7 +23,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
zoom::ZoomState,
|
zoom::ZoomState,
|
||||||
},
|
},
|
||||||
utils::{float::NextDown, prelude::*, quirks::workspace_overview_is_open},
|
utils::{prelude::*, quirks::workspace_overview_is_open},
|
||||||
wayland::{
|
wayland::{
|
||||||
handlers::{screencopy::SessionHolder, xwayland_keyboard_grab::XWaylandGrabSeat},
|
handlers::{screencopy::SessionHolder, xwayland_keyboard_grab::XWaylandGrabSeat},
|
||||||
protocols::screencopy::{BufferConstraints, CursorSessionRef},
|
protocols::screencopy::{BufferConstraints, CursorSessionRef},
|
||||||
|
|
@ -356,6 +356,16 @@ impl State {
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or(current_output.clone());
|
.unwrap_or(current_output.clone());
|
||||||
|
|
||||||
|
let output_geometry = output.geometry();
|
||||||
|
position.x = position.x.clamp(
|
||||||
|
output_geometry.loc.x as f64,
|
||||||
|
(output_geometry.loc.x + output_geometry.size.w - 1) as f64,
|
||||||
|
);
|
||||||
|
position.y = position.y.clamp(
|
||||||
|
output_geometry.loc.y as f64,
|
||||||
|
(output_geometry.loc.y + output_geometry.size.h - 1) as f64,
|
||||||
|
);
|
||||||
|
|
||||||
let new_under = State::surface_under(position, &output, &shell)
|
let new_under = State::surface_under(position, &output, &shell)
|
||||||
.map(|(target, pos)| (target, pos.as_logical()));
|
.map(|(target, pos)| (target, pos.as_logical()));
|
||||||
|
|
||||||
|
|
@ -482,17 +492,6 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let output_geometry = output.geometry();
|
|
||||||
|
|
||||||
position.x = position.x.clamp(
|
|
||||||
output_geometry.loc.x as f64,
|
|
||||||
((output_geometry.loc.x + output_geometry.size.w) as f64).next_lower(), // FIXME: Replace with f64::next_down when stable
|
|
||||||
);
|
|
||||||
position.y = position.y.clamp(
|
|
||||||
output_geometry.loc.y as f64,
|
|
||||||
((output_geometry.loc.y + output_geometry.size.h) as f64).next_lower(), // FIXME: Replace with f64::next_down when stable
|
|
||||||
);
|
|
||||||
|
|
||||||
// If confined, don't move pointer if it would go outside surface or region
|
// If confined, don't move pointer if it would go outside surface or region
|
||||||
if pointer_confined {
|
if pointer_confined {
|
||||||
if let Some((surface, surface_loc)) = &under {
|
if let Some((surface, surface_loc)) = &under {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue