This is so wrong, it hurts.
Instead of the GNOME screensaver respecting the MIT-SCREEN-SAVER extension and registering for the screensaver idle event, it uses a completely different control mechanism. Our alternatives are to use dbus (very complicated) or this really painful hack. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403492
This commit is contained in:
parent
a097a4105f
commit
538276cc18
1 changed files with 44 additions and 11 deletions
|
@ -410,6 +410,33 @@ X11_PumpEvents(_THIS)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
@ -418,20 +445,26 @@ X11_SuspendScreenSaver(_THIS)
|
|||
int dummy;
|
||||
int major_version, minor_version;
|
||||
|
||||
if (!SDL_X11_HAVE_XSS) {
|
||||
return;
|
||||
}
|
||||
if (SDL_X11_HAVE_XSS) {
|
||||
/* XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */
|
||||
if (!XScreenSaverQueryExtension(data->display, &dummy, &dummy) ||
|
||||
!XScreenSaverQueryVersion(data->display,
|
||||
&major_version, &minor_version) ||
|
||||
major_version < 1 || (major_version == 1 && minor_version < 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */
|
||||
if (!XScreenSaverQueryExtension(data->display, &dummy, &dummy) ||
|
||||
!XScreenSaverQueryVersion(data->display,
|
||||
&major_version, &minor_version) ||
|
||||
major_version < 1 || (major_version == 1 && minor_version < 1)) {
|
||||
return;
|
||||
XScreenSaverSuspend(data->display, _this->suspend_screensaver);
|
||||
XResetScreenSaver(data->display);
|
||||
}
|
||||
#endif
|
||||
|
||||
XScreenSaverSuspend(data->display, _this->suspend_screensaver);
|
||||
XResetScreenSaver(data->display);
|
||||
#ifdef GNOME_SCREENSAVER_HACK
|
||||
if (_this->suspend_screensaver) {
|
||||
gnome_screensaver_disable();
|
||||
} else {
|
||||
gnome_screensaver_enable();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue