1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +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

@ -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) =|

View file

@ -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)

View file

@ -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;
}