1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

WindowServer: Show complete title when Window is not resizable

Saves Dialogs the trouble of accounting for variable width titles and
makes all unresizable windows more responsive to font changes.
This commit is contained in:
thankyouverycool 2023-04-16 16:00:34 -04:00 committed by Andreas Kling
parent eef07d2f57
commit b7cac829ae

View file

@ -521,6 +521,7 @@ static Gfx::IntSize calculate_minimum_size_for_window(Window const& window)
// because we want to always keep their title buttons accessible.
if (window.type() == WindowType::Normal) {
auto palette = WindowManager::the().palette();
auto& title_font = Gfx::FontDatabase::the().window_title_font();
int required_width = 0;
// Padding on left and right of window title content.
@ -535,8 +536,11 @@ static Gfx::IntSize calculate_minimum_size_for_window(Window const& window)
// Maximize button
if (window.is_resizable())
required_width += palette.window_title_button_width();
// Title text and drop shadow
else
required_width += title_font.width_rounded_up(window.title()) + 4;
// Minimize button
if (window.is_minimizable())
if (window.is_minimizable() && !window.is_modal())
required_width += palette.window_title_button_width();
return { required_width, 0 };