From 4253594d165b3fddcdc0a901d4cf7e1fef542479 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 11 May 2022 15:02:18 +0100 Subject: [PATCH] ThemeEditor: Position preview windows based on the title height This means all three window titles are visible, regardless of what the TitleHeight and BorderThickness values are. :^) The one exception is when TitleHeight is less than the height of the title text. WindowManager ensures that the real title height is at least enough to fit the text, so if the value is set to less than that, the window titles will start to overlap. So, don't set values that are impossibly small! --- Userland/Applications/ThemeEditor/PreviewWidget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp index 4847e8e847..ea9590c035 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp +++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp @@ -70,10 +70,14 @@ void PreviewWidget::set_color_filter(OwnPtr color_fil void PreviewWidget::update_preview_window_locations() { + auto& palette = preview_palette(); + int window_title_height = palette.metric(Gfx::MetricRole::TitleHeight) + + palette.metric(Gfx::MetricRole::BorderThickness); + constexpr int inactive_offset_x = -20; - constexpr int inactive_offset_y = -20; + int inactive_offset_y = -(window_title_height + 4); constexpr int hightlight_offset_x = 140; - constexpr int hightlight_offset_y = 80; + int hightlight_offset_y = window_title_height + 40; m_active_window_rect = Gfx::IntRect(0, 0, 320, 220); m_inactive_window_rect = m_active_window_rect.translated(inactive_offset_x, inactive_offset_y);