On Sun, Oct 04, 2009 at 09:01:50AM -0700, Dan Nicholson wrote: > In order to give NewInputDeviceRequest more information, a new > InputProperties type is introduced. Currently, this collects the product > name, device path, and sets booleans for having keys and/or a pointer. > Only the HAL backend fills in the structure, though. > > Signed-off-by: Dan Nicholson <[email protected]> > --- > Xi/stubs.c | 3 ++- > config/dbus.c | 2 +- > config/hal.c | 11 ++++++++++- > hw/dmx/dmxinput.c | 3 ++- > hw/kdrive/src/kinput.c | 3 ++- > hw/xfree86/common/xf86Xinput.c | 3 ++- > hw/xquartz/darwinXinput.c | 3 ++- > include/input.h | 8 ++++++++ > 8 files changed, 29 insertions(+), 7 deletions(-) > > diff --git a/Xi/stubs.c b/Xi/stubs.c > index 400e937..ad08fea 100644 > --- a/Xi/stubs.c > +++ b/Xi/stubs.c > @@ -227,7 +227,8 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, > * > */ > int > -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) > +NewInputDeviceRequest(InputOption *options, InputProperties *props, > + DeviceIntPtr *pdev) > { > return BadValue; > } > diff --git a/config/dbus.c b/config/dbus.c > index 37462ac..86d9d28 100644 > --- a/config/dbus.c > +++ b/config/dbus.c > @@ -147,7 +147,7 @@ add_device(DBusMessage *message, DBusMessage *reply, > DBusError *error) > dbus_message_iter_next(&iter); > } > > - ret = NewInputDeviceRequest(options, &dev); > + ret = NewInputDeviceRequest(options, NULL, &dev); > if (ret != Success) { > DebugF("[config/dbus] NewInputDeviceRequest failed\n"); > goto unwind; > diff --git a/config/hal.c b/config/hal.c > index 28f55a0..0f83fd3 100644 > --- a/config/hal.c > +++ b/config/hal.c > @@ -191,6 +191,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) > { > char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL; > InputOption *options = NULL, *tmpo = NULL; > + InputProperties props = {0}; > DeviceIntPtr dev = NULL; > DBusError error; > struct xkb_options xkb_opts = {0}; > @@ -215,10 +216,18 @@ device_added(LibHalContext *hal_ctx, const char *udi) > LogMessage(X_WARNING,"config/hal: no driver or path specified for > %s\n", udi); > goto unwind; > } > + props.device = path; > > name = get_prop_string(hal_ctx, udi, "info.product"); > if (!name) > name = xstrdup("(unnamed)"); > + else > + props.name = name; > + > + if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL)) > + props.keyboard = TRUE; > + if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL)) > + props.pointer = TRUE; > > options = xcalloc(sizeof(*options), 1); > if (!options){ > @@ -400,7 +409,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) > > /* this isn't an error, but how else do you output something that the > user can see? */ > LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); > - if ((rc = NewInputDeviceRequest(options, &dev)) != Success) { > + if ((rc = NewInputDeviceRequest(options, &props, &dev)) != Success) { > LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed > (%d)\n", rc); > dev = NULL; > goto unwind; > diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c > index 5203e1a..4feb320 100644 > --- a/hw/dmx/dmxinput.c > +++ b/hw/dmx/dmxinput.c > @@ -103,7 +103,8 @@ void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr > pWindow) > } > > int > -NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) > +NewInputDeviceRequest (InputOption *options, InputProperties *props, > + DeviceIntPtr *pdev) > { > return BadRequest; > } > diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c > index fb8ebd0..ad2172c 100644 > --- a/hw/kdrive/src/kinput.c > +++ b/hw/kdrive/src/kinput.c > @@ -2249,7 +2249,8 @@ ChangeDeviceControl(register ClientPtr client, > DeviceIntPtr pDev, > } > > int > -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) > +NewInputDeviceRequest(InputOption *options, InputProperties *props, > + DeviceIntPtr *pdev) > { > InputOption *option = NULL; > KdPointerInfo *pi = NULL; > diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c > index b369537..0161067 100644 > --- a/hw/xfree86/common/xf86Xinput.c > +++ b/hw/xfree86/common/xf86Xinput.c > @@ -568,7 +568,8 @@ unwind: > } > > int > -NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) > +NewInputDeviceRequest (InputOption *options, InputProperties *props, > + DeviceIntPtr *pdev) > { > IDevRec *idev = NULL; > InputOption *option = NULL; > diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c > index 8af9fc7..f41170f 100644 > --- a/hw/xquartz/darwinXinput.c > +++ b/hw/xquartz/darwinXinput.c > @@ -230,7 +230,8 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, > * > */ > int > -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) > +NewInputDeviceRequest(InputOption *options, InputProperties *props, > + DeviceIntPtr *pdev) > { > DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); > return BadValue; > diff --git a/include/input.h b/include/input.h > index afcc006..683d031 100644 > --- a/include/input.h > +++ b/include/input.h > @@ -210,6 +210,13 @@ typedef struct _InputOption { > struct _InputOption *next; > } InputOption; > > +typedef struct _InputProperties { > + char *name; > + char *device; > + Bool keyboard; > + Bool pointer; > +} InputProperties;
how about a 'flags' field with the matching defines instead of two bools? this seems more future-proof in terms of ABI. Cheers, Peter > + > /* Key has been run through all input processing and events sent to clients. > */ > #define KEY_PROCESSED 1 > /* Key has not been fully processed, no events have been sent. */ > @@ -514,6 +521,7 @@ void FixUpEventFromWindow(DeviceIntPtr pDev, > /* Implemented by the DDX. */ > extern _X_EXPORT int NewInputDeviceRequest( > InputOption *options, > + InputProperties *props, > DeviceIntPtr *dev); > extern _X_EXPORT void DeleteInputDeviceRequest( > DeviceIntPtr dev); > -- > 1.6.2.5 _______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
