diff options
-rw-r--r-- | man/mousedrv.man | 3 | ||||
-rw-r--r-- | src/mouse.c | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/man/mousedrv.man b/man/mousedrv.man index 23528f6..c9c2744 100644 --- a/man/mousedrv.man +++ b/man/mousedrv.man @@ -113,8 +113,9 @@ protocol setting is platform-specific. .BI "Option \*qDevice\*q \*q" string \*q Specifies the device through which the mouse can be accessed. A common setting is "/dev/mouse", which is often a symbolic link to the real -device. This option is mandatory, and there is no default setting. The server +device. This option is mandatory, and there is no default setting. The driver may however attempt to probe some default devices if this option is missing. +Property: "Device Node" (read-only). .TP 7 .BI "Option \*qButtons\*q \*q" integer \*q Specifies the number of mouse buttons. In cases where the number of buttons 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: |