feat(input): drop absolute-pointer (ABS) support

ABS was glued onto device A alongside the keyboard and never worked right; it is
not needed in practice. Remove it entirely: device A is now keyboard-only, and
device B is the relative mouse (motion + buttons incl. middle + wheel). Drops the
ptr_mode model (one layout remains), VMCTL_EV_ABS/PTR_*, and the absolute axes.

The public input-kind enum keeps its numeric values (MOVE_REL=1, BTN=2, KEY=3,
SCROLL=4) so the wire stays compatible -- only MOVE_ABS (0) is removed and its
slot reserved; an unknown/0 kind is a no-op.

Bump 0.3.11.
This commit is contained in:
2026-06-24 17:14:15 +03:00
parent 85041c12ab
commit 0f452fe37c
12 changed files with 85 additions and 158 deletions
+5 -12
View File
@@ -15,10 +15,6 @@ typedef enum {
/* via QEMU virtio-input-host-pci (Linux). uinput != virtio. */
} vmctl_driver;
#define VMCTL_PTR_ABS 1 /* uinput: absolute tablet */
#define VMCTL_PTR_REL 2 /* uinput: relative mouse */
#define VMCTL_PTR_BOTH 3 /* uinput: two devices A=abs B=rel */
typedef struct {
unsigned bustype; /* HID bus type, e.g. 0x0003 (USB) */
unsigned vendor; /* vendor id */
@@ -31,7 +27,6 @@ typedef struct {
vmctl_driver driver;
const char* qmp_path; /* QMP unix socket; required for QMP, optional (passthrough) for UINPUT */
const char* input_bus; /* virtio-input-host-pci bus "pci.0" for passthrough; "" = none */
int ptr_mode; /* UINPUT VMCTL_PTR_*; 0 for QMP */
const vmctl_uinput_id* uinput_id; /* UINPUT only; NULL = built-in defaults */
} vmctl_config;
@@ -39,13 +34,13 @@ vmctl_t* vmctl_open (const vmctl_config* cfg); /* NULL on error */
void vmctl_close(vmctl_t* v); /* safe on NULL */
/* Copy the host evdev node paths of the created uinput devices (UINPUT driver only).
* a[] receives device A, b[] receives device B (empty if not VMCTL_PTR_BOTH); each buffer
* must be >=64 bytes. Returns the count of non-empty paths filled (0/1/2), or -1 if the
* handle's driver is not UINPUT. Paths are valid while the handle is open. */
* a[] receives device A (keyboard), b[] receives device B (relative mouse); both are always
* created, so count==2 in the normal case. Each buffer must be >=64 bytes. Returns the count
* of non-empty paths filled (0/1/2), or -1 if the handle's driver is not UINPUT. Paths are
* valid while the handle is open. */
int vmctl_uinput_evdev(vmctl_t* v, char a[64], char b[64]);
/* ===== Input constants ===== */
#define VMCTL_ABS_MAX 32767 /* abs coordinates 0..VMCTL_ABS_MAX */
#define VMCTL_AXIS_X 0
#define VMCTL_AXIS_Y 1
#define VMCTL_SCROLL_V 0 /* vertical */
@@ -67,13 +62,12 @@ int vmctl_uinput_evdev(vmctl_t* v, char a[64], char b[64]);
typedef struct {
int kind; /* internal event-kind code; set by builders */
int code; /* axis / button / evdev-code (per kind) */
int value; /* abs-value / rel-delta / down(0|1) */
int value; /* rel-delta / down(0|1) */
double scroll; /* scroll magnitude (scroll only) */
} vmctl_event;
typedef struct { vmctl_event ev[VMCTL_BATCH_MAX]; int count; } vmctl_batch;
void vmctl_batch_init (vmctl_batch* b);
void vmctl_batch_abs (vmctl_batch* b, int axis, int value);
void vmctl_batch_rel (vmctl_batch* b, int axis, int delta);
void vmctl_batch_btn (vmctl_batch* b, int btn, int down);
void vmctl_batch_key (vmctl_batch* b, int evdev_code, int down);
@@ -81,7 +75,6 @@ void vmctl_batch_scroll(vmctl_batch* b, int axis, double value);
int vmctl_batch_send (vmctl_t* v, vmctl_batch* b); /* one round-trip; 0=ok, -1=err */
/* ===== Single events (wrappers over a 1-event batch) ===== */
int vmctl_abs (vmctl_t* v, int axis, int value); /* 0..VMCTL_ABS_MAX */
int vmctl_rel (vmctl_t* v, int axis, int delta);
int vmctl_btn (vmctl_t* v, int btn, int down); /* VMCTL_BTN_* */
int vmctl_key (vmctl_t* v, int evdev_code, int down); /* Linux KEY_* */