[PATCH:xf86-input-keyboard] Set XI_PROP_DEVICE_NODE property to string from "Device" option

Alexandr Shadchin alexandr.shadchin at gmail.com
Sun Apr 29 06:54:37 PDT 2012


Reviewed-by: Alexandr Shadchin <alexandr.shadchin at gmail.com>

small comment see below

On Fri, Apr 27, 2012 at 05:53:09PM -0700, Alan Coopersmith wrote:
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  man/kbd.man |    2 +-
>  src/kbd.c   |   19 +++++++++++++++++++
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/man/kbd.man b/man/kbd.man
> index c8d70cc..b1bd082 100644
> --- a/man/kbd.man
> +++ b/man/kbd.man
> @@ -40,7 +40,7 @@ are supported:
>  .TP 7
>  .BI "Option \*qDevice\*q \*q" string \*q
>  Specify the keyboard device.  Default: the OS's default console keyboard
> -input source.
> +input source.  Property: "Device Node" (read-only).
>  .TP 7
>  .BI "Option \*qProtocol\*q \*q" string \*q
>  Specify the keyboard protocol.  Valid protocol types include:
> diff --git a/src/kbd.c b/src/kbd.c
> index e04c340..f77bc95 100644
> --- a/src/kbd.c
> +++ b/src/kbd.c
> @@ -38,6 +38,10 @@
>  #include "xf86OSKbd.h"
>  #include "compiler.h"
>  
> +#include "exevents.h"
> +#include <X11/Xatom.h>
> +#include "xserver-properties.h"
> +
>  #include "xkbstr.h"
>  #include "xkbsrv.h"
>  
> @@ -328,6 +332,21 @@ KbdProc(DeviceIntPtr device, int what)
>                   return BadValue;
>               }
>           }
> +# ifdef XI_PROP_DEVICE_NODE
> +	 {
  ^^^^^^^^
replace tabulation on spaces

> +             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 */
>  #else
>           {
>               XkbComponentNamesRec xkbnames;
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel

-- 
Alexandr Shadchin



More information about the xorg-devel mailing list