Cursor *corners[9];
Image *background;
+Image *wallpaper;
Image *cols[NCOL];
Image *titlecol;
Image *lighttitlecol;
};
void
-iconinit(void)
+backgroundinit(void)
+{
+ background = allocimage(display, screen->r, screen->chan, 1, 0x777777FF);
+
+ if (wallpaper) {
+ Rectangle r = Rect(
+ (screen->r.min.x + screen->r.max.x - Dx(wallpaper->r)) / 2,
+ (screen->r.min.y + screen->r.max.y - Dy(wallpaper->r)) / 2,
+ (screen->r.min.x + screen->r.max.x + Dx(wallpaper->r)) / 2,
+ (screen->r.min.y + screen->r.max.y + Dy(wallpaper->r)) / 2
+ );
+
+ draw(background, r, wallpaper, nil, wallpaper->r.min);
+ }
+}
+
+void
+wallpaperinit(void)
{
- background = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x777777FF);
+ int fd;
+
+ fd = open("/usr/glenda/lib/wallpaper", OREAD);
+ if(fd >= 0) {
+ wallpaper = readimage(display, fd, 0);
+ close(fd);
+ } else {
+ wallpaper = nil;
+ }
+}
+void
+iconinit(void)
+{
/* greys are multiples of 0x11111100+0xFF, 14* being palest */
cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse);
cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF^reverse);
void killprocs(void);
int shutdown(void*, char*);
void iconinit(void);
+void wallpaperinit(void);
+void backgroundinit(void);
void *erealloc(void*, uint);
void *emalloc(uint);
char *estrdup(char*);
exits("display open");
}
iconinit();
+ wallpaperinit();
+ backgroundinit();
exitchan = chancreate(sizeof(int), 0);
winclosechan = chancreate(sizeof(Window*), 0);
wscreen = allocscreen(screen, background, 0);
if(wscreen == nil)
error("can't allocate screen");
- draw(view, viewr, background, nil, ZP);
+ draw(view, Rect(0, 0, viewr.max.x, viewr.max.y), background, nil, ZP);
flushimage(display, 1);
timerinit();
freescrtemps();
view = screen;
freescreen(wscreen);
+ freeimage(background);
+ backgroundinit();
wscreen = allocscreen(screen, background, 0);
if(wscreen == nil)
error("can't re-allocate screen");
- draw(view, view->r, background, nil, ZP);
+ draw(view, Rect(0, 0, view->r.max.x, view->r.max.y), background, nil, ZP);
o = subpt(viewr.max, viewr.min);
n = subpt(view->clipr.max, view->clipr.min);
qsort(window, nwindow, sizeof(window[0]), wtopcmp);