stn := @use("../../stn/src/lib.hb");
.{log, buffer, memory} := stn
keycodes := @use("keycodes.hb")

events := @use("events.hb");
.{KeyEvent, MouseEvent} := events

recieve_key_event := fn(): ?KeyEvent {
	return null
}

recieve_mouse_event := fn(): ?MouseEvent {
	mevent := MouseEvent.(0, 0, false, false, false)

	buf_id := buffer.search("PS/2 Mouse\0")

	// Read out of the Mouse buffer here
	buffer.recv(MouseEvent, buf_id, @bitcast(&mevent))

	if mevent.x_change != 0 | mevent.y_change != 0 | mevent.left | mevent.middle | mevent.right {
		return mevent
	}

	return null
}