mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 15:02:56 +00:00
WindowServer: Decide on a window title before measuring its width
If we add "(Not responding)" to the title of an unresponsive window, the title rect needs to be wider or we'll have text-on-stripes. Thanks to @SharpOB for reporting this bug!
This commit is contained in:
parent
becbf36711
commit
82c38f6fdf
Notes:
sideshowbarker
2024-07-19 04:43:51 +09:00
Author: https://github.com/awesomekling
Commit: 82c38f6fdf
1 changed files with 10 additions and 12 deletions
|
@ -217,6 +217,15 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
||||||
auto palette = WindowManager::the().palette();
|
auto palette = WindowManager::the().palette();
|
||||||
auto& window = m_window;
|
auto& window = m_window;
|
||||||
Gfx::IntRect outer_rect = { {}, rect().size() };
|
Gfx::IntRect outer_rect = { {}, rect().size() };
|
||||||
|
String title_text;
|
||||||
|
if (window.client() && window.client()->is_unresponsive()) {
|
||||||
|
StringBuilder builder;
|
||||||
|
builder.append(window.title());
|
||||||
|
builder.append(" (Not responding)");
|
||||||
|
title_text = builder.to_string();
|
||||||
|
} else {
|
||||||
|
title_text = window.title();
|
||||||
|
}
|
||||||
|
|
||||||
Gfx::StylePainter::paint_window_frame(painter, outer_rect, palette);
|
Gfx::StylePainter::paint_window_frame(painter, outer_rect, palette);
|
||||||
|
|
||||||
|
@ -224,7 +233,7 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
||||||
auto titlebar_icon_rect = title_bar_icon_rect();
|
auto titlebar_icon_rect = title_bar_icon_rect();
|
||||||
auto titlebar_inner_rect = title_bar_text_rect();
|
auto titlebar_inner_rect = title_bar_text_rect();
|
||||||
auto titlebar_title_rect = titlebar_inner_rect;
|
auto titlebar_title_rect = titlebar_inner_rect;
|
||||||
titlebar_title_rect.set_width(Gfx::Font::default_bold_font().width(window.title()));
|
titlebar_title_rect.set_width(Gfx::Font::default_bold_font().width(title_text));
|
||||||
|
|
||||||
auto [title_color, border_color, border_color2] = compute_frame_colors();
|
auto [title_color, border_color, border_color2] = compute_frame_colors();
|
||||||
|
|
||||||
|
@ -244,17 +253,6 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String title_text;
|
|
||||||
|
|
||||||
if (window.client() && window.client()->is_unresponsive()) {
|
|
||||||
StringBuilder builder;
|
|
||||||
builder.append(window.title());
|
|
||||||
builder.append(" (Not responding)");
|
|
||||||
title_text = builder.to_string();
|
|
||||||
} else {
|
|
||||||
title_text = window.title();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto clipped_title_rect = titlebar_title_rect;
|
auto clipped_title_rect = titlebar_title_rect;
|
||||||
clipped_title_rect.set_width(stripe_right - clipped_title_rect.x());
|
clipped_title_rect.set_width(stripe_right - clipped_title_rect.x());
|
||||||
if (!clipped_title_rect.is_empty()) {
|
if (!clipped_title_rect.is_empty()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue