1
0
Fork 0
forked from AbleOS/ableos
ableos_time/sysdata/libraries/intouch/src/lib.hb

36 lines
779 B
Plaintext
Raw Normal View History

2024-11-03 19:38:40 -06:00
stn := @use("../../stn/src/lib.hb");
.{log, buffer, memory} := stn
keycodes := @use("keycodes.hb")
2024-11-03 19:38:40 -06:00
events := @use("events.hb");
.{KeyEvent, MouseEvent} := events
2024-09-17 19:26:37 -05:00
2024-11-03 19:38:40 -06:00
recieve_key_event := fn(): ?KeyEvent {
2024-11-11 01:23:14 -06:00
kevent := KeyEvent.(false, false, 0)
buf_id := buffer.search("PS/2 Keyboard\0")
// Read out of the Keyboard buffer here
buffer.recv(KeyEvent, buf_id, &kevent)
if kevent.just_triggered {
return kevent
}
2024-11-10 04:33:50 -06:00
return null
2024-09-17 19:26:37 -05:00
}
2024-11-07 09:57:39 -06:00
recieve_mouse_event := fn(): ?MouseEvent {
2024-11-10 04:33:50 -06:00
mevent := MouseEvent.(0, 0, false, false, false)
buf_id := buffer.search("PS/2 Mouse\0")
// Read out of the Mouse buffer here
2024-11-10 19:03:01 -06:00
buffer.recv(MouseEvent, buf_id, &mevent)
2024-11-10 04:33:50 -06:00
if mevent.x_change != 0 | mevent.y_change != 0 | mevent.left | mevent.middle | mevent.right {
2024-11-07 09:57:39 -06:00
return mevent
}
2024-11-10 04:33:50 -06:00
return null
2024-11-03 19:38:40 -06:00
}