Preventing screensaver when playing movie?

Erik esigra at gmail.com
Wed Mar 5 00:56:17 PST 2008


David Sharp skrev:
> On Tue, Mar 4, 2008 at 3:42 PM, Graeme Gill <graeme2 at argyllcms.com> wrote:
>   
>> Erik wrote:
>>
>>  > I sure hope not! It would leave the system in a broken state if mplayer
>>  > is killed before it reaches the point when it turns DPMS on again. No
>>  > application program should ever use commands like that. Only
>>
>>  Nice in theory,

Nice in theory and absolutely necessary in practice. At least in a 
multi-tasking environment, which is what X11 is designed to be.

If an application tampers with my display power-mangagement/privacy 
settings on the sly like that, I surely let them know about it in a 
sincere way.


>>  but not all the screensaver API's support this approach.
>>     

We are talking about the X11 API here and it supports that approach.


>>  To be able to follow that approach you need a light weight
>>  (ie. calling it doesn't chew resources) programmatic means
>>  of (ideally) holding the counter reset for a set period of time.
>>     

The application should just call XResetScreensaver whenever it updates 
the display with some content that the user may want to watch even 
though he has not interacted with the system recently.


>>  None of the various screen/power savers have such an API.
>>     

That is not the point. What matters is that X11 has such an API. X11 
applications should be written for X11, not for every single screensaver 
out there. Then it is up to the user to chose an X11 compatible 
screensaver if he wants a working system.


>>  Some have a reset call, but you don't know how often you have to call it.

Simple. Every time the display is updated with something that the user 
may want to see even though he has not interacted with the system recently.


>>  DPMS doesn't have either

DPMS on X11 is compatible with X11 so it works with XResetScreenSaver.


>>  Now some of the other calls may reset DPMS as a side effect,
>>  (XResetScreenSaver ?) but it doesn't seem to be documented.
>>     

Some documentation for XResetScreenSaver would indeed not hurt. Maybe it 
was just considered  too obvious what it should do? Note that reseting 
DPMS is not a side effect. It is expected behaviour.


>>  The XScreenSaver extension doesn't have a reset either, it's
>>  got a XScreenSaverSuspend(bool) (that does control DPMS as well),
>>  that stops and starts it. If the the connection between client
>>  and server breaks, the countdown continues though. So using
>>  this won't allow the DPMS to start if you pause a movie etc.
>>  (which may or may not be what the user actually wants), but
>>  it does allow an application to disable things in a fail-safe
>>  way.
>>     
>
> Can't the client call XScreenSaverSuspend(False) on pause to re-enable
> the counter?
>   

I do not find any manual page for that, but since it has a boolean 
parameter it should be possible. And since it is said that it is 
fail-safe I assume that it is also designed to work with multitasking. 
The X server must have a set IDs of clients that have called

XScreenSaverSuspend(true). When a client calls XScreenSaverSuspend(false) or disconnects, its ID is removed from the set. A screen saver is only allowed to run when the set is empty.




More information about the xorg mailing list