[PATCH libinput 1/4] evdev: Ignore key/button release events if key was never pressed

Bill Spitzak spitzak at gmail.com
Mon Jul 28 10:03:25 PDT 2014



On 07/27/2014 11:48 PM, Ran Benita wrote:
> Hi Jonas,
>
> On Sun, Jul 27, 2014 at 11:28:28PM +0200, Jonas Ådahl wrote:
>> The kernel may send a 'release' event without ever having sent a key
>> 'pressed' event in case the key was pressed before libinput was
>> initiated. Ignore these events so that we always guarantee a release
>> event always comes after a pressed event for any given key or button.
>
> Would it be possible to describe in the docs the invariants that
> libinput is keeping w.r.t. key press/release ordering and count?
> If the user can rely on such invariants, it can simplify how he
> interfaces with e.g. libxkbcommon, which expects a coherent key event
> stream (things like modifier press with a missed release can cause some
> fun).

IMHO such invariants are a waste of time, and add complexity to each 
software layer for no benefit.

The final consumer of the events either can easily handle mismatched 
pairs, or is forced to implement the map of currently-pressed events 
anyway (due to the client having it's own internal routing of events 
which also has to match pairs, such as when objects that receive events 
are created or deleted). So there is no reason to waste effort 
implementing these maps at every level since in effect the next level is 
not going to rely on them.

I would prefer a count of the number of down buttons, which will allow a 
layer to re-sync it's map in many cases, even if events were mishandled 
by intermediate software layers.



More information about the wayland-devel mailing list