diff --git a/Libraries/LibGfx/ClassicWindowTheme.cpp b/Libraries/LibGfx/ClassicWindowTheme.cpp index bc16191067..da75e1efdc 100644 --- a/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -110,13 +110,13 @@ void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window IntRect ClassicWindowTheme::title_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const { auto& title_font = Font::default_bold_font(); - auto window_titlebar_height = palette.window_title_height(); + auto window_titlebar_height = title_bar_height(palette); // FIXME: The top of the titlebar doesn't get redrawn properly if this padding is different int total_vertical_padding = title_font.glyph_height() - 1; if (window_type == WindowType::Notification) return { window_rect.width() + 3, total_vertical_padding / 2 - 1, window_titlebar_height, window_rect.height() }; - return { 4, total_vertical_padding / 2, window_rect.width(), window_titlebar_height }; + return { 4, 4, window_rect.width(), window_titlebar_height }; } ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowState state, const Palette& palette) const @@ -155,7 +155,7 @@ void ClassicWindowTheme::paint_notification_frame(Painter& painter, const IntRec IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const IntRect& window_rect, const Gfx::Palette& palette) const { - auto window_titlebar_height = palette.window_title_height(); + auto window_titlebar_height = title_bar_height(palette); switch (window_type) { case WindowType::Normal: @@ -205,4 +205,10 @@ Vector ClassicWindowTheme::layout_buttons(WindowType window_type, const return button_rects; } +int ClassicWindowTheme::title_bar_height(const Palette& palette) const +{ + auto& title_font = Font::default_bold_font(); + return max(palette.window_title_height(), title_font.glyph_height() + 8); +} + } diff --git a/Libraries/LibGfx/ClassicWindowTheme.h b/Libraries/LibGfx/ClassicWindowTheme.h index 1a842ab15e..b6ae32e891 100644 --- a/Libraries/LibGfx/ClassicWindowTheme.h +++ b/Libraries/LibGfx/ClassicWindowTheme.h @@ -39,6 +39,7 @@ public: virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const override; virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const override; + virtual int title_bar_height(const Palette&) const override; virtual IntRect title_bar_rect(WindowType, const IntRect& window_rect, const Palette&) const override; virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const override; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const override; diff --git a/Libraries/LibGfx/WindowTheme.h b/Libraries/LibGfx/WindowTheme.h index b6d137af71..8ae0174723 100644 --- a/Libraries/LibGfx/WindowTheme.h +++ b/Libraries/LibGfx/WindowTheme.h @@ -53,6 +53,7 @@ public: virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect) const = 0; virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const = 0; + virtual int title_bar_height(const Palette&) const = 0; virtual IntRect title_bar_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index b8ff257bc9..6164329406 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -1444,7 +1444,7 @@ void WindowManager::maximize_windows(Window& window, bool maximized) Gfx::IntPoint WindowManager::get_recommended_window_position(const Gfx::IntPoint& desired) { // FIXME: Find a better source for the width and height to shift by. - Gfx::IntPoint shift(8, palette().window_title_height() + 10); + Gfx::IntPoint shift(8, Gfx::WindowTheme::current().title_bar_height(palette()) + 10); // FIXME: Find a better source for this. int taskbar_height = 28; @@ -1463,7 +1463,7 @@ Gfx::IntPoint WindowManager::get_recommended_window_position(const Gfx::IntPoint point = overlap_window->position() + shift; point = { point.x() % Screen::the().width(), (point.y() >= (Screen::the().height() - taskbar_height)) - ? menubar_height + palette().window_title_height() + ? menubar_height + Gfx::WindowTheme::current().title_bar_height(palette()) : point.y() }; } else { point = desired;