Skip to content
Verified Commit 7d4a79af authored by Bartosz Taudul's avatar Bartosz Taudul
Browse files

kcms/joystick: process all available events

Processing of joystick events is performed in a response to a zero-timeout
timer. Previously only one event was handled when the timer fired. The 10 ms
timeout of the select call checking if there are events to process prevented
100% CPU usage of a constantly firing timer.

The problem with such an approach is that joystick events are visibly slow to
process and show up in the buttons and axis readout. In some cases they are
even lost. It is not clear why this happens, my guess would be that each update
of the button or axis state in the UI triggers a redraw, which then waits for
VSync, preventing the timer from running.

This commit changes the event processing logic to run until there are no
events left to consume. This requires zeroing of the select call timeout, as
otherwise a joystick emitting events every 9 ms would be able completely block
the UI.

To prevent 100% CPU usage, 10 ms sleep calls are issued when the event queue
is empty. This has similar effect as the previous 10 ms select timeout.

Changes in the joystick calibration dialog are minimal, as I don't have use
for it. The behavior there shouldn't be degraded, but that's it.

BUG: 426230
FIXED-IN: 5.27
parent 05e5af1c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment