mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
WindowServer: Support displaying window titles when there are no buttons
Currently, if there are not titlebar buttons, we fail to paint the title because we treat the leftmost titlebar button as the empty rect. We will now use the rightmost edge of the titlebar when there are no buttons.
This commit is contained in:
parent
db5df26841
commit
857cac6d1d
2 changed files with 13 additions and 4 deletions
|
@ -245,8 +245,7 @@ void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
|
|||
void WindowFrame::paint_tool_window_frame(Gfx::Painter& painter)
|
||||
{
|
||||
auto palette = WindowManager::the().palette();
|
||||
auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::IntRect() : m_buttons.last().relative_rect();
|
||||
Gfx::WindowTheme::current().paint_tool_window_frame(painter, window_state_for_theme(), m_window.rect(), m_window.computed_title(), palette, leftmost_button_rect);
|
||||
Gfx::WindowTheme::current().paint_tool_window_frame(painter, window_state_for_theme(), m_window.rect(), m_window.computed_title(), palette, leftmost_titlebar_button_rect());
|
||||
}
|
||||
|
||||
void WindowFrame::paint_menubar(Gfx::Painter& painter)
|
||||
|
@ -281,8 +280,7 @@ void WindowFrame::paint_menubar(Gfx::Painter& painter)
|
|||
void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
||||
{
|
||||
auto palette = WindowManager::the().palette();
|
||||
auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::IntRect() : m_buttons.last().relative_rect();
|
||||
Gfx::WindowTheme::current().paint_normal_frame(painter, window_state_for_theme(), m_window.rect(), m_window.computed_title(), m_window.icon(), palette, leftmost_button_rect, menu_row_count(), m_window.is_modified());
|
||||
Gfx::WindowTheme::current().paint_normal_frame(painter, window_state_for_theme(), m_window.rect(), m_window.computed_title(), m_window.icon(), palette, leftmost_titlebar_button_rect(), menu_row_count(), m_window.is_modified());
|
||||
|
||||
if (m_window.menubar().has_menus() && m_window.should_show_menubar())
|
||||
paint_menubar(painter);
|
||||
|
@ -529,6 +527,16 @@ Gfx::IntRect WindowFrame::constrained_render_rect_to_screen(const Gfx::IntRect&
|
|||
return render_rect;
|
||||
}
|
||||
|
||||
Gfx::IntRect WindowFrame::leftmost_titlebar_button_rect() const
|
||||
{
|
||||
if (!m_buttons.is_empty())
|
||||
return m_buttons.last().relative_rect();
|
||||
|
||||
auto rect = titlebar_rect();
|
||||
rect.translate_by(rect.width(), 0);
|
||||
return rect;
|
||||
}
|
||||
|
||||
Gfx::IntRect WindowFrame::render_rect() const
|
||||
{
|
||||
return constrained_render_rect_to_screen(inflated_for_shadow(rect()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue