changeset 8354:8a0b6e083280

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@gmx.de>
author arpi
date Wed, 04 Dec 2002 23:31:46 +0000
parents 6dd42a044681
children 3be7b22b6713
files libvo/x11_common.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Wed Dec 04 23:29:41 2002 +0000
+++ b/libvo/x11_common.c	Wed Dec 04 23:31:46 2002 +0000
@@ -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;