1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:25:06 +00:00

Add a String::format() and use that in place of ksprintf() in the Kernel.

You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
This commit is contained in:
Andreas Kling 2019-01-30 16:28:51 +01:00
parent e9b948103d
commit 027d26cd5d
11 changed files with 40 additions and 34 deletions

View file

@ -191,9 +191,12 @@ void WSWindowManager::paint_window_frame(WSWindow& window)
m_back_painter->draw_text(titleBarTitleRect, window.title(), Painter::TextAlignment::CenterLeft, title_color);
Color metadata_color(96, 96, 96);
char buffer[64];
ksprintf(buffer, "%d:%d", window.pid(), window.window_id());
m_back_painter->draw_text(titleBarTitleRect, buffer, Painter::TextAlignment::CenterRight, metadata_color);
m_back_painter->draw_text(
titleBarTitleRect,
String::format("%d:%d", window.pid(), window.window_id()),
Painter::TextAlignment::CenterRight,
metadata_color
);
}
void WSWindowManager::add_window(WSWindow& window)