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

WindowServer: Ensure windows are wide enough to show title buttons :^)

Previously, windows without a defined minimum size (or one produced from
the minimum sizes of their contents) would be shrunk down to 0 x 0,
which makes the title buttons stick out the side and become impossible
to interact with.

This patch uses the theme metrics to calculate a minimum size that is as
small as possible while still keeping the title buttons and app icon
usable. This is combined with the minimum size requested by the app
itself.

Switching themes automatically updates the calculated minimum sizes for
all existing windows. As noted, if the new theme has narrower title
buttons then the old minimum is kept, but this shouldn't be noticeable
unless you're looking for it.
This commit is contained in:
Sam Atkins 2022-07-26 16:45:07 +01:00 committed by Linus Groh
parent 0fcb6920e3
commit 11cb7c7b28
3 changed files with 64 additions and 3 deletions

View file

@ -2099,7 +2099,7 @@ void WindowManager::invalidate_after_theme_or_font_change()
return IterationDecision::Continue;
});
ConnectionFromClient::for_each_client([&](ConnectionFromClient& client) {
client.async_update_system_theme(Gfx::current_system_theme_buffer());
client.notify_about_theme_change();
});
MenuManager::the().did_change_theme();
AppletManager::the().did_change_theme();