diff --git a/Services/WindowServer/ClientConnection.cpp b/Services/WindowServer/ClientConnection.cpp index a977c4fffe..419f4f13ac 100644 --- a/Services/WindowServer/ClientConnection.cpp +++ b/Services/WindowServer/ClientConnection.cpp @@ -882,6 +882,35 @@ OwnPtr ClientConnection return make(Screen::the().cursor_location()); } +OwnPtr 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(); +} + +OwnPtr ClientConnection::handle(const Messages::WindowServer::GetMouseAcceleration&) +{ + return make(Screen::the().acceleration_factor()); +} + +OwnPtr 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(); +} +OwnPtr ClientConnection::handle(const Messages::WindowServer::GetScrollStepSize&) +{ + return make(Screen::the().scroll_step_size()); +} + void ClientConnection::set_unresponsive(bool unresponsive) { if (m_unresponsive == unresponsive) diff --git a/Services/WindowServer/ClientConnection.h b/Services/WindowServer/ClientConnection.h index 5a8bde4e85..12174e9189 100644 --- a/Services/WindowServer/ClientConnection.h +++ b/Services/WindowServer/ClientConnection.h @@ -145,6 +145,10 @@ private: virtual void handle(const Messages::WindowServer::SetWindowProgress&) override; virtual void handle(const Messages::WindowServer::Pong&) override; virtual OwnPtr handle(const Messages::WindowServer::GetGlobalCursorPosition&) override; + virtual OwnPtr handle(const Messages::WindowServer::SetMouseAcceleration&) override; + virtual OwnPtr handle(const Messages::WindowServer::GetMouseAcceleration&) override; + virtual OwnPtr handle(const Messages::WindowServer::SetScrollStepSize&) override; + virtual OwnPtr handle(const Messages::WindowServer::GetScrollStepSize&) override; Window* window_from_id(i32 window_id); diff --git a/Services/WindowServer/WindowServer.ipc b/Services/WindowServer/WindowServer.ipc index b28d4e283a..72399de1db 100644 --- a/Services/WindowServer/WindowServer.ipc +++ b/Services/WindowServer/WindowServer.ipc @@ -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() =| }