aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libdraw/test.c')
-rw-r--r--src/libdraw/test.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/libdraw/test.c b/src/libdraw/test.c
new file mode 100644
index 00000000..d4a5de77
--- /dev/null
+++ b/src/libdraw/test.c
@@ -0,0 +1,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);
+ }
+ }
+}