shithub: dormer

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