summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-10-14 15:30:20 +1030
committerPeter Hutterer <peter.hutterer@redhat.com>2008-10-14 15:30:20 +1030
commitff783fce65a63707555098759692b22147646263 (patch)
tree16ba0a4ea081113fbe6a7f673218abf826520cc2
parentc638aa4a88116a1219cf4941aacd630e070db099 (diff)
Add property support for ReopenAttempts option.
-rw-r--r--include/evdev-properties.h4
-rw-r--r--src/evdev.c20
2 files changed, 24 insertions, 0 deletions
diff --git a/include/evdev-properties.h b/include/evdev-properties.h
index 6fdad53..b2b3f4b 100644
--- a/include/evdev-properties.h
+++ b/include/evdev-properties.h
@@ -54,4 +54,8 @@
/* BOOL, 2 values [x, y], 1 inverts axis */
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
+/* Reopen attempts. */
+/* CARD8 */
+#define EVDEV_PROP_REOPEN "Evdev Reopen Attempts"
+
#endif
diff --git a/src/evdev.c b/src/evdev.c
index d6848ff..46880a5 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -105,6 +105,7 @@ static void EvdevInitProperty(DeviceIntPtr dev);
static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
XIPropertyValuePtr val, BOOL checkonly);
static Atom prop_invert = 0;
+static Atom prop_reopen = 0;
#endif
@@ -1467,6 +1468,7 @@ EvdevInitProperty(DeviceIntPtr dev)
EvdevPtr pEvdev = pInfo->private;
int rc;
BOOL invert[2];
+ char reopen;
invert[0] = pEvdev->invert_x;
invert[1] = pEvdev->invert_y;
@@ -1480,6 +1482,17 @@ EvdevInitProperty(DeviceIntPtr dev)
return;
XISetDevicePropertyDeletable(dev, prop_invert, FALSE);
+
+ prop_reopen = MakeAtom(EVDEV_PROP_REOPEN, strlen(EVDEV_PROP_REOPEN),
+ TRUE);
+
+ reopen = pEvdev->reopen_attempts;
+ rc = XIChangeDeviceProperty(dev, prop_reopen, XA_INTEGER, 8,
+ PropModeReplace, 1, &reopen, FALSE);
+ if (rc != Success)
+ return;
+
+ XISetDevicePropertyDeletable(dev, prop_reopen, FALSE);
}
static int
@@ -1501,6 +1514,13 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
pEvdev->invert_x = data[0];
pEvdev->invert_y = data[1];
}
+ } else if (atom == prop_reopen)
+ {
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
+ if (!checkonly)
+ pEvdev->reopen_attempts = *((CARD8*)val->data);
}
return Success;