4 * (c) 1998-2004 Alexey Vyskubov <alexey@mawhrin.net>
7 #include <stdio.h> /* puts() */
18 /* Let us make lint happy! */
19 #define lputs(x) (void)(puts(x))
24 static XImage
*stupid_picture
[5]; /* Icons for fookb */
34 static int get_one_image(char *name
, int index
, Display
*dpy
)
38 foo
= XpmReadFileToImage(dpy
, name
, &stupid_picture
[index
],
42 w
= stupid_picture
[index
]->width
;
44 lputs("FATAL: Icon1 has zero width!");
49 lputs("Warning: Icon width is more than 64. Strange things may happen.");
55 h
= stupid_picture
[index
]->height
;
57 lputs("FATAL: Icon1 had zero height!");
62 lputs("Warning: Icon height is more than 64. Strange things may happen.");
67 if (w
!= stupid_picture
[index
]->width
) {
68 lputs("FATAL: Not all icons are of the same width!");
72 if (h
!= stupid_picture
[index
]->height
) {
73 lputs("FATAL: Not all iconse are of the same height!");
79 void read_images(Display
*dpy
)
85 for (i
= 0; i
< 5; i
++) {
89 res
= get_one_image(read_param("Icon1"), 0, dpy
);
92 res
= get_one_image(read_param("Icon2"), 1, dpy
);
95 res
= get_one_image(read_param("Icon3"), 2, dpy
);
98 res
= get_one_image(read_param("Icon4"), 3, dpy
);
101 res
= get_one_image(read_param("IconBoom"), 4, dpy
);
107 lputs("Xpm file open failed:");
111 lputs("Xpm file is invalid:");
115 lputs("No memory for open xpm file:");
122 if (!(status
== 0)) {
126 lputs(read_param("Icon1"));
129 lputs(read_param("Icon2"));
132 lputs(read_param("Icon3"));
135 lputs(read_param("Icon4"));
138 lputs(read_param("IconBoom"));
141 lputs("UNKNOWN ERROR! PLEASE REPORT!!!");
150 void update_window(Window win
, GC gc
, unsigned int whattodo
, Display
*dpy
)
154 err
= XPutImage(dpy
, win
, gc
, stupid_picture
[whattodo
],
157 if (0 == err
) return;
161 lputs("Fatal error, XPutImage returns BadDrawable. "
165 lputs("Fatal error, XPutImage returns BadGC. "
169 lputs("Fatal error, XPutImage returns BadMatch. "
173 lputs("Fatal error, XPutImage returns BadValue. "
177 lputs("Fatal error, XPutImage returns unknown error. "
178 "Please report, but probably "
179 "it is a bug in X.");