/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
Various fixes to deal with where we install things on Solaris:
- Only run hacks from the hacks dir, not $PATH
- Find helper programs even though they are not in $PATH
- Show author names when reading RSS feeds from sites like blogs.sun.com
- Show Solaris package names in demo app when hacks are not installed
- Use gnome-help to display man pages nicely, without requiring internet
access (which some customers at secure sites won't have configured),
instead of opening a web browser to view the man page at jwz.org or
opening a gnome-terminal to run the man command.
Backport notes: this change relies on the gnome-help version delivered in
Nevada that supports "man:xscreensaver" style URL's to display man pages.
When backporting to older releases you will probably want to uncomment the
lines shown for GNOME 2.4/2.6.
Also, you'll need to fix the package names shown when the hacks are not
installed to be the older SUNWxscreensaver-*, and to not use the a href
markup links added in newer gtk versions, nor link to IPS .p5i files to
install the packages.
---
driver/Makefile.in | 9 ++++--
driver/XScreenSaver.ad.in | 14 +++++++---
driver/demo-Gtk.c | 4 +-
driver/subprocs.c | 54 +++++++++++++++++++++++++++++++++++++-
driver/xscreensaver-demo.glade2 | 8 +++--
driver/xscreensaver-text | 6 +++-
driver/xscreensaver.man | 5 +--
hacks/glx/Makefile.in | 4 +-
8 files changed, 84 insertions(+), 20 deletions(-)
diff --git xscreensaver-5.12/driver/Makefile.in xscreensaver-5.12/driver/Makefile.in
--- xscreensaver-5.12/driver/Makefile.in
+++ xscreensaver-5.12/driver/Makefile.in
@@ -27,7 +27,7 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@
GTK_DATADIR = @GTK_DATADIR@
GTK_APPDIR = $(GTK_DATADIR)/applications
GTK_ICONDIR = $(GTK_DATADIR)/pixmaps
-GTK_GLADEDIR = $(GTK_DATADIR)/xscreensaver/glade
+GTK_GLADEDIR = $(prefix)/lib/xscreensaver/config
HACK_CONF_DIR = @HACK_CONF_DIR@
CC = @CC@
@@ -36,8 +36,11 @@ CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
INTL_DEFS = -DLOCALEDIR=\"$(localedir)\"
-SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"'
-GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"'
+SUBP_DEFS = $(DEFS) -DHACK_PATH='"@HACKDIR@"' \
+ -DDEFAULT_PATH_PREFIX='"@HACKDIR@:$(libexecdir)"' \
+ -DHELPER_PATH='"$(libexecdir)"'
+GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \
+ -DBINDIR='"$(bindir)"'
CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
LIBS = @LIBS@
diff --git xscreensaver-5.12/driver/XScreenSaver.ad.in xscreensaver-5.12/driver/XScreenSaver.ad.in
--- xscreensaver-5.12/driver/XScreenSaver.ad.in
+++ xscreensaver-5.12/driver/XScreenSaver.ad.in
@@ -87,18 +87,24 @@ GetViewPortIsFullOfLies: False
! This is the URL loaded by the "Help" button on the splash screen,
! and by the "Documentation" menu item in xscreensaver-demo.
-*helpURL: http://www.jwz.org/xscreensaver/man.html
+*helpURL: man:xscreensaver
! loadURL -- how the "Help" buttons load the helpURL (/bin/sh syntax.)
! manualCommand -- how the "Documentation" buttons display man pages.
!
! And there are so very many options to choose from!
!
+! Modern GNOME:
+!
+*loadURL: gnome-help '%s'
+*manualCommand: gnome-help 'man:%s'
+!
! Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3)
!
-@GNOME24@*loadURL: @WITH_BROWSER@ '%s'
-@GNOME24@*manualCommand: gnome-terminal --title '%s manual' \
-@GNOME24@ --command '/bin/sh -c "man %s; read foo"'
+!*loadURL: gnome-terminal --title 'xscreensaver manual' \
+! --command '/bin/ksh -c "man xscreensaver; read foo"'
+!*manualCommand: gnome-terminal --title '%s manual' \
+! --command '/bin/ksh -c "man %s; read foo"'
!
! Gnome 2.2:
!
diff --git xscreensaver-5.12/driver/demo-Gtk.c xscreensaver-5.12/driver/demo-Gtk.c
--- xscreensaver-5.12/driver/demo-Gtk.c
+++ xscreensaver-5.12/driver/demo-Gtk.c
@@ -990,7 +990,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data)
flush_dialog_changes_and_save (s);
xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL);
sleep (1);
- if (system ("xscreensaver -nosplash &") < 0)
+ if (system (BINDIR "/xscreensaver -nosplash &") < 0)
fprintf (stderr, "%s: fork error\n", blurb());
await_xscreensaver (s);
@@ -4933,7 +4933,7 @@ main (int argc, char **argv)
if (init_results == 1)
{
- system ("xscreensaver -nosplash &");
+ system (BINDIR "/xscreensaver -nosplash &");
return 0;
}
diff --git xscreensaver-5.12/driver/subprocs.c xscreensaver-5.12/driver/subprocs.c
--- xscreensaver-5.12/driver/subprocs.c
+++ xscreensaver-5.12/driver/subprocs.c
@@ -14,6 +14,7 @@
# include "config.h"
#endif
+#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -791,6 +792,8 @@ print_path_error (const char *program)
free (cmd);
perror (buf);
+/* mali - security issue do not want to display user's path */
+#ifdef EXPOSE_USER_PATH
if (errno == ENOENT &&
(token = getenv("PATH")))
{
@@ -821,6 +824,7 @@ print_path_error (const char *program)
}
fprintf (stderr, "\n");
}
+#endif
}
@@ -877,12 +881,42 @@ fork_and_exec (saver_screen_info *ssi, const char *command)
return forked;
}
+static Bool
+check_if_hacks_dir_exists(Bool verbose_p)
+{
+ const char hackdir[] = HACK_PATH;
+
+ int status;
+ struct stat st;
+
+ status = stat (hackdir, &st);
+
+ if (status == 0 && S_ISDIR(st.st_mode))
+ {
+ return True;
+ }
+ else
+ {
+ if (verbose_p)
+ {
+ fprintf(stderr,
+ "%s: Warning: dir: %s missing. Will not run hacks\n",
+ blurb(), hackdir);
+ }
+ return False;
+ }
+}
void
spawn_screenhack (saver_screen_info *ssi)
{
saver_info *si = ssi->global;
saver_preferences *p = &si->prefs;
+ char* complete_hack_command;
+
+ if (si->prefs.verbose_p)
+ fprintf(stderr, "--> spawn_screenhack()\n");
+
XFlush (si->dpy);
if (!monitor_powered_on_p (si))
@@ -962,6 +996,12 @@ spawn_screenhack (saver_screen_info *ssi)
;
}
+ if ((new_hack >= 0) &&
+ (check_if_hacks_dir_exists(p->verbose_p) == False))
+ {
+ new_hack = -1;
+ }
+
if (new_hack < 0) /* don't run a hack */
{
ssi->current_hack = -1;
@@ -1009,7 +1049,17 @@ spawn_screenhack (saver_screen_info *ssi)
if (si->selection_mode < 0)
si->selection_mode = 0;
- forked = fork_and_exec (ssi, hack->command);
+ /* We need complete path to hack command else any executable
+ * with the same name in the path gets executed.
+ */
+ complete_hack_command = malloc (10 + strlen(hack->command) +
+ strlen (HACK_PATH));
+ sprintf(complete_hack_command, HACK_PATH"/%s", hack->command);
+
+
+ forked = fork_and_exec (ssi, complete_hack_command);
+ free (complete_hack_command);
+
switch ((int) forked)
{
case -1: /* fork failed */
@@ -1186,7 +1236,7 @@ get_best_gl_visual (saver_info *si, Screen *screen)
char *av[10];
int ac = 0;
- av[ac++] = "xscreensaver-gl-helper";
+ av[ac++] = HELPER_PATH "/xscreensaver-gl-helper";
av[ac] = 0;
if (pipe (fds))
diff --git xscreensaver-5.12/driver/xscreensaver-demo.glade2 xscreensaver-5.12/driver/xscreensaver-demo.glade2
--- xscreensaver-5.12/driver/xscreensaver-demo.glade2
+++ xscreensaver-5.12/driver/xscreensaver-demo.glade2
@@ -927,10 +927,12 @@ Installed</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Very few (or no) screen savers appear to be available.
-This probably means that the &quot;xscreensaver-extras&quot; and
-&quot;xscreensaver-gl-extras&quot; packages are not installed.</property>
+This probably means that the “&lt;a href="file:/usr/lib/xscreensaver/config/xscreensaver-hacks.p5i"&gt;desktop/xscreensaver/hacks&lt;/a&gt;,”
+“&lt;a href="file:/usr/lib/xscreensaver/config/xscreensaver-hacks-gl.p5i"&gt;desktop/xscreensaver/hacks/hacks-gl&lt;/a&gt;,” and
+“&lt;a href="file:/usr/lib/xscreensaver/config/rss-glx.p5i"&gt;desktop/xscreensaver/hacks/rss-glx&lt;/a&gt;” packages
+are not installed.</property>
<property name="use_underline">False</property>
- <property name="use_markup">False</property>
+ <property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
diff --git xscreensaver-5.12/driver/xscreensaver-text xscreensaver-5.12/driver/xscreensaver-text
--- xscreensaver-5.12/driver/xscreensaver-text
+++ xscreensaver-5.12/driver/xscreensaver-text
@@ -695,12 +695,15 @@ sub reformat_rss($) {
$i++;
my ($title, $body1, $body2, $body3);
+ my $author;
$title = $3 if (m@<((TITLE) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
$body1 = $3 if (m@<((DESCRIPTION) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
$body2 = $3 if (m@<((CONTENT) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
$body3 = $3 if (m@<((SUMMARY) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+ $author = $3 if (m@<((DC:CREATOR) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+
# If there are both <description> and <content> or <content:encoded>,
# use whichever one contains more text.
#
@@ -724,10 +727,11 @@ sub reformat_rss($) {
$title = rss_field_to_html ($title || '');
$body1 = rss_field_to_html ($body1 || '');
+ $author = rss_field_to_html ($author || '');
$title = '' if ($body1 eq $title); # Identical in Twitter's atom feed.
- reformat_html ("$title<P>$body1", 1);
+ reformat_html ("$title<BR>$author<P>$body1", 1);
print "\n";
}
}
diff --git xscreensaver-5.12/driver/xscreensaver.man xscreensaver-5.12/driver/xscreensaver.man
--- xscreensaver-5.12/driver/xscreensaver.man
+++ xscreensaver-5.12/driver/xscreensaver.man
@@ -97,9 +97,8 @@ xscreensaver-command -restart
If you want to set the system-wide defaults, then make your edits to
the xscreensaver app-defaults file, which should have been installed
when xscreensaver itself was installed. The app-defaults file will
-usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different
-systems might keep it in a different place (for example,
-/usr/openwin/lib/app-defaults/XScreenSaver on Solaris.)
+usually be named /usr/share/X11/app-defaults/XScreenSaver, but different
+systems might keep it in a different place.
When settings are changed in the Preferences dialog box (see above)
the current settings will be written to the \fI.xscreensaver\fP file.
diff --git xscreensaver-5.12/hacks/glx/Makefile.in xscreensaver-5.12/hacks/glx/Makefile.in
--- xscreensaver-5.12/hacks/glx/Makefile.in
+++ xscreensaver-5.12/hacks/glx/Makefile.in
@@ -270,7 +270,7 @@ install-program:: $(EXES)
# the xscreensaver-gl-helper program, in $bindir
install-program:: $(EXES)
@exes="@GL_UTIL_EXES@" ; \
- idir="$(install_prefix)$(bindir)" ; \
+ idir="$(install_prefix)$(libexecdir)" ; \
if [ "$$exes" != "" ]; then \
if [ ! -d $$idir ]; then \
$(INSTALL_DIRS) $$idir ; \
@@ -339,7 +339,7 @@ uninstall-program::
# the xscreensaver-gl-helper program, in $bindir
uninstall-program::
@exes="$(GL_UTIL_EXES)" ; \
- idir="$(install_prefix)$(bindir)" ; \
+ idir="$(install_prefix)$(libexecdir)" ; \
for program in $$exes; do \
echo rm -f $$idir/$$program ; \
rm -f $$idir/$$program ; \