From b7cac829ae7b5af9ae34d21530c132569a0876ae Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Sun, 16 Apr 2023 16:00:34 -0400 Subject: [PATCH] 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. --- Userland/Services/WindowServer/ConnectionFromClient.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index 4ec9073a50..c953622ab5 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -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 };