aboutsummaryrefslogtreecommitdiff
path: root/src/input/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-06-17 09:16:28 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-06-18 14:01:28 +0300
commit1dae45c58d7eabeda21ef490d712915890bf6cff (patch)
tree62c473ab1662a1161ed522517ea57b7bd8db340c /src/input/mod.rs
parent997119c44338ad96a40b4a1d6e958f77062a37ef (diff)
downloadniri-1dae45c58d7eabeda21ef490d712915890bf6cff.tar.gz
niri-1dae45c58d7eabeda21ef490d712915890bf6cff.tar.bz2
niri-1dae45c58d7eabeda21ef490d712915890bf6cff.zip
Refactor layout to fractional-logical
Lets borders, gaps, and everything else stay pixel-perfect even with fractional scale. Allows setting fractional border widths, gaps, struts. See the new wiki .md for more details.
Diffstat (limited to 'src/input/mod.rs')
-rw-r--r--src/input/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index acb08e1c..d0e1c55b 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -935,7 +935,7 @@ impl State {
// Check if we have an active pointer constraint.
let mut pointer_confined = None;
if let Some(focus) = &self.niri.pointer_focus.surface {
- let pos_within_surface = pos.to_i32_round() - focus.1;
+ let pos_within_surface = pos - focus.1;
let mut pointer_locked = false;
with_pointer_constraint(&focus.0, &pointer, |constraint| {
@@ -946,7 +946,7 @@ impl State {
// Constraint does not apply if not within region.
if let Some(region) = constraint.region() {
- if !region.contains(pos_within_surface) {
+ if !region.contains(pos_within_surface.to_i32_round()) {
return;
}
}
@@ -1036,8 +1036,8 @@ impl State {
// Prevent the pointer from leaving the confine region, if any.
if let Some(region) = region {
- let new_pos_within_surface = new_pos.to_i32_round() - focus_surface.1;
- if !region.contains(new_pos_within_surface) {
+ let new_pos_within_surface = new_pos - focus_surface.1;
+ if !region.contains(new_pos_within_surface.to_i32_round()) {
prevent = true;
}
}