1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

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!
This commit is contained in:
Sam Atkins 2022-05-11 15:02:18 +01:00 committed by Andreas Kling
parent f617d72bee
commit 4253594d16

View file

@ -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);