From e5ceb24b63c07c11d3b6914f8e88b20158e409f9 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Mon, 4 Mar 2024 13:51:18 +0100 Subject: [PATCH] tiling: Ease minimize animation and use correct alpha for focus indicator --- src/shell/layout/tiling/mod.rs | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 656c3a9b..7ae5119a 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -4707,7 +4707,7 @@ where if let Some(minimize_geo) = minimize_geo { scaled_geo = Some( ease( - Linear, + EaseInOutCubic, EaseRectangle(*original_geo), EaseRectangle(*minimize_geo), percentage, @@ -4784,7 +4784,7 @@ where geo, indicator_thickness, output_scale, - 1.0 - percentage, + alpha, [window_hint.red, window_hint.green, window_hint.blue], ), )); @@ -5021,13 +5021,16 @@ where ) }); - if let Data::Mapped { + let was_minimized = if let Data::Mapped { minimize_rect: Some(minimize_rect), .. } = &data { old_geo = Some((*minimize_rect, (percentage * 2.0).min(1.0))); - } + true + } else { + false + }; let (scale, offset) = scaled_geo .map(|adapted_geo| scale_to_center(original_geo, adapted_geo)) @@ -5051,13 +5054,23 @@ where .unwrap_or(true) }) { ( - ease( - Linear, - EaseRectangle(old_geo), - EaseRectangle(new_geo), - percentage, - ) - .unwrap(), + if was_minimized { + ease( + EaseInOutCubic, + EaseRectangle(old_geo), + EaseRectangle(new_geo), + percentage, + ) + .unwrap() + } else { + ease( + Linear, + EaseRectangle(old_geo), + EaseRectangle(new_geo), + percentage, + ) + .unwrap() + }, alpha, old_geo != new_geo, )