From: RĂ©mi Denis-Courmont Date: Mon, 11 May 2009 19:22:52 +0000 (+0300) Subject: Merge branch 1.0-bugfix X-Git-Tag: 1.1.0-ff~6035 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1ac10ca36325552f134fdc0d93512bbc35b808a7;hp=7692ffe0ad8baebd01487e06495942e9f853df5f;p=vlc Merge branch 1.0-bugfix --- diff --git a/modules/misc/screensaver.c b/modules/misc/screensaver.c index 24448bc503..b5d89460d7 100644 --- a/modules/misc/screensaver.c +++ b/modules/misc/screensaver.c @@ -50,6 +50,10 @@ #define GS_PATH "/org/gnome/ScreenSaver" #define GS_INTERFACE "org.gnome.ScreenSaver" +#define FDS_SERVICE "org.freedesktop.ScreenSaver" +#define FDS_PATH "/ScreenSaver" +#define FDS_INTERFACE "org.freedesktop.ScreenSaver" + #endif /***************************************************************************** @@ -67,8 +71,11 @@ static void poke_screensaver( intf_thread_t *p_intf, DBusConnection *p_connection ); static void screensaver_send_message_void ( intf_thread_t *p_intf, DBusConnection *p_connection, + const char *psz_service, + const char *psz_path, + const char *psz_interface, const char *psz_name ); -static bool screensaver_is_running( DBusConnection *p_connection ); +static bool screensaver_is_running( DBusConnection *p_connection, const char *psz_service ); struct intf_sys_t @@ -235,34 +242,47 @@ static DBusConnection * dbus_init( intf_thread_t *p_intf ) static void poke_screensaver( intf_thread_t *p_intf, DBusConnection *p_connection ) { - if( screensaver_is_running( p_connection ) ) + if( screensaver_is_running( p_connection, GS_SERVICE ) ) { # ifdef SCREENSAVER_DEBUG msg_Dbg( p_intf, "found a running gnome-screensaver instance" ); # endif /* gnome-screensaver changed it's D-Bus interface, so we need both */ - screensaver_send_message_void( p_intf, p_connection, "Poke" ); - screensaver_send_message_void( p_intf, p_connection, - "SimulateUserActivity" ); + screensaver_send_message_void( p_intf, p_connection, GS_SERVICE, GS_PATH, + GS_INTERFACE, "Poke" ); + screensaver_send_message_void( p_intf, p_connection, GS_SERVICE, GS_PATH, + GS_INTERFACE, "SimulateUserActivity" ); + } + else if( screensaver_is_running( p_connection, FDS_SERVICE ) ) + { +# ifdef SCREENSAVER_DEBUG + msg_Dbg( p_intf, "found a running freedesktop-screensaver instance" ); +# endif + screensaver_send_message_void( p_intf, p_connection, FDS_SERVICE, FDS_PATH, + FDS_INTERFACE, "SimulateUserActivity" ); } # ifdef SCREENSAVER_DEBUG else { - msg_Dbg( p_intf, "found no running gnome-screensaver instance" ); + msg_Dbg( p_intf, "found no running (gnome|freedesktop)-screensaver instance" ); } # endif + } static void screensaver_send_message_void ( intf_thread_t *p_intf, DBusConnection *p_connection, + const char *psz_service, + const char *psz_path, + const char *psz_interface, const char *psz_name ) { DBusMessage *p_message; if( !p_connection || !psz_name ) return; - p_message = dbus_message_new_method_call( GS_SERVICE, GS_PATH, - GS_INTERFACE, psz_name ); + p_message = dbus_message_new_method_call( psz_service, psz_path, + psz_interface, psz_name ); if( p_message == NULL ) { msg_Err( p_intf, "DBUS initialization failed: message initialization" ); @@ -279,7 +299,7 @@ static void screensaver_send_message_void ( intf_thread_t *p_intf, dbus_message_unref( p_message ); } -static bool screensaver_is_running( DBusConnection *p_connection ) +static bool screensaver_is_running( DBusConnection *p_connection, const char *psz_service ) { DBusError error; bool b_return; @@ -287,7 +307,7 @@ static bool screensaver_is_running( DBusConnection *p_connection ) if( !p_connection ) return false; dbus_error_init( &error ); - b_return = dbus_bus_name_has_owner( p_connection, GS_SERVICE, &error ); + b_return = dbus_bus_name_has_owner( p_connection, psz_service, &error ); if( dbus_error_is_set( &error ) ) dbus_error_free (&error); return b_return;