From 0aef87b82c64681247baaa769e427e42582c5e49 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 25 Jul 2020 13:42:37 +0200 Subject: [PATCH] WindowServer: Center the window titlebar icons vertically This feels a bit tricksy, but at least makes window icons look much better with the "Basalt" theme. :^) --- Services/WindowServer/WindowFrame.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Services/WindowServer/WindowFrame.cpp b/Services/WindowServer/WindowFrame.cpp index f3b11ff619c..dc5e1da8cad 100644 --- a/Services/WindowServer/WindowFrame.cpp +++ b/Services/WindowServer/WindowFrame.cpp @@ -152,20 +152,25 @@ void WindowFrame::did_set_maximized(Badge, bool maximized) Gfx::IntRect WindowFrame::title_bar_rect() const { auto window_titlebar_height = WindowManager::the().palette().window_title_height(); + int total_vertical_padding = window_titlebar_height - WindowManager::the().window_title_font().glyph_height(); + if (m_window.type() == WindowType::Notification) - return { m_window.width() + 3, 3, window_titlebar_height, m_window.height() }; - return { 4, 4, m_window.width(), window_titlebar_height }; + return { m_window.width() + 3, total_vertical_padding / 2 - 1, window_titlebar_height, m_window.height() }; + return { 4, total_vertical_padding / 2, m_window.width(), window_titlebar_height }; } Gfx::IntRect WindowFrame::title_bar_icon_rect() const { auto titlebar_rect = title_bar_rect(); - return { + Gfx::IntRect icon_rect { titlebar_rect.x() + 2, - titlebar_rect.y() + 2, + titlebar_rect.y(), + 16, 16, - titlebar_rect.height(), }; + icon_rect.center_vertically_within(titlebar_rect); + icon_rect.move_by(0, 1); + return icon_rect; } Gfx::IntRect WindowFrame::title_bar_text_rect() const