Please standardize Screen saver DBus interfaces
André Gillibert
rcvxdg at gmail.com
Tue May 19 06:08:51 PDT 2009
Ali Abdallah wrote:
> Lubos Lunak wrote:
>> Actually, the way to inhibit the screensaver on X was standardized
>> ages ago -
>> it's XResetScreensaver(), in Xlib. It resets the user inactivity
>> counter, it prevents DPMS from activating,
> I see this X standard which was implemented ages ago not being respected
> by movie players
> (xine, mplayer, totem, ...).
>
From mplayer man page:
> −stop−xscreensaver (X11 only)
>
> Turns off xscreensaver at startup and turns it on again on exit. If your screensaver supports neither the XSS nor XResetScreenSaver API > please use −heartbeat−cmd instead.
So, mplayer does support XResetScreenSaver, and xscreensaver seems to support it too.
From xine source code (src/xitk/videowin.c):
> void video_window_reset_ssaver(void) {
> [...]
> [code that basically calls gnome-screensaver-command --poke]
> [...]
> XResetScreenSaver(gGui->video_display);
> [...]
> }
From vlc source code (modules/video_output/x11/xcommon.c):
> /* Disable screen saver */
> if( p_vout->p_sys->i_ss_timeout )
> {
> XSetScreenSaver( p_vout->p_sys->p_display, 0,
> p_vout->p_sys->i_ss_interval,
> p_vout->p_sys->i_ss_blanking,
> p_vout->p_sys->i_ss_exposure );
> }
From totem source code (lib/totem-scrsaver.c):
> screensaver_disable_x11 (TotemScrsaver *scr)
> [...]
> XSetScreenSaver(GDK_DISPLAY(), 0, 0,
> DontPreferBlanking, DontAllowExposures);
> [...]
> }
vlc (and totem too), unlike mplayer and xine, disable the screen saver when it's loaded, and enable it when it's exited (that's what I feel when I read the source code).
That may look neat, but there're issues if multiple vlc sessions are running at the same time and one of them is exited, and there might be issues if vlc crashes (not sure, it might depend on the X server).
Anyway, these four players use the standard XLib API.
<http://linux.die.net/man/3/xresetscreensaver>
> They have DBus connection with a unique name and when they crash they
> disappear from the session bus, i see no problem here.
>> It's enough to just repeatedly call this (and the player is already busy
>> doing something anyway, isn't it?).
> For me it is ugly to have a timeout for calling this every 10 seconds.
>
Yep, but the API is standard, it's widely use and it's, in some ways, better than a DBus connection based API, because the REAL scope of the screen saver is a X11 display, not a desktop session.
For example, if mplayer is used on a remote computer, running a different DBus session, but on a local display:
[user at computer1] $ DISPLAY=computer2:0 mplayer somevideo.avi
Then, the screen saver inhibition must be done on the computer2:0 display of computer2, not on a computer1 display.
And yes, this is something I do frequently.
There might be room to improve X11 API. Maybe adding some XInhibitScreenSaver function that would inhibit the screen saver until a XUninhibitScreenSaver function is called or the X11 connection is broken (which happens on application crash).
But, I don't see any real need for that. Applications inhibiting the screen saver are likely to be busy, and thus, calling XResetScreenSaver periodically isn't a big deal.
IMO, a new specification would just harm. One specification is enough. Just promote it, sending e-mails to GNOME, KDE and XFCE project developers who do not, but should, use this X11 API.
--
André Gillibert
More information about the xdg
mailing list