1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

WindowServer+LibGUI: Expose raw scroll wheel values to applications

This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
This commit is contained in:
circl 2022-03-26 23:04:47 +01:00 committed by Andreas Kling
parent 148f8169a4
commit eeeaf410fb
11 changed files with 49 additions and 33 deletions

View file

@ -462,7 +462,7 @@ void ScreenInput::on_receive_mouse_data(const MousePacket& packet)
}
if (packet.z || packet.w) {
auto message = make<MouseEvent>(Event::MouseWheel, m_cursor_location, buttons, MouseButton::None, m_modifiers, packet.w * m_scroll_step_size, packet.z * m_scroll_step_size);
auto message = make<MouseEvent>(Event::MouseWheel, m_cursor_location, buttons, MouseButton::None, m_modifiers, packet.w * m_scroll_step_size, packet.z * m_scroll_step_size, packet.w, packet.z);
Core::EventLoop::current().post_event(WindowManager::the(), move(message));
}