#include <stdio.h>
#include <ctype.h>
#include <string.h>
+#include <time.h>
#include <sys/stat.h>
#include <sys/time.h>
"grabVideoFrames",
"chooseRandomImages",
"imageDirectory",
+ "mode",
+ "selected",
"",
"programs",
"",
CHECK("chooseRandomImages")type =pref_bool, b = p->random_image_p;
CHECK("imageDirectory") type =pref_str, s = p->image_directory;
+ CHECK("mode") type = pref_str,
+ s = (p->mode == ONE_HACK ? "one" :
+ p->mode == BLANK_ONLY ? "blank" :
+ p->mode == DONT_BLANK ? "off" :
+ "random");
+ CHECK("selected") type = pref_int, i = p->selected_hack;
+
CHECK("programs") type = pref_str, s = programs;
CHECK("pointerPollTime") type = pref_time, t = p->pointer_timeout;
CHECK("windowCreationTimeout")type=pref_time,t= p->notice_events_timeout;
abort();
break;
}
+
+ if (pr && !strcmp(pr, "mode")) fprintf(out, "\n");
+
write_entry (out, pr, s);
}
get_screenhacks (p);
+ p->selected_hack = get_integer_resource ("selected", "Integer");
+ if (p->selected_hack < 0 || p->selected_hack >= p->screenhacks_count)
+ p->selected_hack = -1;
+
+ {
+ char *s = get_string_resource ("mode", "Mode");
+ if (s && !strcasecmp (s, "one")) p->mode = ONE_HACK;
+ else if (s && !strcasecmp (s, "blank")) p->mode = BLANK_ONLY;
+ else if (s && !strcasecmp (s, "off")) p->mode = DONT_BLANK;
+ else p->mode = RANDOM_HACKS;
+ }
+
if (system_default_screenhack_count) /* note: first_time is also true */
{
merge_system_screenhacks (p, system_default_screenhacks,
format_hack (screenhack *hack, Bool wrap_p)
{
int tab = 32;
- int size = (2 * (strlen(hack->command) +
- (hack->visual ? strlen(hack->visual) : 0) +
- (hack->name ? strlen(hack->name) : 0) +
- tab));
- char *h2 = (char *) malloc (size);
- char *out = h2;
- char *s;
+ int size;
+ char *h2, *out, *s;
int col = 0;
+ char *def_name = make_hack_name (hack->command);
+
+ /* Don't ever write out a name for a hack if it's the same as the default.
+ */
+ if (hack->name && !strcmp (hack->name, def_name))
+ {
+ free (hack->name);
+ hack->name = 0;
+ }
+ free (def_name);
+
+ size = (2 * (strlen(hack->command) +
+ (hack->visual ? strlen(hack->visual) : 0) +
+ (hack->name ? strlen(hack->name) : 0) +
+ tab));
+ h2 = (char *) malloc (size);
+ out = h2;
+
if (!hack->enabled_p) *out++ = '-'; /* write disabled flag */
if (hack->visual && *hack->visual) /* write visual name */
col = string_columns (h2, strlen (h2), 0);
if (wrap_p && col >= tab)
- {
- out = stab_to (out, col, 77);
- *out += strlen(out);
- }
+ out = stab_to (out, col, 77);
else
*out++ = ' ';