[Mplayer-dev-eng] DPMS patch

Loring Holden lsh at cs.brown.edu
Wed May 9 17:35:57 CEST 2001


DPMS wasn't being re-enabled on my machine (XFree86 4.0.1-1, RH 7.0) without
the following patch.  DPMSInfo() seems to need to be called after
DPMSEnable() in order for DPMS to be re-enabled.

Loring

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.18
diff -u -r1.18 x11_common.c
--- libvo/x11_common.c	2001/05/08 12:17:03	1.18
+++ libvo/x11_common.c	2001/05/09 15:30:47
@@ -219,9 +219,19 @@
     {
 	if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
 	{
-	    printf ("Enabling DPMS\n");
-	    DPMSEnable(mDisplay);  // restoring power saving settings
-	    DPMSQueryExtension(mDisplay, &nothing, &nothing);
+	    if (!DPMSEnable(mDisplay)) {  // restoring power saving settings
+                printf("DPMS not available?\n");
+            } else {
+                // DPMS does not seem to be enabled unless we call DPMSInfo
+	        BOOL onoff;
+        	CARD16 state;
+        	DPMSInfo(mDisplay, &state, &onoff);
+                if (onoff) {
+	            printf ("Successfully enabled DPMS\n");
+                } else {
+	            printf ("Could not enable DPMS\n");
+                }
+            }
 	}
     }
     
@@ -246,9 +256,11 @@
 	DPMSInfo(mDisplay, &state, &onoff);
 	if (onoff)
 	{
+           Status stat;
 	    printf ("Disabling DPMS\n");
 	    dpms_disabled=1;
-		DPMSDisable(mDisplay);  // monitor powersave off
+	    stat = DPMSDisable(mDisplay);  // monitor powersave off
+            printf ("stat: %d\n", stat);
 	}
     }
     XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);

_______________________________________________
Mplayer-dev-eng mailing list
Mplayer-dev-eng at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-dev-eng



More information about the MPlayer-dev-eng mailing list