[PATCH evdev 1/3] Rename evdev->tool to evdev->proximity.

Chris Bagwell chris at cnpbagwell.com
Mon Oct 11 16:42:08 PDT 2010


Reviewed-by: Chris Bagwell <chris at cnpbagwell.com>

On Sun, Oct 10, 2010 at 6:33 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> evdev doesn't care about the actual tool used, only that it is used as an
> indicator for proximity. Rename the field accordingly to make the code more
> obvious to read.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev.c |   18 +++++++++---------
>  src/evdev.h |    2 +-
>  2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 1720f96..9e1fb10 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -363,7 +363,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
>
>     /* convert to relative motion for touchpads */
>     if (pEvdev->abs && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
> -        if (pEvdev->tool) { /* meaning, touch is active */
> +        if (pEvdev->proximity) {
>             if (pEvdev->old_vals[0] != -1)
>                 pEvdev->delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
>             if (pEvdev->old_vals[1] != -1)
> @@ -414,11 +414,11 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
>      * pressed.  On wacom tablets, this means that the pen is in
>      * proximity of the tablet.  After the pen is removed, BTN_TOOL_PEN is
>      * released, and a (0, 0) absolute event is generated.  Checking
> -     * pEvdev->tool here, lets us ignore that event.  pEvdev is
> +     * pEvdev->proximity here lets us ignore that event.  pEvdev is
>      * initialized to 1 so devices that doesn't use this scheme still
>      * just works.
>      */
> -    else if (pEvdev->abs && pEvdev->tool) {
> +    else if (pEvdev->abs && pEvdev->proximity) {
>         memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals);
>
>         if (pEvdev->swap_axes) {
> @@ -591,7 +591,7 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
>         case BTN_TOOL_FINGER:
>         case BTN_TOOL_MOUSE:
>         case BTN_TOOL_LENS:
> -            pEvdev->tool = value ? ev->code : 0;
> +            pEvdev->proximity = value ? ev->code : 0;
>             break;
>
>         case BTN_TOUCH:
> @@ -636,11 +636,11 @@ EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
>      * pressed.  On wacom tablets, this means that the pen is in
>      * proximity of the tablet.  After the pen is removed, BTN_TOOL_PEN is
>      * released, and a (0, 0) absolute event is generated.  Checking
> -     * pEvdev->tool here, lets us ignore that event.  pEvdev->tool is
> +     * pEvdev->proximity here lets us ignore that event. pEvdev->proximity is
>      * initialized to 1 so devices that don't use this scheme still
>      * just work.
>      */
> -    if (pEvdev->abs && pEvdev->tool) {
> +    if (pEvdev->abs && pEvdev->proximity) {
>         xf86PostMotionEventP(pInfo->dev, TRUE, first_v, num_v, v + first_v);
>     }
>  }
> @@ -662,7 +662,7 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v,
>             break;
>         case EV_QUEUE_BTN:
>  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
> -            if (pEvdev->abs && pEvdev->tool) {
> +            if (pEvdev->abs && pEvdev->proximity) {
>                 xf86PostButtonEventP(pInfo->dev, 1, pEvdev->queue[i].key,
>                                      pEvdev->queue[i].val, first_v, num_v,
>                                      v + first_v);
> @@ -2112,10 +2112,10 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
>         goto error;
>
>     /*
> -     * We initialize pEvdev->tool to 1 so that device that doesn't use
> +     * We initialize pEvdev->proximity to 1 so that device that doesn't use
>      * proximity will still report events.
>      */
> -    pEvdev->tool = 1;
> +    pEvdev->proximity = 1;
>
>     /* Grabbing the event device stops in-kernel event forwarding. In other
>        words, it disables rfkill and the "Macintosh mouse button emulation".
> diff --git a/src/evdev.h b/src/evdev.h
> index ce7f5f8..b382670 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -124,7 +124,7 @@ typedef struct {
>     int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */
>
>     int flags;
> -    int tool;
> +    int proximity;
>     int num_buttons;            /* number of buttons */
>     BOOL swap_axes;
>     BOOL invert_x;
> --
> 1.7.2.3
>
> _______________________________________________
> 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
>


More information about the xorg-devel mailing list