Skip to content

Commit 8c5fa05

Browse files
committed
WindowServer: Use Gfx::ShareableBitmap for SetWindowIconBitmap
1 parent 7cfe712 commit 8c5fa05

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Libraries/LibGUI/Window.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ void Window::apply_icon()
587587
if (!has_set_process_icon)
588588
set_process_icon(m_icon->shbuf_id());
589589

590-
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->shbuf_id(), m_icon->size());
590+
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
591591
}
592592

593593
void Window::start_wm_resize()

Servers/WindowServer/ClientConnection.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,10 @@ OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> ClientConnection::ha
361361
}
362362
auto& window = *(*it).value;
363363

364-
auto icon_buffer = SharedBuffer::create_from_shbuf_id(message.icon_buffer_id());
365-
366-
if (!icon_buffer) {
367-
window.set_default_icon();
364+
if (message.icon().is_valid()) {
365+
window.set_icon(*message.icon().bitmap());
368366
} else {
369-
window.set_icon(Gfx::Bitmap::create_with_shared_buffer(Gfx::BitmapFormat::RGBA32, *icon_buffer, message.icon_size()));
367+
window.set_default_icon();
370368
}
371369

372370
window.frame().invalidate_title_bar();

Servers/WindowServer/WindowServer.ipc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ endpoint WindowServer = 2
7979
SetWallpaperMode(String mode) => ()
8080

8181
SetResolution(Gfx::Size resolution) => (bool success, Gfx::Size resolution)
82-
SetWindowIconBitmap(i32 window_id, i32 icon_buffer_id, Gfx::Size icon_size) => ()
82+
SetWindowIconBitmap(i32 window_id, Gfx::ShareableBitmap icon) => ()
8383

8484
GetWallpaper() => (String path)
8585
SetWindowOverrideCursor(i32 window_id, i32 cursor_type) => ()

0 commit comments

Comments
 (0)