forge
Explore
Log in

Don't you dare go Hollow

layout: Improve view_rect computation for the interactively moved window

Browse files at this commit

dec0e3bf5a2dfa5f844a772d29ff4aa4645796e7Ivan MolodetskikhParent: 6bcaaf9
src/layout/mod.rsmodified+11 -1
@@ -2729,8 +2729,18 @@ impl<W: LayoutElement> Layout<W> {
2729 if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move {2729 if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move {
2730 if output.is_none_or(|output| move_.output == *output) {2730 if output.is_none_or(|output| move_.output == *output) {
2731 let pos_within_output = move_.tile_render_location(zoom);2731 let pos_within_output = move_.tile_render_location(zoom);
2732+
2733+ // We're not on any specific workspace so we can't compute a "workspace view" rect.
2734+ // Let's instead compute a rect relative to the output.
2735+ //
2736+ // FIXME: we could make the colors match up better in the overview by figuring out
2737+ // where a centered workspace would currently be, and computing the view rect
2738+ // against that. Since most of the time the dragged window will be on a centered
2739+ // workspace.
2732 let view_rect =2740 let view_rect =
2733- Rectangle::new(pos_within_output.upscale(-1.), output_size(&move_.output));2741+ Rectangle::new(pos_within_output.upscale(-1.), output_size(&move_.output))
2742+ .downscale(zoom);
2743+
2734 move_.tile.update_render_elements(true, view_rect);2744 move_.tile.update_render_elements(true, view_rect);
2735 }2745 }
2736 }2746 }