5 typedef struct Memimage Memimage;
10 allocscreen(Image *image, Image *fill, int public)
18 if(d != fill->display){
19 werrstr("allocscreen: image and fill on different displays");
22 s = malloc(sizeof(Screen));
27 for(try=0; try<25; try++){
28 /* loop until find a free id */
29 a = bufimage(d, 1+4+4+4+1);
32 id = ++screenid & 0xffff; /* old devdraw bug */
35 BPLONG(a+5, image->id);
36 BPLONG(a+9, fill->id);
38 if(flushimage(d, 0) != -1)
48 assert(s->image != nil && s->image->chan != 0);
55 publicscreen(Display *d, int id, ulong chan)
60 s = malloc(sizeof(Screen));
63 a = bufimage(d, 1+4+4);
72 if(flushimage(d, 0) < 0)
100 * flush(1) because screen is likely holding last reference to
101 * window, and want it to disappear visually.
103 if(flushimage(d, 1) < 0)
110 allocwindow(Screen *s, Rectangle r, int ref, ulong col)
112 return _allocwindow(nil, s, r, ref, col);
116 _allocwindow(Image *i, Screen *s, Rectangle r, int ref, ulong col)
121 i = _allocimage(i, d, r, d->screenimage->chan, 0, col, s->id, ref);
125 i->next = s->display->windows;
126 s->display->windows = i;
132 topbottom(Image **w, int n, int top)
140 fprint(2, "top/bottom: ridiculous number of windows\n");
145 if(n > (w[0]->display->bufsize-100)/4)
148 * this used to check that all images were on the same screen.
149 * we don't know the screen associated with images we acquired
150 * by name. instead, check that all images are on the same display.
151 * the display will check that they are all on the same screen.
155 if(w[i]->display != d){
156 fprint(2, "top/bottom: windows not on same screen\n");
162 b = bufimage(d, 1+1+2+4*n);
169 BPLONG(b+4+4*i, w[i]->id);
173 bottomwindow(Image *w)
187 bottomnwindows(Image **w, int n)
193 topnwindows(Image **w, int n)
199 originwindow(Image *w, Point log, Point scr)
204 b = bufimage(w->display, 1+4+2*4+2*4);
213 delta = subpt(log, w->r.min);
214 w->r = rectaddpt(w->r, delta);
215 w->clipr = rectaddpt(w->clipr, delta);