aboutsummaryrefslogtreecommitdiffstats
path: root/surfaces/vega.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-27 15:03:45 +0100
committereunhhu <[email protected]>2026-09-27 15:03:45 +0100
commitad3eb77af098f34c1ea8cb50f468a8b75fb7d61c (patch)
treefa38b131e428cb16d6ecf7bc616cacdde177a93e /surfaces/vega.h
parent5313285bbfedf6154d2611c4923cff458d7ef271 (diff)
downloadvega-ad3eb77af098f34c1ea8cb50f468a8b75fb7d61c.tar.gz
vega-ad3eb77af098f34c1ea8cb50f468a8b75fb7d61c.zip
Take keyboards, mice and touch screens on the display (evdev)
vega display --live reads the kernel's input events with no library: keys become Pure's key names and the text they type on a US layout, going through the TUI's own handling (the input line takes text, else the app takes keys); a mouse moves an outlined pointer and clicks, a touch screen presses where it is touched, scaled from the device's range; the line pressed is the row. --input FILE reads recorded events to their end and prints the last frame, which is how this screenless Pi checks it: after typing two items with Shift, Enter, Tab, Space and a touch on a row, the display's last frame is the TUI's after the same keys and click, and came back from the display controller as drawn.
Diffstat (limited to 'surfaces/vega.h')
-rw-r--r--surfaces/vega.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/surfaces/vega.h b/surfaces/vega.h
index 69eba0b..ba7b61f 100644
--- a/surfaces/vega.h
+++ b/surfaces/vega.h
@@ -2,6 +2,7 @@
#define VEGA_H
#include "module.h"
#include "symbols.h"
+#include <poll.h>
#include <stdio.h>
/* Vega reads a verified Pure module by convention (docs/design/001-first-component.md):
@@ -151,4 +152,23 @@ bool vega_display_show(VegaDisplay *);
/* Writeback: the last frame as the display controller put it out. */
const uint32_t *vega_display_captured(const VegaDisplay *, size_t *stride);
void vega_display_close(VegaDisplay *);
+
+/* Input from evdev: keyboards (key names and the text they type on a US
+ * layout), mice and touch screens (presses at a pixel of a width x height
+ * screen). With paths, recorded events are read from those files instead,
+ * positions in screen pixels. */
+typedef enum { VEGA_EVENT_KEY, VEGA_EVENT_TEXT, VEGA_EVENT_PRESS, VEGA_EVENT_WHEEL } VegaEventKind;
+typedef struct {
+ VegaEventKind kind;
+ char name[24], text[8]; /* a key's name; the text it types */
+ int x, y, steps; /* where a press or the wheel is; steps down (negative up) */
+} VegaEvent;
+typedef struct VegaInput VegaInput;
+VegaInput *vega_input_open(const char *const *paths, unsigned count, unsigned width, unsigned height);
+unsigned vega_input_fds(const VegaInput *, struct pollfd *out, unsigned max);
+/* What the device on fd has for us; ended: it has no more (a file read out). */
+unsigned vega_input_read(VegaInput *, int fd, VegaEvent *out, unsigned max, bool *ended);
+/* Where the pointer is, and whether a mouse moved it (a finger's is not shown). */
+void vega_input_pointer(const VegaInput *, int *x, int *y, bool *shown);
+void vega_input_close(VegaInput *);
#endif