WindowServer: Added IPC requests for getting and setting mouse settings

These include the mouse acceleration factor and the scroll length
step size.
This commit is contained in:
Idan Horowitz 2020-12-29 23:33:57 +02:00 committed by Andreas Kling
parent db409db4e9
commit 8159ce384d
Notes: sideshowbarker 2024-07-19 00:24:07 +09:00
3 changed files with 39 additions and 0 deletions

View file

@ -882,6 +882,35 @@ OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> ClientConnection
return make<Messages::WindowServer::GetGlobalCursorPositionResponse>(Screen::the().cursor_location());
}
OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> ClientConnection::handle(const Messages::WindowServer::SetMouseAcceleration& message)
{
if (message.factor() < mouse_accel_min || message.factor() > mouse_accel_max) {
did_misbehave("SetMouseAcceleration with bad acceleration factor");
return nullptr;
}
WindowManager::the().set_acceleration_factor(message.factor());
return make<Messages::WindowServer::SetMouseAccelerationResponse>();
}
OwnPtr<Messages::WindowServer::GetMouseAccelerationResponse> ClientConnection::handle(const Messages::WindowServer::GetMouseAcceleration&)
{
return make<Messages::WindowServer::GetMouseAccelerationResponse>(Screen::the().acceleration_factor());
}
OwnPtr<Messages::WindowServer::SetScrollStepSizeResponse> ClientConnection::handle(const Messages::WindowServer::SetScrollStepSize& message)
{
if (message.step_size() < scroll_step_size_min) {
did_misbehave("SetScrollStepSize with bad scroll step size");
return nullptr;
}
WindowManager::the().set_scroll_step_size(message.step_size());
return make<Messages::WindowServer::SetScrollStepSizeResponse>();
}
OwnPtr<Messages::WindowServer::GetScrollStepSizeResponse> ClientConnection::handle(const Messages::WindowServer::GetScrollStepSize&)
{
return make<Messages::WindowServer::GetScrollStepSizeResponse>(Screen::the().scroll_step_size());
}
void ClientConnection::set_unresponsive(bool unresponsive)
{
if (m_unresponsive == unresponsive)

View file

@ -145,6 +145,10 @@ private:
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;
virtual OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> handle(const Messages::WindowServer::SetMouseAcceleration&) override;
virtual OwnPtr<Messages::WindowServer::GetMouseAccelerationResponse> handle(const Messages::WindowServer::GetMouseAcceleration&) override;
virtual OwnPtr<Messages::WindowServer::SetScrollStepSizeResponse> handle(const Messages::WindowServer::SetScrollStepSize&) override;
virtual OwnPtr<Messages::WindowServer::GetScrollStepSizeResponse> handle(const Messages::WindowServer::GetScrollStepSize&) override;
Window* window_from_id(i32 window_id);

View file

@ -107,5 +107,11 @@ endpoint WindowServer = 2
GetGlobalCursorPosition() => (Gfx::IntPoint position)
SetMouseAcceleration(float factor) => ()
GetMouseAcceleration() => (float factor)
SetScrollStepSize(u32 step_size) => ()
GetScrollStepSize() => (u32 step_size)
Pong() =|
}