SOURCES: mplayer-gnome-screensaver.patch (NEW) - This patch enable...
sls
sls at pld-linux.org
Fri Oct 20 17:17:39 CEST 2006
Author: sls Date: Fri Oct 20 15:17:39 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- This patch enables controlling gnome screensaver
---- Files affected:
SOURCES:
mplayer-gnome-screensaver.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/mplayer-gnome-screensaver.patch
diff -u /dev/null SOURCES/mplayer-gnome-screensaver.patch:1.1
--- /dev/null Fri Oct 20 17:17:39 2006
+++ SOURCES/mplayer-gnome-screensaver.patch Fri Oct 20 17:17:34 2006
@@ -0,0 +1,280 @@
+--- MPlayer-1.0pre8/libvo/Makefile.gnome-screensaver 2006-06-11 20:35:43.000000000 +0200
++++ MPlayer-1.0pre8/libvo/Makefile 2006-06-12 15:42:21.000000000 +0200
+@@ -62,6 +62,9 @@
+ vo_mpegpes.o: vo_mpegpes.c
+ $(CC) -c $(CFLAGS) $(DVB_INC) -o $@ $<
+
++gnome_screensaver.o: gnome_screensaver.c
++ $(CC) -c $(CFLAGS) $(DBUS_GLIB_INC) -o $@ $<
++
+ all: $(LIBNAME)
+
+ clean:
+--- MPlayer-1.0pre8/libvo/gnome_screensaver.c.gnome-screensaver 2006-06-12 15:42:21.000000000 +0200
++++ MPlayer-1.0pre8/libvo/gnome_screensaver.c 2006-06-12 15:42:21.000000000 +0200
+@@ -0,0 +1,120 @@
++/*
++ * gnome_screensaver.c v0.0.7
++ *
++ * Enable/Disable the GNOME screensaver
++ * Supports GNOME screensaver API 2.14 and 2.15 and 2.16
++ *
++ * Call gnome_screensaver_control(1) to enable and
++ * gnome_screensaver_control(0) to disable
++ *
++ */
++
++#include <stdlib.h>
++#include <unistd.h>
++#include <dbus/dbus-glib.h>
++
++#include "gnome_screensaver.h"
++#include "mp_msg.h"
++#include "help_mp.h"
++
++#define GS_SERVICE "org.gnome.ScreenSaver"
++#define GS_PATH "/org/gnome/ScreenSaver"
++#define GS_INTERFACE "org.gnome.ScreenSaver"
++
++#define GS_APPLICATION_NAME "MPlayer"
++#define GS_REASON_FOR_INHIBIT "Playing a movie"
++
++static guint32 cookie;
++
++void gnome_screensaver_control(int enable)
++{
++ DBusGConnection *connection;
++ GError *error;
++ DBusGProxy *proxy;
++ gboolean ret;
++ char *funcname = "gnome_screensaver_control()";
++
++ g_type_init();
++
++ /* Get a connection to the session bus */
++ error = NULL;
++ connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
++ if (connection == NULL) {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ funcname, MSGTR_OpenBusConnectionError, error->message);
++ g_error_free(error);
++ return;
++ }
++
++ /* Create a proxy object */
++ proxy = dbus_g_proxy_new_for_name(connection,
++ GS_SERVICE, GS_PATH, GS_INTERFACE);
++
++ /* Enable the screensaver */
++ if (enable) {
++ /* First call the GNOME screensaver 2.15 API method */
++ error = NULL;
++ ret =
++ dbus_g_proxy_call(proxy, "UnInhibit", &error, G_TYPE_UINT,
++ cookie, G_TYPE_INVALID);
++
++ /* If this fails, try the GNOME screensaver 2.14 API */
++ if (!ret && error->domain == DBUS_GERROR
++ && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
++ mp_msg(MSGT_VO, MSGL_V,
++ "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
++ funcname);
++ g_error_free(error);
++ error = NULL;
++ ret =
++ dbus_g_proxy_call(proxy, "AllowActivation", &error,
++ G_TYPE_INVALID, G_TYPE_INVALID);
++ }
++ }
++ /* Disable the screensaver */
++ else {
++ /* First call the GNOME screensaver 2.15 API method */
++ error = NULL;
++ ret =
++ dbus_g_proxy_call(proxy, "Inhibit", &error, G_TYPE_STRING,
++ GS_APPLICATION_NAME, G_TYPE_STRING,
++ GS_REASON_FOR_INHIBIT, G_TYPE_INVALID,
++ G_TYPE_UINT, cookie, G_TYPE_INVALID);
++
++ /* If this fails, try the GNOME screensaver 2.14 API */
++ if (!ret && error->domain == DBUS_GERROR
++ && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
++ mp_msg(MSGT_VO, MSGL_V,
++ "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
++ funcname);
++ g_error_free(error);
++ error = NULL;
++ ret =
++ dbus_g_proxy_call(proxy, "InhibitActivation", &error,
++ G_TYPE_STRING, GS_REASON_FOR_INHIBIT,
++ G_TYPE_INVALID, G_TYPE_INVALID);
++ }
++ }
++
++ if (!ret) {
++ /* Check if it's a remote exception or a regular GError */
++ if (error->domain == DBUS_GERROR
++ && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ funcname, MSGTR_RemoteMethodException,
++ dbus_g_error_get_name(error), error->message);
++ }
++ else {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ funcname, MSGTR_GError, error->message);
++ }
++ g_error_free(error);
++ }
++ else {
++ mp_msg(MSGT_VO, MSGL_INFO,
++ enable ? MSGTR_GNOMEScreensaverEnabled :
++ MSGTR_GNOMEScreensaverDisabled);
++ }
++
++ g_object_unref(proxy);
++}
+--- MPlayer-1.0pre8/libvo/gnome_screensaver.h.gnome-screensaver 2006-06-12 15:42:21.000000000 +0200
++++ MPlayer-1.0pre8/libvo/gnome_screensaver.h 2006-06-12 15:42:21.000000000 +0200
+@@ -0,0 +1,6 @@
++#ifndef _GNOME_SCREENSAVER_H
++#define _GNOME_SCREENSAVER_H
++
++extern void gnome_screensaver_control(int enable);
++
++#endif /* !_GNOME_SCREENSAVER_H */
+--- MPlayer-1.0pre8/libvo/x11_common.c.gnome-screensaver 2006-06-11 20:35:43.000000000 +0200
++++ MPlayer-1.0pre8/libvo/x11_common.c 2006-06-12 15:42:21.000000000 +0200
+@@ -58,6 +58,10 @@
+ #include "mplayer.h"
+ #endif
+
++#ifdef HAVE_DBUS_GLIB
++#include "gnome_screensaver.h"
++#endif
++
+ #define WIN_LAYER_ONBOTTOM 2
+ #define WIN_LAYER_NORMAL 4
+ #define WIN_LAYER_ONTOP 6
+@@ -1691,8 +1695,12 @@
+ timeout_save = 0;
+ }
+
+- if (stop_xscreensaver)
++ if (stop_xscreensaver) {
+ xscreensaver_enable();
++#ifdef HAVE_DBUS_GLIB
++ gnome_screensaver_control(1);
++#endif
++ }
+ if (kdescreensaver_was_running && stop_xscreensaver)
+ {
+ system
+@@ -1737,8 +1745,12 @@
+ allow_exp);
+ }
+ // turning off screensaver
+- if (stop_xscreensaver)
++ if (stop_xscreensaver) {
+ xscreensaver_disable(mDisplay);
++#ifdef HAVE_DBUS_GLIB
++ gnome_screensaver_control(0);
++#endif
++ }
+ if (stop_xscreensaver && !kdescreensaver_was_running)
+ {
+ kdescreensaver_was_running =
+--- MPlayer-1.0pre8/help/help_mp-en.h.gnome-screensaver 2006-06-11 20:35:45.000000000 +0200
++++ MPlayer-1.0pre8/help/help_mp-en.h 2006-06-12 15:42:21.000000000 +0200
+@@ -678,6 +678,13 @@
+ #define MSGTR_InsertingAfVolume "[Mixer] No hardware mixing, inserting volume filter.\n"
+ #define MSGTR_NoVolume "[Mixer] No volume control available.\n"
+
++// gnome_screensaver.c
++#define MSGTR_OpenBusConnectionError "%s: Failed to open connection to bus: %s\n"
++#define MSGTR_RemoteMethodException "%s: Caught remote method exception %s: %s\n"
++#define MSGTR_GError "%s: Error: %s\n"
++#define MSGTR_GNOMEScreensaverEnabled "GNOME screensaver enabled\n"
++#define MSGTR_GNOMEScreensaverDisabled "GNOME screensaver disabled\n"
++
+ // ====================== GUI messages/buttons ========================
+
+ #ifdef HAVE_NEW_GUI
+--- MPlayer-1.0pre8/Makefile.gnome-screensaver 2006-06-11 20:35:47.000000000 +0200
++++ MPlayer-1.0pre8/Makefile 2006-06-12 15:42:21.000000000 +0200
+@@ -74,6 +74,7 @@
+ $(DIRECTFB_LIB) \
+ $(CACA_LIB) \
+ $(VESA_LIB) \
++ $(DBUS_GLIB_LIB) \
+
+ ifeq ($(EXTERNAL_VIDIX),yes)
+ VO_LIBS += $(EXTERNAL_VIDIX_LIB)
+--- MPlayer-1.0pre8/configure.gnome-screensaver 2006-06-11 20:35:47.000000000 +0200
++++ MPlayer-1.0pre8/configure 2006-06-12 15:43:24.000000000 +0200
+@@ -248,6 +248,7 @@
+ --disable-ftp Disable ftp support [enabled]
+ --disable-vstream Disable tivo vstream client support [autodetect]
+ --disable-pthreads Disable Posix threads support [autodetect]
++ --disable-dbus-glib Disable D-BUS GLib interface (required for GNOME scr\eensaver support) [autodetect]
+ --enable-rpath Enable runtime linker path for extra libs [disabled]
+
+ Codecs:
+@@ -1692,6 +1693,7 @@
+ _musepack=auto
+ _vstream=auto
+ _pthreads=yes
++_dbus_glib=auto
+ _rpath=no
+ for ac_option do
+ case "$ac_option" in
+@@ -1975,6 +1977,8 @@
+ --disable-vstream) _vstream=no ;;
+ --enable-pthreads) _pthreads=yes ;;
+ --disable-pthreads) _pthreads=no ;;
++ --enable-dbus-glib) _dbus_glib=yes ;;
++ --disable-dbus-glib) _dbus_glib=no ;;
+ --enable-rpath) _rpath=yes ;;
+ --disable-rpath) _rpath=no ;;
+
+@@ -6971,6 +6975,24 @@
+ fi
+ echores "$_gethostbyname2"
+
++echocheck "D-BUS GLib interface"
++if test "$_dbus_glib" = auto && pkg-config --exists dbus-glib-1; then
++ _dbus_glib=yes
++ _inc_dbus_glib=`pkg-config --cflags dbus-glib-1 2>/dev/null`
++ _ld_dbus_glib=`pkg-config --libs dbus-glib-1 2>/dev/null`
++fi
++
++if test "$_dbus_glib" = yes; then
++ _def_dbus_glib='#define HAVE_DBUS_GLIB 1'
++ # Enable GNOME screensaver support if both D-BUS GLib and X11 are present
++ if test "$_x11" = yes; then
++ _vosrc="$_vosrc gnome_screensaver.c"
++ fi
++else
++ _def_dbus_glib='#undef HAVE_DBUS_GLIB'
++fi
++echores "$_dbus_glib"
++
+ # --------------- GUI specific tests begin -------------------
+ echocheck "GUI"
+ echo "$_gui"
+@@ -7449,6 +7471,8 @@
+ AA_LIB = $_ld_aa
+ CACA_INC = $_inc_caca
+ CACA_LIB = $_ld_caca
++DBUS_GLIB_INC = $_inc_dbus_glib
++DBUS_GLIB_LIB = $_ld_dbus_glib
+
+ # audio output
+ ALSA_LIB = $_ld_alsa
+@@ -8258,6 +8282,7 @@
+ $_def_tga
+ $_def_toolame
+ $_def_twolame
++$_def_dbus_glib
+
+ /* used by GUI: */
+ $_def_xshape
================================================================
More information about the pld-cvs-commit
mailing list