mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:35:08 +00:00
LibGUI+WindowServer: Allow applications to set custom cursor bitmaps
This will allow e.g PaintBrush to use custom cursors for each tool.
This commit is contained in:
parent
8c1b01e79b
commit
df43e09433
5 changed files with 36 additions and 2 deletions
|
@ -209,10 +209,21 @@ void Window::set_override_cursor(StandardCursor cursor)
|
|||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
if (m_override_cursor == cursor)
|
||||
if (!m_custom_cursor && m_override_cursor == cursor)
|
||||
return;
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
|
||||
m_override_cursor = cursor;
|
||||
m_custom_cursor = nullptr;
|
||||
}
|
||||
|
||||
void Window::set_override_cursor(const Gfx::Bitmap& cursor)
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
if (&cursor == m_custom_cursor.ptr())
|
||||
return;
|
||||
m_custom_cursor = &cursor;
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCustomOverrideCursor>(m_window_id, m_custom_cursor->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
|
||||
}
|
||||
|
||||
void Window::event(Core::Event& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue