layout/monitor: round workspace render geo to physical pixels
Browse files at this commitfb2f66f36143159c1ba59f3f1c36cac6181b8fa9Parent: e2e15b71 changed file +7 -0
- src/layout/monitor.rs +7 -0
src/layout/monitor.rsmodified+7 -0
| @@ -1490,6 +1490,13 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 1490 | (0..=self.workspaces.len()).map(move |idx| { | 1490 | (0..=self.workspaces.len()).map(move |idx| { |
| 1491 | let y = first_ws_y + idx as f64 * ws_height_with_gap; | 1491 | let y = first_ws_y + idx as f64 * ws_height_with_gap; |
| 1492 | let loc = Point::from((0., y)) + static_offset; | 1492 | let loc = Point::from((0., y)) + static_offset; |
| 1493 | + | ||
| 1494 | + // Even though all components that go into loc are rounded to physical pixels, the | ||
| 1495 | + // floating point addition may lose precision. This can result for example in the | ||
| 1496 | + // current workspace having y = 0.0000000000002 and thus missing pointer hits at the | ||
| 1497 | + // monitor edge with y = 0. So, post-round the location too. | ||
| 1498 | + let loc = loc.to_physical_precise_round(scale).to_logical(scale); | ||
| 1499 | + | ||
| 1493 | Rectangle::new(loc, ws_size) | 1500 | Rectangle::new(loc, ws_size) |
| 1494 | }) | 1501 | }) |
| 1495 | } | 1502 | } |