Skip to content

Commit

Permalink
WindowServer: Add a GetGlobalCursorPosition IPC request
Browse files Browse the repository at this point in the history
This tells you where the mouse cursor is in screen coordinates.
  • Loading branch information
awesomekling committed Dec 28, 2020
1 parent add01b3 commit 3717e5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Services/WindowServer/ClientConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ void ClientConnection::handle(const Messages::WindowServer::Pong&)
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)
{
if (m_unresponsive == unresponsive)
Expand Down
1 change: 1 addition & 0 deletions Services/WindowServer/ClientConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class ClientConnection final
virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override;
virtual void handle(const Messages::WindowServer::SetWindowProgress&) 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);

Expand Down
2 changes: 2 additions & 0 deletions Services/WindowServer/WindowServer.ipc
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,7 @@ endpoint WindowServer = 2
EnableDisplayLink() =|
DisableDisplayLink() =|

GetGlobalCursorPosition() => (Gfx::IntPoint position)

Pong() =|
}

0 comments on commit 3717e5d

Please sign in to comment.