[RFC v2 wayland-protocols] tablet: define our own enum for tablet tool buttons
Peter Hutterer
peter.hutterer at who-t.net
Sun Nov 20 05:14:52 UTC 2016
Rather than relying on input-event-codes, define our own enum that is tailored
towards the tablet interface.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Because it's usually easier to pick holes into a patch proposal than come up
with ideas elsewhere, here's a quick-and-dirty patch.
Advantage: we control the button names/numbers and clients don't have to
know about cases where linux/input.h isn't enough.
Obvious drawback: adding new buttons requires a new protocol. Given this
hardware hasn't really changed much in quite a while, this may not be much
of an issue.
unstable/tablet/tablet-unstable-v2.xml | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/unstable/tablet/tablet-unstable-v2.xml b/unstable/tablet/tablet-unstable-v2.xml
index 728a3df..88aed83 100644
--- a/unstable/tablet/tablet-unstable-v2.xml
+++ b/unstable/tablet/tablet-unstable-v2.xml
@@ -539,6 +539,26 @@
<arg name="clicks" type="int" summary="The wheel delta in discrete clicks"/>
</event>
+ <enum name="button">
+ <description summary="physical button name">
+ Describes the physical button that produced the button event.
+ </description>
+ <entry name="unknown" value="0" summary="An unknown button"/>
+ <entry name="stylus1" value="1" summary="The primary button on a stylus-like tool"/>
+ <entry name="stylus2" value="2" summary="The secondary button on a stylus-like tool"/>
+ <entry name="stylus3" value="3" summary="The third button on a stylus-like tool"/>
+ <entry name="stylus4" value="4" summary="The forth button on a stylus-like tool"/>
+ <entry name="stylus5" value="5" summary="The fifth button on a stylus-like tool"/>
+ <entry name="stylus6" value="6" summary="The sixth button on a stylus-like tool"/>
+ <entry name="stylus7" value="7" summary="The seventh button on a stylus-like tool"/>
+ <entry name="stylus8" value="8" summary="The eighth button on a stylus-like tool"/>
+ <entry name="stylus9" value="9" summary="The ninth button on a stylus-like tool"/>
+ <entry name="left" value="10" summary="The left button on a mouse-like tool"/>
+ <entry name="right" value="11" summary="The right button on a mouse-like tool"/>
+ <entry name="middle" value="12" summary="The middle button on a mouse-like tool"/>
+ <entry name="thumb" value="13" summary="The thumb button on a mouse-like tool"/>
+ </enum>
+
<enum name="button_state">
<description summary="physical button state">
Describes the physical state of a button that produced the button event.
@@ -558,7 +578,7 @@
</description>
<arg name="serial" type="uint"/>
- <arg name="button" type="uint" summary="The button whose state has changed"/>
+ <arg name="button" type="uint" enum="button" summary="The button whose state has changed"/>
<arg name="state" type="uint" enum="button_state" summary="Whether the button was pressed or released"/>
</event>
--
2.9.3
More information about the wayland-devel
mailing list