summaryrefslogtreecommitdiff
path: root/src/mouse.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-04-27 15:44:00 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-04-30 20:15:48 -0700
commit4b6738c8409fe73596863b37a8fcad8ae352d121 (patch)
treeb53bc7dd20a25981ee3af8bb91291d2500a9cb9e /src/mouse.c
parent5583a77bbadd2e89cbc69a66f27deee1a5da982c (diff)
downloadxorg-driver-xf86-input-mouse-4b6738c8409fe73596863b37a8fcad8ae352d121.tar.gz
Set XI_PROP_DEVICE_NODE property to string from "Device" option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Alexandr Shadchin <alexandr.shadchin@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mouse.c b/src/mouse.c
index f4c7c82..e801133 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -62,6 +62,9 @@
#include "xf86Xinput.h"
#include "xf86_OSproc.h"
+#include "exevents.h"
+#include <X11/Xatom.h>
+#include "xserver-properties.h"
#include "compiler.h"
@@ -1019,6 +1022,25 @@ out:
return rc;
}
+static void
+MouseInitProperties(DeviceIntPtr device)
+{
+ InputInfoPtr pInfo = device->public.devicePrivate;
+
+#ifdef XI_PROP_DEVICE_NODE
+ const char *device_node =
+ xf86CheckStrOption(pInfo->options, "Device", NULL);
+
+ if (device_node)
+ {
+ Atom prop_device = MakeAtom(XI_PROP_DEVICE_NODE,
+ strlen(XI_PROP_DEVICE_NODE), TRUE);
+ XIChangeDeviceProperty(device, prop_device, XA_STRING, 8,
+ PropModeReplace,
+ strlen(device_node), device_node, FALSE);
+ }
+#endif /* XI_PROP_DEVICE_NODE */
+}
static void
MouseReadInput(InputInfoPtr pInfo)
@@ -1616,6 +1638,7 @@ MouseProc(DeviceIntPtr device, int what)
ErrorF("assigning %p atom=%d name=%s\n", device, pInfo->atom,
pInfo->name);
#endif
+ MouseInitProperties(device);
break;
case DEVICE_ON: