[PATCH evdev 2/2] Reshuffle to avoid the need for XI86_CONFIGURED.

Benjamin Tissoires tissoire at cena.fr
Tue Oct 26 05:06:36 PDT 2010



Le 26/10/2010 02:11, Peter Hutterer a écrit :
> Signed-off-by: Peter Hutterer<peter.hutterer at who-t.net>
> ---
>   src/evdev.c |   22 +++++++++++++---------
>   1 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 018843f..940f24d 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -63,7 +63,6 @@
>
>   #if GET_ABI_MAJOR(ABI_XINPUT_VERSION)>= 12
>   /* removed from server, purge when dropping support for server 1.10 */
> -#define XI86_CONFIGURED         0x02
>   #define XI86_SEND_DRAG_EVENTS   0x08
>   #endif
>
> @@ -1916,6 +1915,7 @@ EvdevProbe(InputInfoPtr pInfo)
>       int has_lmr; /* left middle right */
>       int ignore_abs = 0, ignore_rel = 0;
>       EvdevPtr pEvdev = pInfo->private;
> +    int rc = 1;
>
>       /* Trinary state for ignoring axes:
>          - unset: do the normal thing.
> @@ -2082,7 +2082,7 @@ EvdevProbe(InputInfoPtr pInfo)
>       }
>
>       if (has_rel_axes || has_abs_axes || num_buttons) {
> -        pInfo->flags |= XI86_SEND_DRAG_EVENTS | XI86_CONFIGURED;
> +        pInfo->flags |= XI86_SEND_DRAG_EVENTS;
>   	if (pEvdev->flags&  EVDEV_TOUCHPAD) {
>   	    xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
>   	    pInfo->type_name = XI_TOUCHPAD;
> @@ -2096,29 +2096,29 @@ EvdevProbe(InputInfoPtr pInfo)
>   	    xf86Msg(X_INFO, "%s: Configuring as mouse\n", pInfo->name);
>   	    pInfo->type_name = XI_MOUSE;
>   	}
> +
> +        rc = 0;
>       }
>
>       if (has_keys) {
>           xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name);
> -        pInfo->flags |= XI86_CONFIGURED;
>           pInfo->type_name = XI_KEYBOARD;
> +        rc = 0;
>       }
>
> -    if (has_scroll&&  (pInfo->flags&  XI86_CONFIGURED)&&
> -        (has_rel_axes || has_abs_axes))
> +    if (has_scroll&&
> +        (has_rel_axes || has_abs_axes || num_buttons || has_keys))
>       {
>           xf86Msg(X_INFO, "%s: Adding scrollwheel support\n", pInfo->name);
>           pEvdev->flags |= EVDEV_BUTTON_EVENTS;
>           pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
>       }
>
> -    if ((pInfo->flags&  XI86_CONFIGURED) == 0) {
> +    if (rc)
>           xf86Msg(X_WARNING, "%s: Don't know how to use device\n",
>   		pInfo->name);
> -        return 1;
> -    }
>
> -    return 0;
> +    return rc;
>   }
>
>   static void
> @@ -2214,7 +2214,11 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>       xf86ProcessCommonOptions(pInfo, pInfo->options);
>
>       if (NewEvdevPreInit(drv, pInfo, flags) == Success)
> +    {
> +        pInfo->flags = XI86_CONFIGURED;

You just undefined XI86_CONFIGURED... I'm a bit lost here.
The define seems to have been purged in ABI_XINPUT >= 12, so shouldn't 
we #ifdef this or no?

The rest of the patch seems good.

Cheers,
Benjamin

>           return pInfo;
> +    }
> +
>
>       xf86DeleteInput(pInfo, 0);
>       return NULL;


More information about the xorg-devel mailing list