From ec256e058d5e16098444784367dcab7e84f18496 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 6 Aug 2023 12:44:56 +0200 Subject: [PATCH] wind: Make sure windows have a minimum size to fit the titlebar --- wind/Window.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wind/Window.cpp b/wind/Window.cpp index 09306bef..45110ccf 100644 --- a/wind/Window.cpp +++ b/wind/Window.cpp @@ -42,6 +42,8 @@ void Window::focus() Window::Window(ui::Rect r, ui::Color c, StringView n) : surface(r), color(c), name(n) { auto font = ui::Font::default_font(); + if (surface.width < 36) surface.width = 36; + if (surface.height < (font->height() + 20)) surface.height = font->height() + 20; titlebar = ui::Rect { 0, 0, surface.width, font->height() + 20 }; close_button = ui::Rect { surface.width - 26, 10, 16, 16 }; contents = ui::Rect { 0, font->height() + 20, surface.width, surface.height - (font->height() + 20) };