diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-05-11 15:02:18 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-21 22:25:33 +0200 |
commit | 4253594d165b3fddcdc0a901d4cf7e1fef542479 (patch) | |
tree | 2146823a5ccc8eddda3cce5b5e36931021354c32 | |
parent | f617d72bee454e8a50673432ab0dd0cf1fceee7d (diff) | |
download | serenity-4253594d165b3fddcdc0a901d4cf7e1fef542479.zip |
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!
-rw-r--r-- | Userland/Applications/ThemeEditor/PreviewWidget.cpp | 8 |
1 files 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<Gfx::ColorBlindnessFilter> 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); |