src/video/x11/SDL_x11events.c
changeset 6774 ad8522052ce6
parent 6661 cd8befc0a969
child 6817 93103b719488
     1.1 --- a/src/video/x11/SDL_x11events.c	Wed Dec 26 22:26:44 2012 -0800
     1.2 +++ b/src/video/x11/SDL_x11events.c	Fri Dec 28 03:46:55 2012 -0500
     1.3 @@ -675,7 +675,7 @@
     1.4  
     1.5  /* !!! FIXME: this should be exposed in a header, or something. */
     1.6  int SDL_GetNumTouch(void);
     1.7 -
     1.8 +void SDL_dbus_screensaver_tickle(_THIS);
     1.9  
    1.10  void
    1.11  X11_PumpEvents(_THIS)
    1.12 @@ -688,6 +688,11 @@
    1.13          if (!data->screensaver_activity ||
    1.14              (int) (now - data->screensaver_activity) >= 30000) {
    1.15              XResetScreenSaver(data->display);
    1.16 +
    1.17 +            #if SDL_USE_LIBDBUS
    1.18 +            SDL_dbus_screensaver_tickle(_this);
    1.19 +            #endif
    1.20 +
    1.21              data->screensaver_activity = now;
    1.22          }
    1.23      }   
    1.24 @@ -785,33 +790,6 @@
    1.25  #endif
    1.26  }
    1.27  
    1.28 -/* This is so wrong it hurts */
    1.29 -#define GNOME_SCREENSAVER_HACK
    1.30 -#ifdef GNOME_SCREENSAVER_HACK
    1.31 -#include <unistd.h>
    1.32 -static pid_t screensaver_inhibit_pid;
    1.33 -static void
    1.34 -gnome_screensaver_disable()
    1.35 -{
    1.36 -    screensaver_inhibit_pid = fork();
    1.37 -    if (screensaver_inhibit_pid == 0) {
    1.38 -        close(0);
    1.39 -        close(1);
    1.40 -        close(2);
    1.41 -        execl("/usr/bin/gnome-screensaver-command",
    1.42 -              "gnome-screensaver-command",
    1.43 -              "--inhibit",
    1.44 -              "--reason",
    1.45 -              "GNOME screensaver doesn't respect MIT-SCREEN-SAVER", NULL);
    1.46 -        exit(2);
    1.47 -    }
    1.48 -}
    1.49 -static void
    1.50 -gnome_screensaver_enable()
    1.51 -{
    1.52 -    kill(screensaver_inhibit_pid, 15);
    1.53 -}
    1.54 -#endif
    1.55  
    1.56  void
    1.57  X11_SuspendScreenSaver(_THIS)
    1.58 @@ -835,11 +813,9 @@
    1.59      }
    1.60  #endif
    1.61  
    1.62 -#ifdef GNOME_SCREENSAVER_HACK
    1.63 +#if SDL_USE_LIBDBUS
    1.64      if (_this->suspend_screensaver) {
    1.65 -        gnome_screensaver_disable();
    1.66 -    } else {
    1.67 -        gnome_screensaver_enable();
    1.68 +        SDL_dbus_screensaver_tickle(_this);
    1.69      }
    1.70  #endif
    1.71  }