Replaced Gnome screensaver hack with D-Bus messages to org.gnome.ScreenSaver.
This commit is contained in:
parent
9ddb1f459d
commit
fc98164d8d
7 changed files with 194 additions and 32 deletions
|
@ -675,7 +675,7 @@ X11_Pending(Display * display)
|
|||
|
||||
/* !!! FIXME: this should be exposed in a header, or something. */
|
||||
int SDL_GetNumTouch(void);
|
||||
|
||||
void SDL_dbus_screensaver_tickle(_THIS);
|
||||
|
||||
void
|
||||
X11_PumpEvents(_THIS)
|
||||
|
@ -688,6 +688,11 @@ X11_PumpEvents(_THIS)
|
|||
if (!data->screensaver_activity ||
|
||||
(int) (now - data->screensaver_activity) >= 30000) {
|
||||
XResetScreenSaver(data->display);
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
SDL_dbus_screensaver_tickle(_this);
|
||||
#endif
|
||||
|
||||
data->screensaver_activity = now;
|
||||
}
|
||||
}
|
||||
|
@ -785,33 +790,6 @@ X11_PumpEvents(_THIS)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* This is so wrong it hurts */
|
||||
#define GNOME_SCREENSAVER_HACK
|
||||
#ifdef GNOME_SCREENSAVER_HACK
|
||||
#include <unistd.h>
|
||||
static pid_t screensaver_inhibit_pid;
|
||||
static void
|
||||
gnome_screensaver_disable()
|
||||
{
|
||||
screensaver_inhibit_pid = fork();
|
||||
if (screensaver_inhibit_pid == 0) {
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
execl("/usr/bin/gnome-screensaver-command",
|
||||
"gnome-screensaver-command",
|
||||
"--inhibit",
|
||||
"--reason",
|
||||
"GNOME screensaver doesn't respect MIT-SCREEN-SAVER", NULL);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
static void
|
||||
gnome_screensaver_enable()
|
||||
{
|
||||
kill(screensaver_inhibit_pid, 15);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
X11_SuspendScreenSaver(_THIS)
|
||||
|
@ -835,11 +813,9 @@ X11_SuspendScreenSaver(_THIS)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef GNOME_SCREENSAVER_HACK
|
||||
#if SDL_USE_LIBDBUS
|
||||
if (_this->suspend_screensaver) {
|
||||
gnome_screensaver_disable();
|
||||
} else {
|
||||
gnome_screensaver_enable();
|
||||
SDL_dbus_screensaver_tickle(_this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue