aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw/test.c
blob: d4a5de770c132621dca9e372fd9b089647715474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>

void
eresized(int new)
{
	if(new && getwindow(display, Refnone) < 0){
		fprint(2, "colors: can't reattach to window: %r\n");
		exits("resized");
	}
	draw(screen, screen->r, display->white, nil, ZP);
	flushimage(display, 1);
}

char *buttons[] =
{
	"exit",
	0
};

Menu menu =
{
	buttons
};

void
main(int argc, char *argv[])
{
	Mouse m;

	initdraw(0,0,0);
	eresized(0);
	einit(Emouse);
	for(;;){
		m = emouse();
		if(m.buttons == 4)
			switch(emenuhit(3, &m, &menu)){
			case 0:
				exits(0);
			}
	}
}