summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver/XScreenSaver.ad.in10
-rw-r--r--driver/XScreenSaver_ad.h15
-rw-r--r--driver/prefs.c8
-rw-r--r--driver/subprocs.c62
-rw-r--r--driver/timers.c2
-rw-r--r--driver/types.h6
-rw-r--r--driver/windows.c24
-rw-r--r--driver/xscreensaver.c12
-rw-r--r--driver/xscreensaver.h1
9 files changed, 129 insertions, 11 deletions
diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
index eec998f..7ffae10 100644
--- a/driver/XScreenSaver.ad.in
+++ b/driver/XScreenSaver.ad.in
@@ -38,6 +38,7 @@
*dpmsStandby: 2:00:00
*dpmsSuspend: 2:00:00
*dpmsOff: 4:00:00
+*dpmsFullThrottle: False
*grabDesktopImages: True
*grabVideoFrames: False
*chooseRandomImages: @DEFAULT_IMAGES_P@
@@ -139,6 +140,15 @@ GetViewPortIsFullOfLies: False
@NEW_LOGIN_COMMAND_P@*newLoginCommand: @NEW_LOGIN_COMMAND@
+! External command used to help xscreensaver aquire the mouse/keyboard
+! grab. (I.e. some script that makes VMware release it).
+! This is called before xscreensaver tries to aquire the grab with
+! "pre" as parameter, and again with "post" after xscreensaver is done
+! (trying to) aquire the grab.
+!
+*externalUngrabCommand:
+
+
! Turning on "installColormap" on 8-bit systems interacts erratically with
! certain jurassic window managers. If your screen turns some color other
! than black, the window manager is buggy, and you need to set this resource
diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h
index 2d7b168..238901a 100644
--- a/driver/XScreenSaver_ad.h
+++ b/driver/XScreenSaver_ad.h
@@ -11,10 +11,11 @@
"*dpmsStandby: 2:00:00",
"*dpmsSuspend: 2:00:00",
"*dpmsOff: 4:00:00",
+"*dpmsFullThrottle: False",
"*grabDesktopImages: True",
"*grabVideoFrames: False",
"*chooseRandomImages: True",
-"*imageDirectory: /Library/Desktop Pictures/",
+"*imageDirectory: /usr/share/wallpapers/",
"*nice: 10",
"*memoryLimit: 0",
"*lock: False",
@@ -32,7 +33,7 @@
"*authWarningSlack: 20",
"*textMode: file",
"*textLiteral: XScreenSaver",
-"*textFile: ",
+"*textFile: /usr/share/doc/xserver-common/copyright",
"*textProgram: fortune",
"*textURL: https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss",
"*overlayTextForeground: #FFFF00",
@@ -47,10 +48,12 @@
"*demoCommand: xscreensaver-demo",
"*prefsCommand: xscreensaver-demo -prefs",
"*helpURL: https://www.jwz.org/xscreensaver/man.html",
-"*loadURL: firefox '%s' || mozilla '%s' || netscape '%s'",
-"*manualCommand: xterm -sb -fg black -bg gray75 -T '%s manual' \
- -e /bin/sh -c 'man \"%s\" ; read foo'",
+"*loadURL: gnome-open '%s'",
+"*manualCommand: gnome-terminal --title '%s manual' \
+ --command '/bin/sh -c \"man %s; read foo\"'",
"*dateFormat: %d-%b-%y (%a); %I:%M %p",
+"*newLoginCommand: dm-tool switch-to-greeter",
+"*externalUngrabCommand: ",
"*installColormap: True",
"*programs: \
maze -root \\n\
@@ -127,7 +130,7 @@
compass -root \\n\
deluxe -root \\n\
- demon -root \\n\
- GL: extrusion -root \\n\
+- GL: extrusion -root \\n\
- loop -root \\n\
penetrate -root \\n\
petri -root \\n\
diff --git a/driver/prefs.c b/driver/prefs.c
index 8fb029e..ec5583b 100644
--- a/driver/prefs.c
+++ b/driver/prefs.c
@@ -265,6 +265,7 @@ static const char * const prefs[] = {
"helpURL", /* not saved */
"loadURL", /* not saved */
"newLoginCommand", /* not saved */
+ "externalUngrabCommand", /* not saved */
"nice",
"memoryLimit",
"fade",
@@ -281,6 +282,7 @@ static const char * const prefs[] = {
"dpmsStandby",
"dpmsSuspend",
"dpmsOff",
+ "dpmsFullThrottle",
"grabDesktopImages",
"grabVideoFrames",
"chooseRandomImages",
@@ -805,6 +807,7 @@ write_init_file (Display *dpy,
CHECK("loadURL") continue; /* don't save */
/* CHECK("newLoginCommand") type = pref_str, s = p->new_login_command; */
CHECK("newLoginCommand") continue; /* don't save */
+ CHECK("externalUngrabCommand") continue; /* don't save */
CHECK("nice") type = pref_int, i = p->nice_inferior;
CHECK("memoryLimit") type = pref_byte, i = p->inferior_memory_limit;
CHECK("fade") type = pref_bool, b = p->fade_p;
@@ -824,6 +827,7 @@ write_init_file (Display *dpy,
CHECK("dpmsStandby") type = pref_time, t = p->dpms_standby;
CHECK("dpmsSuspend") type = pref_time, t = p->dpms_suspend;
CHECK("dpmsOff") type = pref_time, t = p->dpms_off;
+ CHECK("dpmsFullThrottle") continue; /* don't save */
CHECK("grabDesktopImages") type =pref_bool, b = p->grab_desktop_p;
CHECK("grabVideoFrames") type =pref_bool, b = p->grab_video_p;
@@ -1082,6 +1086,7 @@ load_init_file (Display *dpy, saver_preferences *p)
p->dpms_standby = 1000 * get_minutes_resource (dpy, "dpmsStandby", "Time");
p->dpms_suspend = 1000 * get_minutes_resource (dpy, "dpmsSuspend", "Time");
p->dpms_off = 1000 * get_minutes_resource (dpy, "dpmsOff", "Time");
+ p->dpms_full_throttle_p = get_boolean_resource (dpy, "dpmsFullThrottle", "Boolean");
p->grab_desktop_p = get_boolean_resource (dpy, "grabDesktopImages", "Boolean");
p->grab_video_p = get_boolean_resource (dpy, "grabVideoFrames", "Boolean");
@@ -1104,6 +1109,9 @@ load_init_file (Display *dpy, saver_preferences *p)
p->new_login_command = get_string_resource(dpy,
"newLoginCommand",
"NewLoginCommand");
+ p->external_ungrab_command = get_string_resource(dpy,
+ "externalUngrabCommand",
+ "ExternalUngrabCommand");
p->auth_warning_slack = get_integer_resource(dpy, "authWarningSlack",
"Integer");
diff --git a/driver/subprocs.c b/driver/subprocs.c
index 4f327e9..9f4b075 100644
--- a/driver/subprocs.c
+++ b/driver/subprocs.c
@@ -916,6 +916,66 @@ fork_and_exec (saver_screen_info *ssi, const char *command)
}
+/* Execute command in another process and wait for it to
+ * finish. Return exit code of process, or -1 on error
+ * with fork() or exec().
+ */
+int
+exec_and_wait (saver_info *si, const char *command)
+{
+ pid_t forked;
+ saver_preferences *p = &si->prefs;
+
+ switch ((int) (forked = fork ()))
+ {
+ case -1:
+ {
+ char buf [255];
+ sprintf (buf, "%s: couldn't fork", blurb());
+ perror (buf);
+ return -1;
+ }
+
+ case 0:
+ close (ConnectionNumber (si->dpy)); /* close display fd */
+ limit_subproc_memory (p->inferior_memory_limit, p->verbose_p);
+
+ if (p->verbose_p)
+ fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n",
+ blurb(), command,
+ (unsigned long) getpid ());
+
+ exec_command (p->shell, command, 0);
+
+ /* If that returned, we were unable to exec the subprocess.
+ Print an error message, if desired.
+ */
+ print_path_error (command);
+
+ exit (-1); /* exits child fork */
+ break;
+
+ default: /* parent */
+ {
+ pid_t retpid;
+ int wstatus;
+ while ((retpid = waitpid (forked, &wstatus, 0)) == -1) {
+ if (errno == EINTR)
+ continue;
+ perror ("Could not waitpid for child.");
+ return -1;
+ }
+ if (WIFEXITED(wstatus))
+ return WEXITSTATUS(wstatus);
+ if (WIFSIGNALED(wstatus))
+ return WTERMSIG(wstatus) + 128;
+ return -1;
+ }
+ }
+ return -1;
+}
+
+
void
spawn_screenhack (saver_screen_info *ssi)
{
@@ -923,7 +983,7 @@ spawn_screenhack (saver_screen_info *ssi)
saver_preferences *p = &si->prefs;
XFlush (si->dpy);
- if (!monitor_powered_on_p (si))
+ if (!p->dpms_full_throttle_p && !monitor_powered_on_p (si))
{
if (si->prefs.verbose_p)
fprintf (stderr,
diff --git a/driver/timers.c b/driver/timers.c
index ea97f34..fc8b47a 100644
--- a/driver/timers.c
+++ b/driver/timers.c
@@ -1657,7 +1657,7 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
raise_window (si, True, True, running_p);
}
- if (screenhack_running_p (si) &&
+ if (!p->dpms_full_throttle_p && screenhack_running_p (si) &&
!monitor_powered_on_p (si))
{
int i;
diff --git a/driver/types.h b/driver/types.h
index f1630b0..93c6731 100644
--- a/driver/types.h
+++ b/driver/types.h
@@ -137,6 +137,7 @@ struct saver_preferences {
Time dpms_standby; /* how long until monitor goes black */
Time dpms_suspend; /* how long until monitor power-saves */
Time dpms_off; /* how long until monitor powers down */
+ Bool dpms_full_throttle_p; /* Never kill or suspend hack when screen is off */
Bool grab_desktop_p; /* These are not used by "xscreensaver" */
Bool grab_video_p; /* itself: they are used by the external */
@@ -164,6 +165,11 @@ struct saver_preferences {
char *help_url; /* Where the help document resides. */
char *load_url_command; /* How one loads URLs. */
char *new_login_command; /* Command for the "New Login" button. */
+ char *external_ungrab_command; /* Command that's supposed to make sure
+ nobody is holding the keyboard or
+ mouse grab. Called with params
+ "pre" and "post" before and after
+ trying to get the grab. */
int auth_warning_slack; /* Don't warn about login failures if they
all happen within this many seconds of
diff --git a/driver/windows.c b/driver/windows.c
index 9b2bf84..c54f15e 100644
--- a/driver/windows.c
+++ b/driver/windows.c
@@ -235,7 +235,7 @@ ungrab_keyboard_and_mouse (saver_info *si)
static Bool
-grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor,
+grab_keyboard_and_mouse_real (saver_info *si, Window window, Cursor cursor,
int screen_no)
{
Status mstatus = 0, kstatus = 0;
@@ -320,6 +320,28 @@ grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor,
}
+static Bool
+grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor,
+ int screen_no)
+{
+ Bool ret;
+ char *euc = si->prefs.external_ungrab_command;
+ char cmd[200];
+ if (euc && *euc)
+ {
+ snprintf (cmd, sizeof(cmd), "%s %s", euc, "pre");
+ exec_and_wait (si, cmd);
+ }
+ ret = grab_keyboard_and_mouse_real (si, window, cursor, screen_no);
+ if (euc && *euc)
+ {
+ snprintf (cmd, sizeof(cmd), "%s %s", euc, "post");
+ exec_and_wait (si, cmd);
+ }
+ return ret;
+}
+
+
int
move_mouse_grab (saver_info *si, Window to, Cursor cursor, int to_screen_no)
{
diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
index abcb07f..df816f9 100644
--- a/driver/xscreensaver.c
+++ b/driver/xscreensaver.c
@@ -1384,8 +1384,16 @@ main_loop (saver_info *si)
was_locked = True;
si->dbox_up_p = True;
- for (i = 0; i < si->nscreens; i++)
- suspend_screenhack (&si->screens[i], True); /* suspend */
+ if (p->dpms_full_throttle_p)
+ {
+ for (i = 0; i < si->nscreens; i++)
+ if (si->screens[i].pid == 0)
+ spawn_screenhack (&si->screens[i]);
+ usleep(100000);
+ }
+ else
+ for (i = 0; i < si->nscreens; i++)
+ suspend_screenhack (&si->screens[i], True); /* suspend */
XUndefineCursor (si->dpy, ssi->screensaver_window);
ok_to_unblank = unlock_p (si);
diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
index 42cf794..c5b5644 100644
--- a/driver/xscreensaver.h
+++ b/driver/xscreensaver.h
@@ -157,6 +157,7 @@ extern void hack_subproc_environment (Screen *, Window saver_window);
extern void init_sigchld (void);
extern void spawn_screenhack (saver_screen_info *ssi);
extern pid_t fork_and_exec (saver_screen_info *ssi, const char *command);
+extern int exec_and_wait (saver_info *si, const char *command);
extern void kill_screenhack (saver_screen_info *ssi);
extern void suspend_screenhack (saver_screen_info *ssi, Bool suspend_p);
extern Bool screenhack_running_p (saver_info *si);