summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/src/cmd/rio/dat.h1
-rw-r--r--sys/src/cmd/rio/data.c33
-rw-r--r--sys/src/cmd/rio/fns.h2
-rw-r--r--sys/src/cmd/rio/rio.c8
4 files changed, 40 insertions, 4 deletions
diff --git a/sys/src/cmd/rio/dat.h b/sys/src/cmd/rio/dat.h
index dac32da5f..93003780b 100644
--- a/sys/src/cmd/rio/dat.h
+++ b/sys/src/cmd/rio/dat.h
@@ -296,6 +296,7 @@ Cursor query;
Cursor *corners[9];
Image *background;
+Image *wallpaper;
Image *cols[NCOL];
Image *titlecol;
Image *lighttitlecol;
diff --git a/sys/src/cmd/rio/data.c b/sys/src/cmd/rio/data.c
index 86e43c72f..55a26d4b7 100644
--- a/sys/src/cmd/rio/data.c
+++ b/sys/src/cmd/rio/data.c
@@ -173,10 +173,39 @@ Cursor *corners[9] = {
};
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);
diff --git a/sys/src/cmd/rio/fns.h b/sys/src/cmd/rio/fns.h
index 8562c2cd9..4d4597355 100644
--- a/sys/src/cmd/rio/fns.h
+++ b/sys/src/cmd/rio/fns.h
@@ -17,6 +17,8 @@ void error(char*);
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*);
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c
index 9c18a6955..29fa11426 100644
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -186,6 +186,8 @@ threadmain(int argc, char *argv[])
exits("display open");
}
iconinit();
+ wallpaperinit();
+ backgroundinit();
exitchan = chancreate(sizeof(int), 0);
winclosechan = chancreate(sizeof(Window*), 0);
@@ -202,7 +204,7 @@ threadmain(int argc, char *argv[])
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();
@@ -594,10 +596,12 @@ resized(void)
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);