mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
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. :^)
This commit is contained in:
parent
e2f45a4b0e
commit
0aef87b82c
1 changed files with 10 additions and 5 deletions
|
@ -152,20 +152,25 @@ void WindowFrame::did_set_maximized(Badge<Window>, bool maximized)
|
||||||
Gfx::IntRect WindowFrame::title_bar_rect() const
|
Gfx::IntRect WindowFrame::title_bar_rect() const
|
||||||
{
|
{
|
||||||
auto window_titlebar_height = WindowManager::the().palette().window_title_height();
|
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)
|
if (m_window.type() == WindowType::Notification)
|
||||||
return { m_window.width() + 3, 3, window_titlebar_height, m_window.height() };
|
return { m_window.width() + 3, total_vertical_padding / 2 - 1, window_titlebar_height, m_window.height() };
|
||||||
return { 4, 4, m_window.width(), window_titlebar_height };
|
return { 4, total_vertical_padding / 2, m_window.width(), window_titlebar_height };
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntRect WindowFrame::title_bar_icon_rect() const
|
Gfx::IntRect WindowFrame::title_bar_icon_rect() const
|
||||||
{
|
{
|
||||||
auto titlebar_rect = title_bar_rect();
|
auto titlebar_rect = title_bar_rect();
|
||||||
return {
|
Gfx::IntRect icon_rect {
|
||||||
titlebar_rect.x() + 2,
|
titlebar_rect.x() + 2,
|
||||||
titlebar_rect.y() + 2,
|
titlebar_rect.y(),
|
||||||
|
16,
|
||||||
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
|
Gfx::IntRect WindowFrame::title_bar_text_rect() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue