1
/* xscreensaver, Copyright (c) 1992, 1996, 1997, 1998
1
/* xscreensaver, Copyright (c) 1992, 1996, 1997, 1998, 2005
2
2
* Jamie Zawinski <jwz@jwz.org>
4
4
* Permission to use, copy, modify, distribute, and sell this software and its
32
33
static char *get_words (void);
34
35
static XFontStruct *font;
35
static char *def_words = "I'm out running around.";
36
36
static void walk (int dir);
37
37
static void talk (int erase);
38
38
static void talk_1 (void);
57
56
static void (*next_fn) (void);
58
#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM)
62
59
# include "images/noseguy/nose-f1.xpm"
63
60
# include "images/noseguy/nose-f2.xpm"
64
61
# include "images/noseguy/nose-f3.xpm"
86
83
&left_front, &right_front, &front, &down
86
#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM)
90
88
static char **bits[] = {
91
89
nose_l1_xpm, nose_l2_xpm, nose_r1_xpm, nose_r2_xpm,
92
90
nose_f2_xpm, nose_f3_xpm, nose_f1_xpm, nose_f4_xpm
94
94
for (i = 0; i < sizeof (images) / sizeof(*images); i++)
96
XWindowAttributes xgwa;
97
XpmAttributes xpmattrs;
100
xpmattrs.valuemask = 0;
102
XGetWindowAttributes (dpy, window, &xgwa);
105
xpmattrs.valuemask |= XpmCloseness;
106
xpmattrs.closeness = 40000;
109
xpmattrs.valuemask |= XpmVisual;
110
xpmattrs.visual = xgwa.visual;
113
xpmattrs.valuemask |= XpmDepth;
114
xpmattrs.depth = xgwa.depth;
117
xpmattrs.valuemask |= XpmColormap;
118
xpmattrs.colormap = xgwa.colormap;
121
result = XpmCreatePixmapFromData(dpy, window, bits[i],
122
&pixmap, 0 /* mask */, &xpmattrs);
123
if (!pixmap || (result != XpmSuccess && result != XpmColorError))
96
Pixmap pixmap = xpm_data_to_pixmap (dpy, window, bits[i],
125
100
fprintf (stderr, "%s: Can't load nose images\n", progname);
386
367
(void) strcpy(args[height], p);
387
368
if (height == MAXLINES - 1)
389
puts("Message too long!");
370
/* puts("Message too long!"); */
472
453
init_words (void)
474
char *mode = get_string_resource ("mode", "Mode");
476
455
program = get_string_resource ("program", "Program");
477
456
filename = get_string_resource ("filename", "Filename");
478
457
text = get_string_resource ("text", "Text");
486
465
strcat (program, " ) 2>&1");
489
if (!mode || !strcmp (mode, "program"))
490
getwordsfrom = FROM_PROGRAM;
491
else if (!strcmp (mode, "file"))
492
getwordsfrom = FROM_FILE;
493
else if (!strcmp (mode, "string"))
494
getwordsfrom = FROM_RESRC;
498
"%s: mode must be program, file, or string, not %s\n",
503
if (getwordsfrom == FROM_PROGRAM && !program)
505
fprintf (stderr, "%s: no program specified.\n", progname);
508
if (getwordsfrom == FROM_FILE && !filename)
510
fprintf (stderr, "%s: no file specified.\n", progname);
514
468
words = get_words();
578
if ((pp = fopen(filename, "r")))
580
while (fgets(p, sizeof(buf) - strlen(buf), pp))
582
if (strlen(buf) + 1 < sizeof(buf))
583
p = buf + strlen(buf);
589
sprintf (buf, "file \"%s\" is empty!", filename);
594
sprintf (buf, "couldn't read file \"%s\"!", filename);
606
if (!p || *p == '\0')
613
530
char *progclass = "Noseguy";
615
532
char *defaults [] = {
616
".background: black",
617
".foreground: gray80",
623
"*program: " ZIPPY_PROGRAM,
624
"noseguy.font: -*-new century schoolbook-*-r-*-*-*-180-*-*-*-*-*-*",
533
".background: black",
534
".foreground: gray80",
535
"*program: xscreensaver-text --cols 40 | head -15",
536
"noseguy.font: -*-new century schoolbook-*-r-*-*-*-180-*-*-*-*-*-*",