Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 207377 | Differences between
and this patch

Collapse All | Expand All

(-)mplayer-1.0_rc2_p24929/configure (+28 lines)
Lines 281-286 Link Here
281
  --disable-vstream      disable TiVo vstream client support [autodetect]
281
  --disable-vstream      disable TiVo vstream client support [autodetect]
282
  --disable-pthreads     disable Posix threads support [autodetect]
282
  --disable-pthreads     disable Posix threads support [autodetect]
283
  --disable-w32threads   disable Win32 threads support [autodetect]
283
  --disable-w32threads   disable Win32 threads support [autodetect]
284
  --disable-dbus-glib    Disable D-BUS GLib interface (required for GNOME screensaver support) [autodetect]
284
  --disable-ass          disable internal SSA/ASS subtitle support [autodetect]
285
  --disable-ass          disable internal SSA/ASS subtitle support [autodetect]
285
  --enable-rpath         enable runtime linker path for extra libs [disabled]
286
  --enable-rpath         enable runtime linker path for extra libs [disabled]
286
287
Lines 672-677 Link Here
672
_musepack=auto
673
_musepack=auto
673
_vstream=auto
674
_vstream=auto
674
_pthreads=auto
675
_pthreads=auto
676
_dbus_glib=auto
675
_w32threads=auto
677
_w32threads=auto
676
_ass=auto
678
_ass=auto
677
_rpath=no
679
_rpath=no
Lines 1112-1117 Link Here
1112
  --disable-pthreads)   _pthreads=no    ;;
1114
  --disable-pthreads)   _pthreads=no    ;;
1113
  --enable-w32threads)  _w32threads=yes ;;
1115
  --enable-w32threads)  _w32threads=yes ;;
1114
  --disable-w32threads) _w32threads=no  ;;
1116
  --disable-w32threads) _w32threads=no  ;;
1117
  --enable-dbus-glib)   _dbus_glib=yes  ;;
1118
  --disable-dbus-glib)  _dbus_glib=no   ;;
1115
  --enable-ass)         _ass=yes        ;;
1119
  --enable-ass)         _ass=yes        ;;
1116
  --disable-ass)        _ass=no         ;;
1120
  --disable-ass)        _ass=no         ;;
1117
  --enable-rpath)       _rpath=yes      ;;
1121
  --enable-rpath)       _rpath=yes      ;;
Lines 5605-5610 Link Here
5605
else
5609
else
5606
    _def_fontconfig='#undef HAVE_FONTCONFIG'
5610
    _def_fontconfig='#undef HAVE_FONTCONFIG'
5607
fi
5611
fi
5612
_ld_fontconfig="-lfontconfig"
5608
echores "$_fontconfig"
5613
echores "$_fontconfig"
5609
5614
5610
5615
Lines 7172-7177 Link Here
7172
echores "$_gethostbyname2"
7177
echores "$_gethostbyname2"
7173
7178
7174
7179
7180
echocheck "D-BUS GLib interface"
7181
if test "$_dbus_glib" = auto && pkg-config --exists dbus-glib-1; then
7182
  _dbus_glib=yes
7183
  _inc_dbus_glib=`pkg-config --cflags dbus-glib-1 2>/dev/null`
7184
  _ld_dbus_glib=`pkg-config --libs dbus-glib-1 2>/dev/null`
7185
fi
7186
7187
if test "$_dbus_glib" = yes; then
7188
  _def_dbus_glib='#define HAVE_DBUS_GLIB 1'
7189
  _libs_mplayer="$_libs_mplayer `$_pkg_config --libs dbus-glib-1`"
7190
  # Enable GNOME screensaver support if both D-BUS GLib and X11 are present
7191
  if test "$_x11" = yes; then
7192
    _vosrc="$_vosrc gnome_screensaver.c"
7193
  fi
7194
else
7195
  _def_dbus_glib='#undef HAVE_DBUS_GLIB'
7196
fi
7197
echores "$_dbus_glib"
7198
7175
# --------------- GUI specific tests begin -------------------
7199
# --------------- GUI specific tests begin -------------------
7176
echocheck "GUI"
7200
echocheck "GUI"
7177
echo "$_gui"
7201
echo "$_gui"
Lines 7618-7623 Link Here
7618
HAVE_PTHREADS = $_pthreads
7642
HAVE_PTHREADS = $_pthreads
7619
HAVE_W32THREADS = $_w32threads
7643
HAVE_W32THREADS = $_w32threads
7620
7644
7645
DBUS_GLIB_INC = $_inc_dbus_glib
7646
DBUS_GLIB_LIB = $_ld_dbus_glib
7647
7621
HAVE_XVMC_ACCEL = $_xvmc
7648
HAVE_XVMC_ACCEL = $_xvmc
7622
7649
7623
HAVE_SYS_MMAN_H = $_mman
7650
HAVE_SYS_MMAN_H = $_mman
Lines 8496-8501 Link Here
8496
$_def_tga
8523
$_def_tga
8497
$_def_toolame
8524
$_def_toolame
8498
$_def_twolame
8525
$_def_twolame
8526
$_def_dbus_glib
8499
8527
8500
/* used by GUI: */
8528
/* used by GUI: */
8501
$_def_xshape
8529
$_def_xshape
(-)mplayer-1.0_rc2_p24929/help/help_mp-en.h (+8 lines)
Lines 711-716 Link Here
711
#define MSGTR_NoVolume "[Mixer] No volume control available.\n"
711
#define MSGTR_NoVolume "[Mixer] No volume control available.\n"
712
#define MSGTR_NoBalance "[Mixer] No balance control available.\n"
712
#define MSGTR_NoBalance "[Mixer] No balance control available.\n"
713
713
714
715
// gnome_screensaver.c
716
#define MSGTR_OpenBusConnectionError "%s: Failed to open connection to bus: %s\n"
717
#define MSGTR_RemoteMethodException "%s: Caught remote method exception %s: %s\n"
718
#define MSGTR_GError "%s: Error: %s\n"
719
#define MSGTR_GNOMEScreensaverEnabled "GNOME screensaver enabled\n"
720
#define MSGTR_GNOMEScreensaverDisabled "GNOME screensaver disabled\n"
721
714
// ====================== GUI messages/buttons ========================
722
// ====================== GUI messages/buttons ========================
715
723
716
#ifdef HAVE_NEW_GUI
724
#ifdef HAVE_NEW_GUI
(-)mplayer-1.0_rc2_p24929/libvo/gnome_screensaver.c (+120 lines)
Line 0 Link Here
1
/*
2
 * gnome_screensaver.c v0.0.7
3
 *
4
 * Enable/Disable the GNOME screensaver
5
 * Supports GNOME screensaver API 2.14 and 2.15
6
 *
7
 * Call gnome_screensaver_control(1) to enable and
8
 * gnome_screensaver_control(0) to disable
9
 *
10
 */
11
12
#include <stdlib.h>
13
#include <unistd.h>
14
#include <dbus/dbus-glib.h>
15
16
#include "gnome_screensaver.h"
17
#include "mp_msg.h"
18
#include "help_mp.h"
19
20
#define GS_SERVICE   "org.gnome.ScreenSaver"
21
#define GS_PATH      "/org/gnome/ScreenSaver"
22
#define GS_INTERFACE "org.gnome.ScreenSaver"
23
24
#define GS_APPLICATION_NAME     "MPlayer"
25
#define GS_REASON_FOR_INHIBIT   "Playing a movie"
26
27
static guint32 cookie;
28
29
void gnome_screensaver_control(int enable)
30
{
31
    DBusGConnection *connection;
32
    GError *error;
33
    DBusGProxy *proxy;
34
    gboolean ret;
35
    char *funcname = "gnome_screensaver_control()";
36
37
    g_type_init();
38
39
    /* Get a connection to the session bus */
40
    error = NULL;
41
    connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
42
    if (connection == NULL) {
43
        mp_msg(MSGT_VO, MSGL_ERR,
44
               funcname, MSGTR_OpenBusConnectionError, error->message);
45
        g_error_free(error);
46
        return;
47
    }
48
49
    /* Create a proxy object */
50
    proxy = dbus_g_proxy_new_for_name(connection,
51
                                      GS_SERVICE, GS_PATH, GS_INTERFACE);
52
53
    /* Enable the screensaver */
54
    if (enable) {
55
        /* First call the GNOME screensaver 2.15 API method */
56
        error = NULL;
57
        ret =
58
            dbus_g_proxy_call(proxy, "UnInhibit", &error, G_TYPE_UINT,
59
                              cookie, G_TYPE_INVALID);
60
61
        /* If this fails, try the GNOME screensaver 2.14 API */
62
        if (!ret && error->domain == DBUS_GERROR
63
            && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
64
            mp_msg(MSGT_VO, MSGL_V,
65
                   "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
66
                   funcname);
67
            g_error_free(error);
68
            error = NULL;
69
            ret =
70
                dbus_g_proxy_call(proxy, "AllowActivation", &error,
71
                                  G_TYPE_INVALID, G_TYPE_INVALID);
72
        }
73
    }
74
    /* Disable the screensaver */
75
    else {
76
        /* First call the GNOME screensaver 2.15 API method */
77
        error = NULL;
78
        ret =
79
            dbus_g_proxy_call(proxy, "Inhibit", &error, G_TYPE_STRING,
80
                              GS_APPLICATION_NAME, G_TYPE_STRING,
81
                              GS_REASON_FOR_INHIBIT, G_TYPE_INVALID,
82
                              G_TYPE_UINT, cookie, G_TYPE_INVALID);
83
84
        /* If this fails, try the GNOME screensaver 2.14 API */
85
        if (!ret && error->domain == DBUS_GERROR
86
            && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
87
            mp_msg(MSGT_VO, MSGL_V,
88
                   "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
89
                   funcname);
90
            g_error_free(error);
91
            error = NULL;
92
            ret =
93
                dbus_g_proxy_call(proxy, "InhibitActivation", &error,
94
                                  G_TYPE_STRING, GS_REASON_FOR_INHIBIT,
95
                                  G_TYPE_INVALID, G_TYPE_INVALID);
96
        }
97
    }
98
99
    if (!ret) {
100
        /* Check if it's a remote exception or a regular GError */
101
        if (error->domain == DBUS_GERROR
102
            && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
103
            mp_msg(MSGT_VO, MSGL_ERR,
104
                   funcname, MSGTR_RemoteMethodException,
105
                   dbus_g_error_get_name(error), error->message);
106
        }
107
        else {
108
            mp_msg(MSGT_VO, MSGL_ERR,
109
                   funcname, MSGTR_GError, error->message);
110
        }
111
        g_error_free(error);
112
    }
113
    else {
114
        mp_msg(MSGT_VO, MSGL_INFO,
115
               enable ? MSGTR_GNOMEScreensaverEnabled :
116
               MSGTR_GNOMEScreensaverDisabled);
117
    }
118
119
    g_object_unref(proxy);
120
}
(-)mplayer-1.0_rc2_p24929/libvo/gnome_screensaver.h (+6 lines)
Line 0 Link Here
1
#ifndef _GNOME_SCREENSAVER_H
2
#define _GNOME_SCREENSAVER_H
3
4
extern void gnome_screensaver_control(int enable);
5
6
#endif /* !_GNOME_SCREENSAVER_H */
(-)mplayer-1.0_rc2_p24929/libvo/Makefile (+4 lines)
Lines 27-29 Link Here
27
	$(CC) $(CFLAGS) -c -o $@ $<
27
	$(CC) $(CFLAGS) -c -o $@ $<
28
28
29
vo_png.o: CFLAGS := $(filter-out -I../libavcodec,$(CFLAGS))
29
vo_png.o: CFLAGS := $(filter-out -I../libavcodec,$(CFLAGS))
30
31
gnome_screensaver.o: gnome_screensaver.c
32
	$(CC) -c $(CFLAGS) $(DBUS_GLIB_INC) -o $@ $<
33
(-)mplayer-1.0_rc2_p24929/libvo/x11_common.c (-2 / +14 lines)
Lines 58-63 Link Here
58
#include "mplayer.h"
58
#include "mplayer.h"
59
#endif
59
#endif
60
60
61
#ifdef HAVE_DBUS_GLIB
62
#include "gnome_screensaver.h"
63
#endif
64
61
#define WIN_LAYER_ONBOTTOM               2
65
#define WIN_LAYER_ONBOTTOM               2
62
#define WIN_LAYER_NORMAL                 4
66
#define WIN_LAYER_NORMAL                 4
63
#define WIN_LAYER_ONTOP                  6
67
#define WIN_LAYER_ONTOP                  6
Lines 1754-1761 Link Here
1754
        timeout_save = 0;
1758
        timeout_save = 0;
1755
    }
1759
    }
1756
1760
1757
    if (stop_xscreensaver)
1761
    if (stop_xscreensaver) {
1758
        xscreensaver_enable();
1762
        xscreensaver_enable();
1763
#ifdef HAVE_DBUS_GLIB
1764
        gnome_screensaver_control(1);
1765
#endif
1766
    }
1759
    if (kdescreensaver_was_running && stop_xscreensaver)
1767
    if (kdescreensaver_was_running && stop_xscreensaver)
1760
    {
1768
    {
1761
        system
1769
        system
Lines 1800-1807 Link Here
1800
                            allow_exp);
1808
                            allow_exp);
1801
    }
1809
    }
1802
    // turning off screensaver
1810
    // turning off screensaver
1803
    if (stop_xscreensaver)
1811
    if (stop_xscreensaver) {
1804
        xscreensaver_disable(mDisplay);
1812
        xscreensaver_disable(mDisplay);
1813
#ifdef HAVE_DBUS_GLIB
1814
        gnome_screensaver_control(0);
1815
#endif
1816
    }
1805
    if (stop_xscreensaver && !kdescreensaver_was_running)
1817
    if (stop_xscreensaver && !kdescreensaver_was_running)
1806
    {
1818
    {
1807
        kdescreensaver_was_running =
1819
        kdescreensaver_was_running =

Return to bug 207377