Draft: Tablet tool scroll
This aims at implementing #729.
For tablets that don't have finger features and no wheels, sliders, etc., it can be annoying to scroll on applications that are not specifically designed for tablet use in minds, when you just want to use the tablet instead of the mouse for everyday life.
This is my first attempt at implementing tablet tool scroll, and a way to open the discussion for the tablet tool scroll API. Sorry if things are still in a draft state, I will edit things according to your comments.
This MR doesn't support (for now at least) scroll button lock. I don't know if this is something that I should try to add or not for now.
Related MRs:
- libinput (this MR) (doc and tests TODO)
- wayland-protocols: wayland/wayland-protocols!288
- wlroots: wlroots/wlroots!4598
- sway: https://github.com/swaywm/sway/pull/8058
- mutter (TODO):
- kwin (TODO):
- GTK (TODO):
- QT (TODO):
Implementation explanations:
This adds a new LIBINPUT_EVENT_TABLET_TOOL_SCROLL_CONTINUOUS
event type.
I ended up copying a lot of things from mouse button scroll. To identify horizontal and vertical scroll, I used the existing libinput_pointer_axis
, as this is already exactly what we need. Should I create an explicit new libinput_tablet_tool_scroll_axis
instead (libinput_tablet_tool_axis
being already taken)? Or is this OK? As libinput_pointer_axis
is part of the libinput.h
, I guess we can't rename it something like libinput_scroll_axis
as this would break API?
This also adds a new libinput_tablet_tool_axis_source
enum, for now containing only LIBINPUT_TABLET_TOOL_AXIS_SOURCE_CONTINUOUS
as valid source.
This adds libinput_event_tablet_tool_has_axis
, libinput_event_tablet_tool_get_scroll_value
and libinput_event_tablet_tool_get_axis_source
to the API, similarly to pointer scrolling (I think that no discrete scrolling should be possible with the tablet tool).
The added code in evdev.c
is very close to the code for the mouse scroll, I don't know if this should be avoided or if there is a better way to do it.