Please standardize Screen saver DBus interfaces
Ali Abdallah
aliov at xfce.org
Tue May 19 06:30:31 PDT 2009
André Gillibert wrote:
> 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).
>
>
I hope that the API will be improved, and we can finally have
XInhibitScreenSaver.
> 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.
>
Probably having a new spec it is not the best idea, but i see the DBus
solution of this problem implemented everywhere ( totem, gxine,...), and
my thought of that was if the movies players developers are going in
this direction anyway let's have then standard screensaver name, at
least we get something working.
I will, armed by this mail, start to open bug reports for all the movie
players that doesn't use XResetScreenSaver which is nice to use in some
sense, like to avoid that the current running power manager from doing
stupid things like dimming the screen.
Anyway i still think that screen savers should use the same DBus name,
not because of the inhibit interface, but because of other services they
might provide, like lock unlock, SimulateUserActivity,
GetSessionIdleTime, etc... .
--
Send unlimited messages for free to all destinations with DBus.
http://www.freedesktop.org/wiki/Software/dbus
More information about the xdg
mailing list