1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

WindowServer+Taskbar: Send WM icon updates as Gfx::ShareableBitmap

Window icons in Taskbar were previously received in WM events with
shbuf ID's. Now that Gfx::ShareableBitmap is backed by anonymous files,
we can easily switch to using those.
This commit is contained in:
Andreas Kling 2021-01-15 23:13:24 +01:00
parent 633915e792
commit 333366a99d
9 changed files with 17 additions and 35 deletions

View file

@ -256,17 +256,9 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
case GUI::Event::WM_WindowIconBitmapChanged: {
auto& changed_event = static_cast<GUI::WMWindowIconBitmapChangedEvent&>(event);
#ifdef EVENT_DEBUG
dbgln("WM_WindowIconBitmapChanged: client_id={}, window_id={}, icon_buffer_id={}",
changed_event.client_id(),
changed_event.window_id(),
changed_event.icon_buffer_id());
#endif
if (auto* window = WindowList::the().window(identifier)) {
auto buffer = SharedBuffer::create_from_shbuf_id(changed_event.icon_buffer_id());
ASSERT(buffer);
if (window->button())
window->button()->set_icon(Gfx::Bitmap::create_with_shared_buffer(Gfx::BitmapFormat::RGBA32, *buffer, changed_event.icon_size()));
window->button()->set_icon(changed_event.bitmap());
}
break;
}