1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

WindowServer+LibGUI: Add ability to set per-window icons.

The icons are passed around as filesystem paths for now, since the shared
memory bitmaps only support 2 sides.
This commit is contained in:
Andreas Kling 2019-04-13 16:59:55 +02:00
parent 7a74b76769
commit c09c114d77
19 changed files with 151 additions and 16 deletions

View file

@ -448,3 +448,19 @@ void GWindow::set_modal(bool modal)
void GWindow::wm_event(GWMEvent&)
{
}
void GWindow::set_icon_path(const String& path)
{
if (m_icon_path == path)
return;
m_icon_path = path;
if (!m_window_id)
return;
WSAPI_ClientMessage message;
message.type = WSAPI_ClientMessage::Type::SetWindowIcon;
message.window_id = m_window_id;
ASSERT(path.length() < sizeof(message.text));
strcpy(message.text, path.characters());
message.text_length = path.length();
GEventLoop::post_message_to_server(message);
}