libinput: Support for long press key detection?

Peter Hutterer peter.hutterer at
Sun Oct 26 15:46:34 PDT 2014

On Sun, Oct 26, 2014 at 01:10:43PM +0100, Stefanie Behme wrote:
> Am 21.10.2014 um 21:03 schrieb Carsten Haitzler (The Rasterman):
> >On Tue, 21 Oct 2014 20:21:26 +0200 Stefanie Behme <steffi.behme at> said:
> >
> >>Hi,
> >>
> >>on last ELCE in Duesseldorf I learned that the development of libinput
> >>was started to handle input devices in Wayland compositors. I had a look
> >>in the API documentation and found that the enum "libinput_key_state"
> >>has these values: LIBINPUT_KEY_STATE_RELEASED and
> >>
> >>There is a need to detect if a key is pressed (and hold) for a certain
> >>amount of time. If this is the case a long-press key event is send. It
> >>is also possible that several long-press key events are defined for one
> >>key, e.g.:
> >>- 500 ms: KEY_STATE_LONG_PRESSED_1
> >>- 1000 ms: KEY_STATE_LONG_PRESSED_2
> >>- 5000 ms: KEY_STATE_LONG_PRESSED_3
> >>
> >>A long press on a key is e.g. used to create a screen shot.
> >>
> >>Is there any plan to support this kind of long press detection? How
> >>could this look like? Any ideas?
> >
> >can you explain why this needs or  should be done at the libinput level and not
> >in the app/toolkit where it already is handled (at least in some toolkits).
> Since the input handling code was put in an own library to avoid duplicated
> code I was wondering if long press detection could also be part of libinput.
> Then this has not to be implemented in every app/toolkit.
> Regarding the answer from Peter, that this would be too high level for
> libinput, just for my information I wonder where is the border of libinput?
> Which kind of input handling will be part and which not?

think of libinput as hardware abstraction. anything libinput processes
should happen regardless of what desktop or software is currently running.
things like two-finger scroll or tapping can be considered HW features,
they're independent of anything higher up the stack. 

otoh long key presses depend on if an application handles them, and that too
depends on the current state of the application. For example, it's usually
ok to hold a key down for some time to repeat keys, but in a different mode
that same key may trigger some shortcut. That's for the application to
decide though, hence we can't put this into libinput.


More information about the wayland-devel mailing list