[Mplayer-cvslog] CVS: main/libvo x11_common.c,1.113,1.114

Arpi of Ize arpi at mplayerhq.hu
Thu Dec 5 00:31:49 CET 2002


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv9040

Modified Files:
	x11_common.c 
Log Message:
This patch fixes the screensaver issues in mplayer. It will correctly read
and store the state of XScreensaver and KDE-Screensaver, will stop them and
restart them later, when the movie has finished ...
It works and was tested with KDE2/3 and XScreensaver 4.05.
patch by Fabian Franz <FabianFranz at gmx.de>


Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -r1.113 -r1.114
--- x11_common.c	16 Nov 2002 16:08:36 -0000	1.113
+++ x11_common.c	4 Dec 2002 23:31:46 -0000	1.114
@@ -53,6 +53,7 @@
 static int dpms_disabled=0;
 static int timeout_save=0;
 static int xscreensaver_was_running=0;
+static int kdescreensaver_was_running=0;
 
 char* mDisplayName=NULL;
 Display* mDisplay=NULL;
@@ -787,6 +788,11 @@
 	system("cd /; xscreensaver -no-splash &");
 	xscreensaver_was_running = 0;
     }
+    if (kdescreensaver_was_running && stop_xscreensaver) {
+	system("dcop kdesktop KScreensaverIface enable true 2>/dev/null >/dev/null");
+	kdescreensaver_was_running = 0;
+    }
+
 
 }
 
@@ -816,8 +822,19 @@
 	if (timeout_save)
 	    XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
     }
-    xscreensaver_was_running = stop_xscreensaver && ! system("xscreensaver-command -exit");
 		    // turning off screensaver
+    if (stop_xscreensaver && !xscreensaver_was_running)
+    {
+      xscreensaver_was_running = (system("xscreensaver-command -version 2>/dev/null >/dev/null")==0);
+      if (xscreensaver_was_running)
+	 system("xscreensaver-command -exit 2>/dev/null >/dev/null");    
+    }
+    if (stop_xscreensaver && !kdescreensaver_was_running)
+    {
+      kdescreensaver_was_running=(system("dcop kdesktop KScreensaverIface isEnabled 2>/dev/null | sed 's/1/true/g' | grep true 2>/dev/null >/dev/null")==0);
+      if (kdescreensaver_was_running)
+	  system("dcop kdesktop KScreensaverIface enable false 2>/dev/null >/dev/null");
+    }
 }
 
 static XErrorHandler old_handler = NULL;




More information about the MPlayer-cvslog mailing list