shithub: dormer

ref: c40d66e369235ec021af570553b89bd101a42109
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;
	}
}