From 16d6871422c09bd674f9ab105e3a964d07ab1e2e Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Wed, 2 Feb 2022 17:39:43 +0000 Subject: [PATCH] panel: Apply a hard limit of 1/2 height --- src/state.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/state.rs b/src/state.rs index b4927bca..c65033df 100644 --- a/src/state.rs +++ b/src/state.rs @@ -241,16 +241,19 @@ impl Application { fn get_preferred_height(output: &OutputState) -> Option { output.get_pixel_size() .map(|px_size| { - if px_size.width > px_size.height { - px_size.width / 5 - } else { - if (px_size.width < 540) & (px_size.width > 0) { - px_size.width * 7 / 12 // to match 360×210 + let height = { + if px_size.width > px_size.height { + px_size.width / 5 } else { - // Here we switch to wide layout, less height needed - px_size.width * 7 / 22 + if (px_size.width < 540) & (px_size.width > 0) { + px_size.width * 7 / 12 // to match 360×210 + } else { + // Here we switch to wide layout, less height needed + px_size.width * 7 / 22 + } } - } + }; + cmp::min(height, px_size.height / 2) }) }