mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:07:44 +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:
parent
633915e792
commit
333366a99d
9 changed files with 17 additions and 35 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (pledge("stdio sendfd shared_buffer accept proc exec rpath unix cpath fattr sigaction", nullptr) < 0) {
|
||||
if (pledge("stdio recvfd sendfd shared_buffer accept proc exec rpath unix cpath fattr sigaction", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char** argv)
|
|||
;
|
||||
});
|
||||
|
||||
if (pledge("stdio sendfd shared_buffer accept proc exec rpath", nullptr) < 0) {
|
||||
if (pledge("stdio recvfd sendfd shared_buffer accept proc exec rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ endpoint WindowClient = 4
|
|||
|
||||
WM_WindowRemoved(i32 wm_id, i32 client_id, i32 window_id) =|
|
||||
WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, i32 parent_client_id, i32 parent_window_id, bool is_active, bool is_minimized, bool is_modal, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, i32 progress) =|
|
||||
WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Gfx::IntSize icon_size) =|
|
||||
WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::ShareableBitmap bitmap) =|
|
||||
WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =|
|
||||
|
||||
AsyncSetWallpaperFinished(bool success) =|
|
||||
|
|
|
@ -316,15 +316,7 @@ void WindowManager::tell_wm_listener_about_window_icon(Window& listener, Window&
|
|||
return;
|
||||
if (window.is_internal())
|
||||
return;
|
||||
if (window.icon().shbuf_id() == -1)
|
||||
return;
|
||||
#ifdef WINDOWMANAGER_DEBUG
|
||||
dbg() << "WindowServer: Sharing icon buffer " << window.icon().shbuf_id() << " with PID " << listener.client()->client_pid();
|
||||
#endif
|
||||
if (shbuf_allow_pid(window.icon().shbuf_id(), listener.client()->client_pid()) < 0) {
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
listener.client()->post_message(Messages::WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().shbuf_id(), window.icon().size()));
|
||||
listener.client()->post_message(Messages::WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap()));
|
||||
}
|
||||
|
||||
void WindowManager::tell_wm_listeners_window_state_changed(Window& window)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
if (pledge("stdio video thread recvfd shared_buffer accept rpath wpath cpath unix proc fattr sigaction", nullptr) < 0) {
|
||||
if (pledge("stdio video thread sendfd recvfd shared_buffer accept rpath wpath cpath unix proc fattr sigaction", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ int main(int, char**)
|
|||
|
||||
WindowServer::EventLoop loop;
|
||||
|
||||
if (pledge("stdio video thread recvfd shared_buffer accept rpath wpath cpath proc", nullptr) < 0) {
|
||||
if (pledge("stdio video thread sendfd recvfd shared_buffer accept rpath wpath cpath proc", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue