[MPlayer-dev-eng] [PATCH] Make disabling DPMS optional
Holger Weiss
holger at CIS.FU-Berlin.DE
Thu Nov 2 16:19:40 CET 2006
Hello,
MPlayer disables DPMS on startup and re-enables it during exit (if DPMS
was enabled in the first place); this behaviour is hardcoded. On our
workstations, switching DPMS on or off both makes the display go black
for a second or two, which is pretty annoying when calling MPlayer.
Therefore, the attached patch adds a "-dpms-disable"/"-nodpms-disable"
option (with "-dpms-disable", which is the current behaviour, being the
default).
Holger
--
PGP fingerprint: F1F0 9071 8084 A426 DD59 9839 59D3 F3A1 B8B5 D3DE
-------------- next part --------------
Index: Gui/cfg.c
===================================================================
--- Gui/cfg.c (revision 20604)
+++ Gui/cfg.c (working copy)
@@ -82,6 +82,7 @@
extern char * get_path( const char * filename );
extern int flip;
extern int frame_dropping;
+extern int disable_dpms;
extern int stop_xscreensaver;
extern int m_config_parse_config_file(m_config_t* config, char *conffile);
@@ -171,6 +172,7 @@
{ "playbar",>kEnablePlayBar,CONF_TYPE_FLAG,0,0,1,NULL },
{ "load_fullscreen",>kLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL },
{ "show_videowin", >kShowVideoWindow,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "disabledpms",&disable_dpms,CONF_TYPE_FLAG,0,0,1,NULL },
{ "stopxscreensaver",&stop_xscreensaver,CONF_TYPE_FLAG,0,0,1,NULL },
{ "autosync",>kAutoSyncOn,CONF_TYPE_FLAG,0,0,1,NULL },
Index: Gui/wm/ws.c
===================================================================
--- Gui/wm/ws.c (revision 20604)
+++ Gui/wm/ws.c (working copy)
@@ -53,6 +53,8 @@
extern int xinerama_screen;
#endif
+extern int disable_dpms;
+
typedef struct
{
unsigned long flags;
@@ -1182,7 +1184,7 @@
{
int nothing;
#ifdef HAVE_XDPMS
- if ( dpms_disabled )
+ if ( disable_dpms && dpms_disabled )
{
if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) )
{
@@ -1212,7 +1214,7 @@
{
int interval,prefer_blank,allow_exp,nothing;
#ifdef HAVE_XDPMS
- if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) )
+ if ( disable_dpms && DPMSQueryExtension( mDisplay,¬hing,¬hing ) )
{
BOOL onoff;
CARD16 state;
Index: Gui/mplayer/gtk/opts.c
===================================================================
--- Gui/mplayer/gtk/opts.c (revision 20604)
+++ Gui/mplayer/gtk/opts.c (working copy)
@@ -75,6 +75,7 @@
static GtkWidget * CBCache;
static GtkWidget * CBLoadFullscreen;
static GtkWidget * CBSaveWinPos;
+static GtkWidget * CBDisableDPMS;
static GtkWidget * CBStopXScreenSaver;
static GtkWidget * CBPlayBar;
@@ -171,6 +172,7 @@
static void prEntry( GtkContainer * container,gpointer user_data );
#endif
+extern int disable_dpms;
extern int stop_xscreensaver;
void ShowPreferences( void )
@@ -374,6 +376,7 @@
gtk_widget_set_sensitive( CBLoadFullscreen,FALSE );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 );
}
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDisableDPMS ),disable_dpms );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ),stop_xscreensaver );
gtk_adjustment_set_value( HSPPQualityadj,auto_quality );
@@ -623,6 +626,7 @@
gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) );
gui_save_pos=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ) );
gtkShowVideoWindow=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) );
+ disable_dpms=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDisableDPMS ) );
stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) );
gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) );
gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL );
@@ -1271,6 +1275,7 @@
CBShowVideoWindow=AddCheckButton( MSGTR_PREFERENCES_ShowVideoWindow,vbox602 );
CBLoadFullscreen=AddCheckButton( MSGTR_PREFERENCES_LoadFullscreen,vbox602 );
CBSaveWinPos=AddCheckButton( MSGTR_PREFERENCES_SaveWinPos,vbox602 );
+ CBDisableDPMS=AddCheckButton( MSGTR_PREFERENCES_DisableDPMS,vbox602 );
CBStopXScreenSaver=AddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 );
CBPlayBar=AddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 );
Index: libvo/x11_common.c
===================================================================
--- libvo/x11_common.c (revision 20604)
+++ libvo/x11_common.c (working copy)
@@ -68,6 +68,7 @@
static int orig_layer = 0;
static int old_gravity = NorthWestGravity;
+int disable_dpms = 1;
int stop_xscreensaver = 0;
static int dpms_disabled = 0;
@@ -1659,7 +1660,7 @@
#ifdef HAVE_XDPMS
int nothing;
- if (dpms_disabled)
+ if (disable_dpms && dpms_disabled)
{
if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing))
{
@@ -1721,7 +1722,7 @@
#ifdef HAVE_XDPMS
int nothing;
- if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing))
+ if (disable_dpms && DPMSQueryExtension(mDisplay, ¬hing, ¬hing))
{
BOOL onoff;
CARD16 state;
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1 (revision 20604)
+++ DOCS/man/en/mplayer.1 (working copy)
@@ -2800,6 +2800,10 @@
(correct for (almost?) all LCDs).
.
.TP
+.B \-nodisable-dpms
+Do not disable DPMS at startup (and do not re-enable it on exit).
+.
+.TP
.B \-nodouble
Disables double buffering, mostly for debugging purposes.
Double buffering fixes flicker by storing two frames in memory, and
Index: DOCS/man/de/mplayer.1
===================================================================
--- DOCS/man/de/mplayer.1 (revision 20604)
+++ DOCS/man/de/mplayer.1 (working copy)
@@ -2921,6 +2921,11 @@
f?r (fast?) alle LCDs).
.
.TP
+.B \-nodisable-dpms
+DPMS beim Start von MPlayer nicht deaktivieren (und beim Beenden nicht
+wieder aktivieren).
+.
+.TP
.B \-nodouble
Deaktiviert Double-Buffering, haupts?chlich f?r Debugging-Zwecke.
Double-Buffering vermeidet Flimmern dadurch, dass zwei Bilder im Speicher
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h (revision 20604)
+++ cfg-mplayer.h (working copy)
@@ -62,6 +62,7 @@
#ifdef HAVE_X11
extern char *mDisplayName;
extern int fs_layer;
+extern int disable_dpms;
extern int stop_xscreensaver;
extern char **vo_fstype_list;
extern int vo_nomouse_input;
@@ -239,6 +240,8 @@
#ifdef HAVE_X11
// x11,xv,xmga,xvidix
{"icelayer", "-icelayer is obsolete. Use -fstype layer:<number> instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+ {"disable-dpms", &disable_dpms, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"nodisable-dpms", &disable_dpms, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"stop-xscreensaver", &stop_xscreensaver, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"nostop-xscreensaver", &stop_xscreensaver, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"stop_xscreensaver", "Use -stop-xscreensaver instead, options with _ have been obsoleted.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
Index: help/help_mp-de.h
===================================================================
--- help/help_mp-de.h (revision 20604)
+++ help/help_mp-de.h (working copy)
@@ -932,6 +932,7 @@
#define MSGTR_PREFERENCES_CacheSize "Cachegr????e: "
#define MSGTR_PREFERENCES_LoadFullscreen "Im Vollbildmodus starten"
#define MSGTR_PREFERENCES_SaveWinPos "Speichere Fensterposition"
+#define MSGTR_PREFERENCES_DisableDPMS "Deaktiviere DPMS"
#define MSGTR_PREFERENCES_XSCREENSAVER "Deaktiviere XScreenSaver"
#define MSGTR_PREFERENCES_PlayBar "Aktiviere die Playbar"
#define MSGTR_PREFERENCES_AutoSync "AutoSync ein/aus"
Index: help/help_mp-en.h
===================================================================
--- help/help_mp-en.h (revision 20604)
+++ help/help_mp-en.h (working copy)
@@ -919,6 +919,7 @@
#define MSGTR_PREFERENCES_CacheSize "Cache size: "
#define MSGTR_PREFERENCES_LoadFullscreen "Start in fullscreen"
#define MSGTR_PREFERENCES_SaveWinPos "Save window position"
+#define MSGTR_PREFERENCES_DisableDPMS "Disable DPMS"
#define MSGTR_PREFERENCES_XSCREENSAVER "Stop XScreenSaver"
#define MSGTR_PREFERENCES_PlayBar "Enable playbar"
#define MSGTR_PREFERENCES_AutoSync "AutoSync on/off"
More information about the MPlayer-dev-eng
mailing list