mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Remove SILLYNESS
This code makes wmaker a little bit bigger for no gain at all. I could undefine SILLYNESS and forget it, but I actually also want a clean source code to read. And the less code the better. So now I won't get a different Info dialog on Christmas, but my wmaker will also not carry around that code in the other 364 days of the year. As a result, wmaker gets ~1.7 % smaller text data bss dec hex filename 448043 17424 8200 473667 73a43 wmaker.new 455340 18360 8328 482028 75aec wmaker.old
This commit is contained in:
@@ -371,86 +371,3 @@ void DoWindowBirth(WWindow *wwin)
|
||||
/* dummy stub */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SILLYNESS
|
||||
static WMPixmap *data[12];
|
||||
|
||||
static Bool loadData(WScreen * scr)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
RImage *image;
|
||||
Pixmap d[12];
|
||||
|
||||
f = fopen(PKGDATADIR "/xtree.dat", "rb");
|
||||
if (!f)
|
||||
return False;
|
||||
|
||||
image = RCreateImage(50, 50, False);
|
||||
if (!image) {
|
||||
fclose(f);
|
||||
return False;
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (fread(image->data, 50 * 50 * 3, 1, f) != 1) {
|
||||
goto error;
|
||||
}
|
||||
if (!RConvertImage(scr->rcontext, image, &(d[i]))) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
RReleaseImage(image);
|
||||
|
||||
fclose(f);
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
data[i] = WMCreatePixmapFromXPixmaps(scr->wmscreen, d[i], None, 50, 50, scr->w_depth);
|
||||
}
|
||||
|
||||
return True;
|
||||
|
||||
error:
|
||||
RReleaseImage(image);
|
||||
|
||||
fclose(f);
|
||||
|
||||
while (--i > 0) {
|
||||
XFreePixmap(dpy, d[i]);
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
WMPixmap *DoXThing(WWindow * wwin)
|
||||
{
|
||||
static int order = 0;
|
||||
|
||||
order++;
|
||||
|
||||
return data[order % 12];
|
||||
}
|
||||
|
||||
Bool InitXThing(WScreen * scr)
|
||||
{
|
||||
time_t t;
|
||||
struct tm *l;
|
||||
static int i = 0;
|
||||
|
||||
t = time(NULL);
|
||||
l = localtime(&t);
|
||||
if ((l->tm_mon != 11 || l->tm_mday < 24 || l->tm_mday > 26))
|
||||
return False;
|
||||
|
||||
if (i)
|
||||
return True;
|
||||
|
||||
if (!loadData(scr))
|
||||
return False;
|
||||
|
||||
i = 1;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
#endif /* SILLYNESS */
|
||||
|
||||
Reference in New Issue
Block a user