shithub: dormer

ref: 1f1a8bbd7ce97df5e6798b907de931105387a67a
dir: /dormer.c/

View raw version
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
#include "dormer.h"

static ulong keys;
static Event e;

void
eresized(int new)
{
	USED(new);
	present();
}

void
winit()
{
	if(initdraw(0, 0, dm.title) < 0){
		fprint(2, "%s: initdraw failed: %r\n", dm.title);
		exits("initdraw");
	}

	keys = Emouse|Ekeyboard;
	einit(keys);
}

void
readev()
{
	if(ecanread(keys)){
		dm.ev = eread(keys, &e);
		dm.key = e.kbdc;
		dm.btn = e.mouse.buttons;
		dm.x = e.mouse.xy.x;
		dm.y = e.mouse.xy.y;
	}else{
		dm.ev = 0;
	}
}