[PATCH xserver] xfree86: add support for MatchIsTabletPad
Peter Hutterer
peter.hutterer at who-t.net
Tue Apr 26 22:48:16 UTC 2016
The tablet pads have been separate kernel devices for a while now and
libwacom has labelled them with the udev ID_INPUT_TABLET_PAD for over a year
now. Add a new MatchIsTabletPad directive to apply configuration options
specifically to the Pad part of a tablet.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
config/hal.c | 2 ++
config/udev.c | 4 ++++
hw/xfree86/common/xf86Xinput.c | 3 +++
hw/xfree86/man/xorg.conf.man | 2 ++
hw/xfree86/parser/InputClass.c | 12 ++++++++++++
hw/xfree86/parser/xf86Parser.h | 1 +
hw/xfree86/parser/xf86tokens.h | 1 +
include/input.h | 1 +
8 files changed, 26 insertions(+)
diff --git a/config/hal.c b/config/hal.c
index c76eced..e33e333 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -177,6 +177,8 @@ device_added(LibHalContext * hal_ctx, const char *udi)
attrs.flags |= ATTR_JOYSTICK;
if (libhal_device_query_capability(hal_ctx, udi, "input.tablet", NULL))
attrs.flags |= ATTR_TABLET;
+ if (libhal_device_query_capability(hal_ctx, udi, "input.tablet_pad", NULL))
+ attrs.flags |= ATTR_TABLET_PAD;
if (libhal_device_query_capability(hal_ctx, udi, "input.touchpad", NULL))
attrs.flags |= ATTR_TOUCHPAD;
if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL))
diff --git a/config/udev.c b/config/udev.c
index 1a6e82a..23b795f 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -258,6 +258,10 @@ device_added(struct udev_device *udev_device)
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TABLET;
}
+ else if (!strcmp(key, "ID_INPUT_TABLET_PAD")) {
+ LOG_PROPERTY(path, key, value);
+ attrs.flags |= ATTR_TABLET_PAD;
+ }
else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TOUCHPAD;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 4f2e6c8..b02a162 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -646,6 +646,9 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
if (iclass->is_tablet.set &&
iclass->is_tablet.val != ! !(attrs->flags & ATTR_TABLET))
return FALSE;
+ if (iclass->is_tablet_pad.set &&
+ iclass->is_tablet_pad.val != ! !(attrs->flags & ATTR_TABLET_PAD))
+ return FALSE;
if (iclass->is_touchpad.set &&
iclass->is_touchpad.val != ! !(attrs->flags & ATTR_TOUCHPAD))
return FALSE;
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 8c4aeb5..65c411e 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1188,6 +1188,8 @@ entries.
.TP 7
.BI "MatchIsTablet \*q" bool \*q
.TP 7
+.BI "MatchIsTabletPad \*q" bool \*q
+.TP 7
.BI "MatchIsTouchpad \*q" bool \*q
.TP 7
.BI "MatchIsTouchscreen \*q" bool \*q
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 392aa28..7281659 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -52,6 +52,7 @@ static const xf86ConfigSymTabRec InputClassTab[] = {
{MATCH_IS_POINTER, "matchispointer"},
{MATCH_IS_JOYSTICK, "matchisjoystick"},
{MATCH_IS_TABLET, "matchistablet"},
+ {MATCH_IS_TABLET_PAD, "matchistabletpad"},
{MATCH_IS_TOUCHPAD, "matchistouchpad"},
{MATCH_IS_TOUCHSCREEN, "matchistouchscreen"},
{NOMATCH_PRODUCT, "nomatchproduct"},
@@ -346,6 +347,14 @@ xf86parseInputClassSection(void)
if (!ptr->is_tablet.set)
Error(BOOL_MSG, "MatchIsTablet");
break;
+ case MATCH_IS_TABLET_PAD:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsTabletPad");
+ ptr->is_tablet_pad.set = xf86getBoolValue(&ptr->is_tablet_pad.val, xf86_lex_val.str);
+ free(xf86_lex_val.str);
+ if (!ptr->is_tablet_pad.set)
+ Error(BOOL_MSG, "MatchIsTabletPad");
+ break;
case MATCH_IS_TOUCHPAD:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchIsTouchpad");
@@ -474,6 +483,9 @@ xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr)
if (ptr->is_tablet.set)
fprintf(cf, "\tIsTablet \"%s\"\n",
ptr->is_tablet.val ? "yes" : "no");
+ if (ptr->is_tablet_pad.set)
+ fprintf(cf, "\tIsTabletPad \"%s\"\n",
+ ptr->is_tablet_pad.val ? "yes" : "no");
if (ptr->is_touchpad.set)
fprintf(cf, "\tIsTouchpad \"%s\"\n",
ptr->is_touchpad.val ? "yes" : "no");
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a038f9e..ff35846 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -326,6 +326,7 @@ typedef struct {
xf86TriState is_pointer;
xf86TriState is_joystick;
xf86TriState is_tablet;
+ xf86TriState is_tablet_pad;
xf86TriState is_touchpad;
xf86TriState is_touchscreen;
XF86OptionPtr option_lst;
diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h
index f955af0..15792c6 100644
--- a/hw/xfree86/parser/xf86tokens.h
+++ b/hw/xfree86/parser/xf86tokens.h
@@ -285,6 +285,7 @@ typedef enum {
MATCH_IS_POINTER,
MATCH_IS_JOYSTICK,
MATCH_IS_TABLET,
+ MATCH_IS_TABLET_PAD,
MATCH_IS_TOUCHPAD,
MATCH_IS_TOUCHSCREEN,
diff --git a/include/input.h b/include/input.h
index 9662123..cfdea2a 100644
--- a/include/input.h
+++ b/include/input.h
@@ -237,6 +237,7 @@ typedef struct _InputAttributes {
#define ATTR_TOUCHPAD (1<<4)
#define ATTR_TOUCHSCREEN (1<<5)
#define ATTR_KEY (1<<6)
+#define ATTR_TABLET_PAD (1<<7)
/* Key/Button has been run through all input processing and events sent to clients. */
#define KEY_PROCESSED 1
--
2.7.4
More information about the xorg-devel
mailing list