|
1 Various fixes to deal with how & where we install things on Solaris: |
|
2 |
|
3 - Only run hacks from the hacks dir, not $PATH |
|
4 |
|
5 - Find helper programs even though they are not in $PATH |
|
6 |
|
7 - Show author names when reading RSS feeds from sites like blogs.sun.com |
|
8 |
|
9 - Show Solaris package names in demo app when hacks are not installed |
|
10 |
|
11 - Use gnome-help to display man pages nicely, without requiring internet |
|
12 access (which some customers at secure sites won't have configured), |
|
13 instead of opening a web browser to view the man page at jwz.org or |
|
14 opening a gnome-terminal to run the man command. |
|
15 |
|
16 Mostly not acceptable upstream. |
|
17 |
|
18 Backport notes: this change relies on the gnome-help version delivered in |
|
19 Nevada that supports "man:xscreensaver" style URL's to display man pages. |
|
20 When backporting to older releases you will probably want to uncomment the |
|
21 lines shown for GNOME 2.4/2.6. |
|
22 |
|
23 Also, you'll need to fix the package names shown when the hacks are not |
|
24 installed to be the older SUNWxscreensaver-* for Solaris 10 & older. |
|
25 --- |
|
26 driver/Makefile.in | 9 ++++-- |
|
27 driver/XScreenSaver.ad.in | 14 +++++++--- |
|
28 driver/demo-Gtk.c | 4 +- |
|
29 driver/subprocs.c | 54 +++++++++++++++++++++++++++++++++++++- |
|
30 driver/xscreensaver-demo.glade2 | 8 +++-- |
|
31 driver/xscreensaver-text | 6 +++- |
|
32 driver/xscreensaver.man | 5 +-- |
|
33 hacks/glx/Makefile.in | 4 +- |
|
34 8 files changed, 84 insertions(+), 20 deletions(-) |
|
35 |
|
36 diff --git a/driver/Makefile.in b/driver/Makefile.in |
|
37 --- a/driver/Makefile.in |
|
38 +++ b/driver/Makefile.in |
|
39 @@ -27,7 +27,7 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ |
|
40 GTK_DATADIR = @GTK_DATADIR@ |
|
41 GTK_APPDIR = $(GTK_DATADIR)/applications |
|
42 GTK_ICONDIR = $(GTK_DATADIR)/pixmaps |
|
43 -GTK_GLADEDIR = $(GTK_DATADIR)/xscreensaver/glade |
|
44 +GTK_GLADEDIR = $(prefix)/lib/xscreensaver/config |
|
45 HACK_CONF_DIR = @HACK_CONF_DIR@ |
|
46 |
|
47 CC = @CC@ |
|
48 @@ -36,8 +36,11 @@ CFLAGS = @CFLAGS@ |
|
49 LDFLAGS = @LDFLAGS@ |
|
50 DEFS = @DEFS@ |
|
51 INTL_DEFS = -DLOCALEDIR=\"$(localedir)\" |
|
52 -SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' |
|
53 -GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' |
|
54 +SUBP_DEFS = $(DEFS) -DHACK_PATH='"@HACKDIR@"' \ |
|
55 + -DDEFAULT_PATH_PREFIX='"@HACKDIR@:$(libexecdir)"' \ |
|
56 + -DHELPER_PATH='"$(libexecdir)"' |
|
57 +GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \ |
|
58 + -DBINDIR='"$(bindir)"' |
|
59 CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' |
|
60 |
|
61 LIBS = @LIBS@ |
|
62 diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in |
|
63 --- a/driver/XScreenSaver.ad.in |
|
64 +++ b/driver/XScreenSaver.ad.in |
|
65 @@ -91,18 +91,24 @@ GetViewPortIsFullOfLies: False |
|
66 |
|
67 ! This is the URL loaded by the "Help" button on the splash screen, |
|
68 ! and by the "Documentation" menu item in xscreensaver-demo. |
|
69 -*helpURL: http://www.jwz.org/xscreensaver/man.html |
|
70 +*helpURL: man:xscreensaver |
|
71 |
|
72 ! loadURL -- how the "Help" buttons load the helpURL (/bin/sh syntax.) |
|
73 ! manualCommand -- how the "Documentation" buttons display man pages. |
|
74 ! |
|
75 ! And there are so very many options to choose from! |
|
76 ! |
|
77 +! Modern GNOME: |
|
78 +! |
|
79 +*loadURL: gnome-help '%s' |
|
80 +*manualCommand: gnome-help 'man:%s' |
|
81 +! |
|
82 ! Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3) |
|
83 ! |
|
84 -@GNOME24@*loadURL: @WITH_BROWSER@ '%s' |
|
85 -@GNOME24@*manualCommand: gnome-terminal --title '%s manual' \ |
|
86 -@GNOME24@ --command '/bin/sh -c "man %s; read foo"' |
|
87 +!*loadURL: gnome-terminal --title 'xscreensaver manual' \ |
|
88 +! --command '/bin/ksh -c "man xscreensaver; read foo"' |
|
89 +!*manualCommand: gnome-terminal --title '%s manual' \ |
|
90 +! --command '/bin/ksh -c "man %s; read foo"' |
|
91 ! |
|
92 ! Gnome 2.2: |
|
93 ! |
|
94 diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c |
|
95 --- a/driver/demo-Gtk.c |
|
96 +++ b/driver/demo-Gtk.c |
|
97 @@ -991,7 +991,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data) |
|
98 flush_dialog_changes_and_save (s); |
|
99 xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL); |
|
100 sleep (1); |
|
101 - if (system ("xscreensaver -nosplash &") < 0) |
|
102 + if (system (BINDIR "/xscreensaver -nosplash &") < 0) |
|
103 fprintf (stderr, "%s: fork error\n", blurb()); |
|
104 |
|
105 await_xscreensaver (s); |
|
106 @@ -4951,7 +4951,7 @@ main (int argc, char **argv) |
|
107 |
|
108 if (init_results == 1) |
|
109 { |
|
110 - system ("xscreensaver -nosplash &"); |
|
111 + system (BINDIR "/xscreensaver -nosplash &"); |
|
112 return 0; |
|
113 } |
|
114 |
|
115 diff --git a/driver/subprocs.c b/driver/subprocs.c |
|
116 --- a/driver/subprocs.c |
|
117 +++ b/driver/subprocs.c |
|
118 @@ -14,6 +14,7 @@ |
|
119 # include "config.h" |
|
120 #endif |
|
121 |
|
122 +#include <sys/stat.h> |
|
123 #include <ctype.h> |
|
124 #include <stdio.h> |
|
125 #include <string.h> |
|
126 @@ -791,6 +792,8 @@ print_path_error (const char *program) |
|
127 free (cmd); |
|
128 perror (buf); |
|
129 |
|
130 +/* mali - security issue do not want to display user's path */ |
|
131 +#ifdef EXPOSE_USER_PATH |
|
132 if (errno == ENOENT && |
|
133 (token = getenv("PATH"))) |
|
134 { |
|
135 @@ -821,6 +824,7 @@ print_path_error (const char *program) |
|
136 } |
|
137 fprintf (stderr, "\n"); |
|
138 } |
|
139 +#endif |
|
140 } |
|
141 |
|
142 |
|
143 @@ -877,12 +881,42 @@ fork_and_exec (saver_screen_info *ssi, const char *command) |
|
144 return forked; |
|
145 } |
|
146 |
|
147 +static Bool |
|
148 +check_if_hacks_dir_exists(Bool verbose_p) |
|
149 +{ |
|
150 + const char hackdir[] = HACK_PATH; |
|
151 + |
|
152 + int status; |
|
153 + struct stat st; |
|
154 + |
|
155 + status = stat (hackdir, &st); |
|
156 + |
|
157 + if (status == 0 && S_ISDIR(st.st_mode)) |
|
158 + { |
|
159 + return True; |
|
160 + } |
|
161 + else |
|
162 + { |
|
163 + if (verbose_p) |
|
164 + { |
|
165 + fprintf(stderr, |
|
166 + "%s: Warning: dir: %s missing. Will not run hacks\n", |
|
167 + blurb(), hackdir); |
|
168 + } |
|
169 + return False; |
|
170 + } |
|
171 +} |
|
172 |
|
173 void |
|
174 spawn_screenhack (saver_screen_info *ssi) |
|
175 { |
|
176 saver_info *si = ssi->global; |
|
177 saver_preferences *p = &si->prefs; |
|
178 + char* complete_hack_command; |
|
179 + |
|
180 + if (si->prefs.verbose_p) |
|
181 + fprintf(stderr, "--> spawn_screenhack()\n"); |
|
182 + |
|
183 XFlush (si->dpy); |
|
184 |
|
185 if (!monitor_powered_on_p (si)) |
|
186 @@ -962,6 +996,12 @@ spawn_screenhack (saver_screen_info *ssi) |
|
187 ; |
|
188 } |
|
189 |
|
190 + if ((new_hack >= 0) && |
|
191 + (check_if_hacks_dir_exists(p->verbose_p) == False)) |
|
192 + { |
|
193 + new_hack = -1; |
|
194 + } |
|
195 + |
|
196 if (new_hack < 0) /* don't run a hack */ |
|
197 { |
|
198 ssi->current_hack = -1; |
|
199 @@ -1009,7 +1049,17 @@ spawn_screenhack (saver_screen_info *ssi) |
|
200 if (si->selection_mode < 0) |
|
201 si->selection_mode = 0; |
|
202 |
|
203 - forked = fork_and_exec (ssi, hack->command); |
|
204 + /* We need complete path to hack command else any executable |
|
205 + * with the same name in the path gets executed. |
|
206 + */ |
|
207 + complete_hack_command = malloc (10 + strlen(hack->command) + |
|
208 + strlen (HACK_PATH)); |
|
209 + sprintf(complete_hack_command, HACK_PATH"/%s", hack->command); |
|
210 + |
|
211 + |
|
212 + forked = fork_and_exec (ssi, complete_hack_command); |
|
213 + free (complete_hack_command); |
|
214 + |
|
215 switch ((int) forked) |
|
216 { |
|
217 case -1: /* fork failed */ |
|
218 @@ -1186,7 +1236,7 @@ get_best_gl_visual (saver_info *si, Screen *screen) |
|
219 char *av[10]; |
|
220 int ac = 0; |
|
221 |
|
222 - av[ac++] = "xscreensaver-gl-helper"; |
|
223 + av[ac++] = HELPER_PATH "/xscreensaver-gl-helper"; |
|
224 av[ac] = 0; |
|
225 |
|
226 if (pipe (fds)) |
|
227 diff --git a/driver/xscreensaver-demo.glade2 b/driver/xscreensaver-demo.glade2 |
|
228 --- a/driver/xscreensaver-demo.glade2 |
|
229 +++ b/driver/xscreensaver-demo.glade2 |
|
230 @@ -927,6 +927,6 @@ Installed</property> |
|
231 <property name="visible">True</property> |
|
232 <property name="label" translatable="yes">Very few (or no) screen savers appear to be available. |
|
233 |
|
234 -This probably means that the "xscreensaver-extras" and |
|
235 -"xscreensaver-gl-extras" packages are not installed.</property> |
|
236 +This probably means that the “desktop/xscreensaver/hacks” and |
|
237 +“desktop/xscreensaver/hacks/hacks-gl” packages are not installed.</property> |
|
238 <property name="use_underline">False</property> |
|
239 <property name="use_markup">False</property> |
|
240 <property name="justify">GTK_JUSTIFY_CENTER</property> |
|
241 diff --git a/driver/xscreensaver-text b/driver/xscreensaver-text |
|
242 --- a/driver/xscreensaver-text |
|
243 +++ b/driver/xscreensaver-text |
|
244 @@ -698,12 +698,15 @@ sub reformat_rss($) { |
|
245 $i++; |
|
246 |
|
247 my ($title, $body1, $body2, $body3); |
|
248 + my $author; |
|
249 |
|
250 $title = $3 if (m@<((TITLE) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
251 $body1 = $3 if (m@<((DESCRIPTION) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
252 $body2 = $3 if (m@<((CONTENT) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
253 $body3 = $3 if (m@<((SUMMARY) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
254 |
|
255 + $author = $3 if (m@<((DC:CREATOR) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi); |
|
256 + |
|
257 # If there are both <description> and <content> or <content:encoded>, |
|
258 # use whichever one contains more text. |
|
259 # |
|
260 @@ -727,10 +730,11 @@ sub reformat_rss($) { |
|
261 |
|
262 $title = rss_field_to_html ($title || ''); |
|
263 $body1 = rss_field_to_html ($body1 || ''); |
|
264 + $author = rss_field_to_html ($author || ''); |
|
265 |
|
266 $title = '' if ($body1 eq $title); # Identical in Twitter's atom feed. |
|
267 |
|
268 - reformat_html ("$title<P>$body1", 1); |
|
269 + reformat_html ("$title<BR>$author<P>$body1", 1); |
|
270 print "\n"; |
|
271 } |
|
272 } |
|
273 diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man |
|
274 --- a/driver/xscreensaver.man |
|
275 +++ b/driver/xscreensaver.man |
|
276 @@ -97,9 +97,8 @@ xscreensaver-command -restart |
|
277 If you want to set the system-wide defaults, then make your edits to |
|
278 the xscreensaver app-defaults file, which should have been installed |
|
279 when xscreensaver itself was installed. The app-defaults file will |
|
280 -usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different |
|
281 -systems might keep it in a different place (for example, |
|
282 -/usr/openwin/lib/app-defaults/XScreenSaver on Solaris.) |
|
283 +usually be named /usr/share/X11/app-defaults/XScreenSaver, but different |
|
284 +systems might keep it in a different place. |
|
285 |
|
286 When settings are changed in the Preferences dialog box (see above) |
|
287 the current settings will be written to the \fI.xscreensaver\fP file. |
|
288 diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in |
|
289 --- a/hacks/glx/Makefile.in |
|
290 +++ b/hacks/glx/Makefile.in |
|
291 @@ -278,7 +278,7 @@ install-program:: $(EXES) |
|
292 # the xscreensaver-gl-helper program, in $bindir |
|
293 install-program:: $(EXES) |
|
294 @exes="@GL_UTIL_EXES@" ; \ |
|
295 - idir="$(install_prefix)$(bindir)" ; \ |
|
296 + idir="$(install_prefix)$(libexecdir)" ; \ |
|
297 if [ "$$exes" != "" ]; then \ |
|
298 if [ ! -d $$idir ]; then \ |
|
299 $(INSTALL_DIRS) $$idir ; \ |
|
300 @@ -347,7 +347,7 @@ uninstall-program:: |
|
301 # the xscreensaver-gl-helper program, in $bindir |
|
302 uninstall-program:: |
|
303 @exes="$(GL_UTIL_EXES)" ; \ |
|
304 - idir="$(install_prefix)$(bindir)" ; \ |
|
305 + idir="$(install_prefix)$(libexecdir)" ; \ |
|
306 for program in $$exes; do \ |
|
307 echo rm -f $$idir/$$program ; \ |
|
308 rm -f $$idir/$$program ; \ |
|
309 |