Comment 2 for bug 310351

Hi,

Under KDE4, instead of calling the DBUS method UnInhibit, the script xdg-screensaver calls the method SetActive. This starts the screensaver immediately, and this is absolutely not the expected behaviour.

The function screensaver_freedesktop() in the script is broken (and there are some FIXME's around). Here's a diff of what it should look like:

diff --git a/usr/bin/xdg-screensaver b/xdg-screensaver
index 29e8e18..015cc2e 100755
--- a/usr/bin/xdg-screensaver
+++ b/xdg-screensaver
@@ -558,13 +558,13 @@ screensaver_freedesktop()
 {
     case "$1" in
         suspend)
- #FIXME (get/store cookie)
- qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Inhibit $window_id xdg-screensaver > /dev/null
+ qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Inhibit $window_id xdg-screensaver >| "$screensaver_file.cookie" 2> /dev/null
         result=$?
         ;;

         resume)
- qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SetActive true > /dev/null
+ qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.UnInhibit `cat "$screensaver_file.cookie"` > /dev/null
+ rm -f "$screensaver_file.cookie"
         result=$?
         ;;

@@ -578,8 +578,8 @@ screensaver_freedesktop()
         ;;

         reset)
- #FIXME (cookies?)
- qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.UnInhibit $window_id > /dev/null
+ qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.UnInhibit `cat "$screensaver_file.cookie"` > /dev/null
+ rm -f "$screensaver_file.cookie"
         result=$?
         ;;

Best regards,