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_* */
+7 -4
View File
@@ -159,9 +159,12 @@ enum {
* encodes vmsig_input into vmsig_event.inln.
*
* Pointer motion carries BOTH coordinates in ONE event (a pointer position is a single entity,
* not two independent axis updates). btn/key/scroll stay single-valued. */
* not two independent axis updates). btn/key/scroll stay single-valued.
*
* Numbering is FROZEN: an external control encodes these on the wire and is not rebuilt from
* this header. Removing a member must NOT shift the others. */
typedef enum {
VMSIG_INPUT_MOVE_ABS = 0, /* absolute pointer: x,y are coordinates (0..VMCTL_ABS_MAX) */
/* 0 reserved (was MOVE_ABS, removed) */
VMSIG_INPUT_MOVE_REL = 1, /* relative pointer: x,y are deltas (dx,dy) */
VMSIG_INPUT_BTN = 2, /* button: code=button, value=pressed(1)/released(0) */
VMSIG_INPUT_KEY = 3, /* key: code=evdev code, value=pressed/released */
@@ -175,8 +178,8 @@ typedef struct {
uint16_t kind; /* vmsig_input_kind */
uint16_t code; /* button / evdev code / scroll axis (NOT used by MOVE_*) */
int32_t value; /* pressed(1)|released(0) for BTN/KEY (not used by MOVE or SCROLL) */
int32_t x; /* MOVE_ABS: abs X (0..VMCTL_ABS_MAX); MOVE_REL: dx */
int32_t y; /* MOVE_ABS: abs Y; MOVE_REL: dy */
int32_t x; /* MOVE_REL: dx */
int32_t y; /* MOVE_REL: dy */
double scroll; /* SCROLL magnitude only */
uint32_t flags; /* VMSIG_INPUT_F_* (see above) */
uint32_t _pad; /* reserved; zero on emit */