1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +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:
Shannon Booth 2020-05-16 13:04:09 +12:00 committed by Andreas Kling
parent 8c1b01e79b
commit df43e09433
5 changed files with 36 additions and 2 deletions

View file

@ -578,6 +578,25 @@ OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> ClientConnection
return make<Messages::WindowServer::SetWindowOverrideCursorResponse>();
}
OwnPtr<Messages::WindowServer::SetWindowCustomOverrideCursorResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowCustomOverrideCursor& message)
{
auto it = m_windows.find(message.window_id());
if (it == m_windows.end()) {
did_misbehave("SetWindowCustomOverrideCursor: Bad window ID");
return nullptr;
}
auto& window = *(*it).value;
if (!message.cursor().is_valid()) {
did_misbehave("SetWindowCustomOverrideCursor: Bad cursor");
return nullptr;
}
window.set_override_cursor(Cursor::create(*message.cursor().bitmap()));
Compositor::the().invalidate_cursor();
return make<Messages::WindowServer::SetWindowCustomOverrideCursorResponse>();
}
OwnPtr<Messages::WindowServer::SetWindowHasAlphaChannelResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowHasAlphaChannel& message)
{
auto it = m_windows.find(message.window_id());