Rework "frame" events from input device
The Wayland protocol has a concept of "frame" events for wl_pointer
and wl_touch
. It groups events which "logically belong together". This is used for instance to group multiple "axis" events to represent diagonal scroll motion. It allows the protocol to be extended with more info (e.g. "axis_source").
We've mirrored this in our input device APIs: multiple "axis" events can be fired before "frame". While this is very flexible, it's not very convenient to use. Callers need to accumulate intermediary events until they see a "frame" event, at which point they have a complete picture of the event which happened.
The Wayland "frame" event has been designed this way because Wayland is a socket protocol. wlroots isn't a protocol, it's a C API, so we could find a better API to represent "frame" events.
libinput has a generic event structure. One libinput event represents a Wayland "wl_pointer.frame" event, and e.g. may contain multiple "axis" events. We could have a generic wlr_input_event
struct which contains all info about potentially multiple axes.
Though it doesn't seem like touch input is as simple as pointer input. libinput exposes a TOUCH_FRAME
event, it seems to be able to contain an arbitrary number of other touch events (received during one hardware sample period). So we'd need to have an event struct with an arbitrary number of child events for this one…