1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 15:05:07 +00:00

WindowServer: Add a GetGlobalCursorPosition IPC request

This tells you where the mouse cursor is in screen coordinates.
This commit is contained in:
Andreas Kling 2020-12-28 20:48:52 +01:00
parent add01b304b
commit 3717e5dbae
3 changed files with 8 additions and 0 deletions

View file

@ -877,6 +877,11 @@ void ClientConnection::handle(const Messages::WindowServer::Pong&)
set_unresponsive(false); set_unresponsive(false);
} }
OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> ClientConnection::handle(const Messages::WindowServer::GetGlobalCursorPosition&)
{
return make<Messages::WindowServer::GetGlobalCursorPositionResponse>(Screen::the().cursor_location());
}
void ClientConnection::set_unresponsive(bool unresponsive) void ClientConnection::set_unresponsive(bool unresponsive)
{ {
if (m_unresponsive == unresponsive) if (m_unresponsive == unresponsive)

View file

@ -144,6 +144,7 @@ private:
virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override; virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override;
virtual void handle(const Messages::WindowServer::SetWindowProgress&) override; virtual void handle(const Messages::WindowServer::SetWindowProgress&) override;
virtual void handle(const Messages::WindowServer::Pong&) override; virtual void handle(const Messages::WindowServer::Pong&) override;
virtual OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> handle(const Messages::WindowServer::GetGlobalCursorPosition&) override;
Window* window_from_id(i32 window_id); Window* window_from_id(i32 window_id);

View file

@ -105,5 +105,7 @@ endpoint WindowServer = 2
EnableDisplayLink() =| EnableDisplayLink() =|
DisableDisplayLink() =| DisableDisplayLink() =|
GetGlobalCursorPosition() => (Gfx::IntPoint position)
Pong() =| Pong() =|
} }