[vlc-devel] commit: KDE4 screensaver preemption (fixes #2730) (Felix Geyer )
git version control
git at videolan.org
Mon May 11 21:24:48 CEST 2009
vlc | branch: 0.9-bugfix | Felix Geyer <debfx-vlc at fobos.de> | Mon May 11 22:21:39 2009 +0300| [af9372a7ff3e5da84b6020476b4c5639e69a25fa] | committer: Rémi Denis-Courmont
KDE4 screensaver preemption (fixes #2730)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 8766feda419ad28a66bed64bacec4eea1b1d1a00)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af9372a7ff3e5da84b6020476b4c5639e69a25fa
---
modules/misc/screensaver.c | 40 ++++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/modules/misc/screensaver.c b/modules/misc/screensaver.c
index 7823330..0b176ca 100644
--- a/modules/misc/screensaver.c
+++ b/modules/misc/screensaver.c
@@ -53,6 +53,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
/*****************************************************************************
@@ -70,8 +74,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
@@ -242,34 +249,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" );
@@ -286,7 +306,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;
@@ -294,7 +314,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;
More information about the vlc-devel
mailing list