[PATCH/RFC libinput 0/7] pad: add a mode toggle API

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 6 06:50:38 UTC 2016

Ok, I'm at the point where I can stare at this all day and don't see
anything anymore, so up to you guys it is :)

This implements mode switching support for tablet pads. The first two
patches are just general cleanup, the meat is in 5/7 and 6/7.

What is mode switching? On many tablets (Intuos Pro series, some cintiqs) we
have a button that toggles the LED next to the touch ring. Intuos Pro
tablets have 4 modes (i.e. 4 LEDs) and these are used to signal
functionality that the touch ring maps to. The actual functionality mapping
is done in the caller. A common config is something like: mode 0 maps to
scroll, mode 1 maps to zoom, mode 2 maps to brush size, etc.

We arrived here at a roundabout way, initially I planned for this to be
solely in the caller but the details of LED handling (read/write correct
values to the right sysfs file) are better handled in one place.

The second attempt was to expose the LEDs and let the caller decide how and
when to switch modes. That has the same problem, it provides flexibility but
requires a lot of compositor work to get right. 

So we arrived at this approach: force the behaviour in libinput so that a
mode toggle button actually toggles the LED but leave the exact behaviour up
to the compositor. We group the buttons/rings/strips with the mode so a
compositor can still decide whether to only apply the mode to the ring (OS
X/Windows behaviour) or also apply them to the buttons.

The basic structure here is that we have "mode groups" which have modes. On
almost all tablets we have exactly one mode group. The Intuos Pros have 4
modes, all tablets without LEDs have 1 mode. The 22HD has 2 mode groups with
3 modes each. The mode button toggles to the next mode or in the 22HD case
to a specific mode (but that's not fully implemented just yet).
The EKR has automatic mode toggle, that's not implemented yet either but
it's largely hidden by the API and doesn't affect the callers anyway.

API review and comments are appreciated, especially coming up with something
less clumsy than libinput_tablet_pad_mode_group :)


More information about the wayland-devel mailing list