Found in vlc (modules/misc/screensaver.c - GPL) after I found gnome-screensaver-command: not found on stderr once too often:
/*****************************************************************************
* Run: main thread
*****************************************************************************
* This part of the module is in a separate thread so that we do not have
* too much system() overhead.
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
int i_lastcall = 0;
while( !p_intf->b_die )
{
msleep( 100000 );
/* Check screensaver every 30 seconds */
if( ++i_lastcall > 300 )
{
vlc_object_t *p_vout;
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
/* If there is a video output, disable xscreensaver */
if( p_vout )
{
vlc_object_release( p_vout );
/* http://www.jwz.org/xscreensaver/faq.html#dvd */
system( "xscreensaver-command -deactivate >&- 2>&- &" );
system( "gnome-screensaver-command --poke >&- 2>&- &" );
/* FIXME: add support for other screensavers */
}
i_lastcall = 0;
}
}
}
My eyes bleed... This is what the MIT-SCREEN-SAVER extension is for, Sam. If I can only figure out how to get at the Display pointer from p_intf, I'll send you a patch.
What do non-geeks do on Sunday evenings? Code-reading is fun.
Copyright © 2005–2010 Philip Paeps
All rights reserved.