aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evdev.c')
-rw-r--r--src/evdev.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c
index a51757e..311f678 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -87,7 +87,6 @@
#define MODEFLAG 8
#define COMPOSEFLAG 16
-
static const char *evdevDefaults[] = {
"XkbRules", "base",
"XkbModel", "evdev",
@@ -95,6 +94,22 @@ static const char *evdevDefaults[] = {
NULL
};
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
+typedef struct _PropTable {
+ Atom prop;
+ char *prop_name;
+ Atom (*init)(DeviceIntPtr dev, char* name);
+ BOOL (*handler)(DeviceIntPtr dev, Atom prop, XIPropertyValuePtr val);
+} PropTable, *PropTableEntryPtr;
+
+static PropTable evdevPropTable[] = {
+ { 0, "Middle Button Emulation", EvdevMBEmuInitProperty, EvdevMBEmuSetProperty },
+ { 0, "Middle Button Timeout", EvdevMBEmuInitPropertyTimeout, EvdevMBEmuSetProperty},
+ { 0, NULL, NULL, NULL }
+};
+
+#endif
+
static void
SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
{
@@ -143,6 +158,31 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
xf86PostKeyboardEvent(pInfo->dev, ev->code + MIN_KEYCODE, value);
}
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
+static Bool
+EvdevSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr val)
+{
+ PropTableEntryPtr entry = evdevPropTable;
+
+ while (entry && entry->prop_name)
+ {
+ if (entry->prop == property)
+ return entry->handler(dev, property, val);
+ entry++;
+ }
+
+ /* property not handled, report success */
+ return TRUE;
+}
+
+static Bool EvdevGetProperty(DeviceIntPtr dev,
+ Atom property)
+{
+ /* XXX */
+ return TRUE;
+}
+#endif
+
static void
EvdevReadInput(InputInfoPtr pInfo)
{
@@ -786,6 +826,22 @@ EvdevAddButtonClass(DeviceIntPtr device)
return Success;
}
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
+static void
+EvdevInitProperties(DeviceIntPtr device)
+{
+ PropTableEntryPtr entry;
+
+ entry = evdevPropTable;
+ while(entry && entry->prop_name)
+ {
+ entry->prop = (*entry->init)(device, entry->prop_name);
+ entry++;
+ }
+
+}
+#endif
+
static int
EvdevInit(DeviceIntPtr device)
{
@@ -815,6 +871,14 @@ EvdevInit(DeviceIntPtr device)
else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
EvdevAddAbsClass(device);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
+ /* We drop the return value, the only time we ever want the handlers to
+ * unregister is when the device dies. In which case we don't have to
+ * unregister anyway */
+ XIRegisterPropertyHandler(device, EvdevSetProperty, EvdevGetProperty);
+ EvdevInitProperties(device);
+#endif
+
return Success;
}
@@ -971,6 +1035,7 @@ EvdevProbe(InputInfoPtr pInfo)
return 0;
}
+
static InputInfoPtr
EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{