mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
layout/monitor: round workspace render geo to physical pixels
This commit is contained in:
committed by
Ivan Molodetskikh
parent
e2e15b7a18
commit
fb2f66f361
@@ -1490,6 +1490,13 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
(0..=self.workspaces.len()).map(move |idx| {
|
||||
let y = first_ws_y + idx as f64 * ws_height_with_gap;
|
||||
let loc = Point::from((0., y)) + static_offset;
|
||||
|
||||
// Even though all components that go into loc are rounded to physical pixels, the
|
||||
// floating point addition may lose precision. This can result for example in the
|
||||
// current workspace having y = 0.0000000000002 and thus missing pointer hits at the
|
||||
// monitor edge with y = 0. So, post-round the location too.
|
||||
let loc = loc.to_physical_precise_round(scale).to_logical(scale);
|
||||
|
||||
Rectangle::new(loc, ws_size)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user