https://bugs.kde.org/show_bug.cgi?id=426230

Joshua Goins <j...@redstrate.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/plasma-desktop/commit/7d |ma/plasma-desktop/commit/57
                   |4a79afac02c0db7ef69bd31018c |5e99f5af5e9204b22d7a8bd8e7e
                   |cbe16280299                 |9757af05e4f

--- Comment #7 from Joshua Goins <j...@redstrate.com> ---
Git commit 575e99f5af5e9204b22d7a8bd8e7e9757af05e4f by Joshua Goins, on behalf
of Bartosz Taudul.
Committed on 04/02/2023 at 01:50.
Pushed by redstrate into branch 'Plasma/5.27'.

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.
FIXED-IN: 5.27
(cherry picked from commit 7d4a79afac02c0db7ef69bd31018ccbe16280299)

M  +4    -1    kcms/joystick/caldialog.cpp
M  +1    -1    kcms/joystick/joydevice.cpp
M  +24   -18   kcms/joystick/joywidget.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/575e99f5af5e9204b22d7a8bd8e7e9757af05e4f

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to