From 88b74f4a3a084a448a1e9e3160f1d63f65b2f5ca Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 13 Feb 2024 09:15:13 +0400 Subject: [PATCH] Remove unnecessary crop bounds during workspace switch --- src/layout/monitor.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index cb99279a..edd601e5 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -629,12 +629,18 @@ impl Monitor { let before = self.workspaces[before_idx].render_elements(renderer); let after = self.workspaces[after_idx].render_elements(renderer); + // HACK: crop to infinite bounds for all sides except the side where the workspaces + // join, to decrease the chance of cutting a lower-scale surface in the middle of a + // pixel, thereby disabling its nearest-neighbor upscaling. let before = before.into_iter().filter_map(|elem| { Some(RelocateRenderElement::from_element( CropRenderElement::from_element( elem, output_scale, - Rectangle::from_extemities((0, offset), (size.w, size.h)), + Rectangle::from_extemities( + (-i32::MAX / 2, -i32::MAX / 2), + (i32::MAX / 2, size.h), + ), )?, (0, -offset), Relocate::Relative, @@ -645,7 +651,10 @@ impl Monitor { CropRenderElement::from_element( elem, output_scale, - Rectangle::from_extemities((0, 0), (size.w, offset)), + Rectangle::from_extemities( + (-i32::MAX / 2, 0), + (i32::MAX / 2, i32::MAX / 2), + ), )?, (0, -offset + size.h), Relocate::Relative,