diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-10-24 17:44:30 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-24 22:00:34 +0200 |
commit | bbaf8e3b70a4ad9790e50b1ed3259d53728f5d08 (patch) | |
tree | 12f959b87622190e8be18f7e26d5c896f68e3030 /Userland | |
parent | 4131b3585164761e3841bb1c9609b302658ee2c0 (diff) | |
download | serenity-bbaf8e3b70a4ad9790e50b1ed3259d53728f5d08.zip |
WindowServer: Simplify mouse button handling logic in EventLoop
The `buttons` variable is a bit superfluous here.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/WindowServer/EventLoop.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp index e0d9cf9c2f..872e6df3d2 100644 --- a/Userland/Services/WindowServer/EventLoop.cpp +++ b/Userland/Services/WindowServer/EventLoop.cpp @@ -76,7 +76,6 @@ void EventLoop::drain_mouse() auto& screen_input = ScreenInput::the(); MousePacket state; state.buttons = screen_input.mouse_button_state(); - unsigned buttons = state.buttons; MousePacket packets[32]; ssize_t nread = read(m_mouse_fd, &packets, sizeof(packets)); @@ -90,7 +89,6 @@ void EventLoop::drain_mouse() for (size_t i = 0; i < npackets; ++i) { auto& packet = packets[i]; dbgln_if(WSMESSAGELOOP_DEBUG, "EventLoop: Mouse X {}, Y {}, Z {}, relative={}", packet.x, packet.y, packet.z, packet.is_relative); - buttons = packet.buttons; state.is_relative = packet.is_relative; if (packet.is_relative) { @@ -103,8 +101,8 @@ void EventLoop::drain_mouse() state.z += packet.z; } - if (buttons != state.buttons) { - state.buttons = buttons; + if (packet.buttons != state.buttons) { + state.buttons = packet.buttons; dbgln_if(WSMESSAGELOOP_DEBUG, "EventLoop: Mouse Button Event"); screen_input.on_receive_mouse_data(state); if (state.is_relative) { |