KIdleTime : provide a settable resolution for the polling backends?

Aleix Pol aleixpol at kde.org
Mon Nov 16 23:35:16 UTC 2015


On Mon, Nov 16, 2015 at 10:31 PM, René J.V. <rjvbertin at gmail.com> wrote:
> Hi,
>
> Working on modernising the OS X plugin for KIdleTime, I realised that there is no mechanism foreseen to set the frequency at which the current system idle time should be sampled on those platforms that need to use a polling approach (OS X, MS Windows and apparently also XScreenSaver).
>
> The frequency with which idle time is polled (sampled) determines the delay with which the resumingFromIdle signal can be sent, but also the precision of the timeoutReached signals.
>
> At the moment I'm using a QTimer interval of 0 to poll idle time, meaning the timer fires and idletime is fired about as fast as possible when there are no events to process. That is fine for a system that wants to react as fast as possible to the end of an idle period, but probably overkill in many other situations. It strikes me that the required resolution is something that only the calling code can know, though there are probably several values that are reasonable defaults (10x per second seems a bit much, 4x maybe just too low).
>
> Thoughts?
>
> R.

I guess it's because it shouldn't poll necessarily, but get a
notification whenever the OS considers appropriate. Polling is
considered a bad practice in general.

Aleix


More information about the Kde-frameworks-devel mailing list