mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:57:35 +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
|
@ -32,6 +32,7 @@
|
|||
#include <LibCore/Event.h>
|
||||
#include <LibGUI/FocusSource.h>
|
||||
#include <LibGUI/WindowType.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
||||
|
@ -172,19 +173,16 @@ private:
|
|||
|
||||
class WMWindowIconBitmapChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, int icon_buffer_id, const Gfx::IntSize& icon_size)
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, const Gfx::Bitmap* bitmap)
|
||||
: WMEvent(Event::Type::WM_WindowIconBitmapChanged, client_id, window_id)
|
||||
, m_icon_buffer_id(icon_buffer_id)
|
||||
, m_icon_size(icon_size)
|
||||
, m_bitmap(move(bitmap))
|
||||
{
|
||||
}
|
||||
|
||||
int icon_buffer_id() const { return m_icon_buffer_id; }
|
||||
const Gfx::IntSize& icon_size() const { return m_icon_size; }
|
||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||
|
||||
private:
|
||||
int m_icon_buffer_id;
|
||||
Gfx::IntSize m_icon_size;
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
};
|
||||
|
||||
class MultiPaintEvent final : public Event {
|
||||
|
|
|
@ -777,8 +777,7 @@ void Window::apply_icon()
|
|||
if (!is_visible())
|
||||
return;
|
||||
|
||||
auto icon = m_icon->to_shareable_bitmap();
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, icon);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap());
|
||||
}
|
||||
|
||||
void Window::start_wm_resize()
|
||||
|
|
|
@ -289,8 +289,9 @@ void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRectC
|
|||
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowIconBitmapChanged& message)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(message.wm_id()))
|
||||
Core::EventLoop::current().post_event(*window, make<WMWindowIconBitmapChangedEvent>(message.client_id(), message.window_id(), message.icon_buffer_id(), message.icon_size()));
|
||||
if (auto* window = Window::from_window_id(message.wm_id())) {
|
||||
Core::EventLoop::current().post_event(*window, make<WMWindowIconBitmapChangedEvent>(message.client_id(), message.window_id(), message.bitmap().bitmap()));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRemoved& message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue