On Mon, Feb 7, 2011 at 7:39 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

Acked-by: Ping Cheng <pingli...@gmail.com>

Thank you for being so user friendly :).

Ping

> ---
> I added ClickForce too, not just the recently changed ones.
>
> Ping: sorry for the duplicate, I managed to misspell linuxwacom.
>
>  tools/xsetwacom.c |   63 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 63 insertions(+), 0 deletions(-)
>
> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
> index 57505f2..7a9c480 100644
> --- a/tools/xsetwacom.c
> +++ b/tools/xsetwacom.c
> @@ -94,6 +94,7 @@ typedef struct _param
>        enum printformat printformat;
>  } param_t;
>
> +
>  /* get_func/set_func calls for special parameters */
>  static void map_button(Display *dpy, XDevice *dev, param_t *param, int argc, 
> char **argv);
>  static void map_wheels(Display *dpy, XDevice *dev, param_t* param, int argc, 
> char **argv);
> @@ -107,6 +108,9 @@ static void get_all(Display *dpy, XDevice *dev, param_t 
> *param, int argc, char *
>  static void get_param(Display *dpy, XDevice *dev, param_t *param, int argc, 
> char **argv);
>  static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, 
> char **argv);
>
> +/* NOTE: When removing or changing a parameter name, add to
> + * deprecated_parameters.
> + */
>  static param_t parameters[] =
>  {
>        {
> @@ -375,6 +379,61 @@ static param_t parameters[] =
>        { NULL }
>  };
>
> +/**
> + * Deprecated parameters and their respective replacements.
> + */
> +struct deprecated
> +{
> +       const char *name;
> +       const char *replacement;
> +} deprecated_parameters[] =
> +{
> +       {"Button",      "Button"}, /* this covers Button1-32 */
> +       {"TopX",        "Area"},
> +       {"TopY",        "Area"},
> +       {"BottomX",     "Area"},
> +       {"BottomY",     "Area"},
> +       {"GetTabletID", "TabletID"},
> +       {"DebugLevel",  "ToolDebugLevel"},
> +       {"CommonDBG",   "TabletDebugLevel"},
> +       {"GetTabletID", "TabletID"},
> +       {"PressCurve",  "PressureCurve"},
> +       {"TPCButton",   "TabletPCButton"},
> +       {"CursorProx",  "CursorProximity"},
> +       {"xyDefault",   "ResetArea"},
> +       {"ClickForce",  "Threshold"},
> +       {NULL,          NULL}
> +};
> +
> +/**
> + * Check if name is deprecated and print out a warning if it is.
> + *
> + * @return True if deprecated, False otherwise.
> + */
> +static Bool
> +is_deprecated_parameter(const char *name)
> +{
> +       struct deprecated *d;
> +       Bool is_deprecated = False;
> +
> +       /* all others */
> +       for (d = deprecated_parameters; d->name; d++)
> +       {
> +               if (strncmp(name, d->name, strlen(d->name)) == 0)
> +               {
> +                       is_deprecated = True;
> +                       break;
> +               }
> +       }
> +
> +       if (is_deprecated)
> +               printf("Paramater '%s' is no longer in use. "
> +                       "It was replaced with '%s'.\n", name, d->replacement);
> +
> +       return is_deprecated;
> +
> +}
> +
>  struct modifier {
>        char *name;
>        char *converted;
> @@ -1411,6 +1470,8 @@ static void set(Display *dpy, int argc, char **argv)
>        param = find_parameter(argv[1]);
>        if (!param)
>        {
> +               if (is_deprecated_parameter(argv[1]))
> +                       goto out;
>                printf("Unknown parameter name '%s'.\n", argv[1]);
>                goto out;
>        } else if (param->prop_flags & PROP_FLAG_READONLY)
> @@ -1855,6 +1916,8 @@ static void get(Display *dpy, enum printformat 
> printformat, int argc, char **arg
>        param = find_parameter(argv[1]);
>        if (!param)
>        {
> +               if (is_deprecated_parameter(argv[1]))
> +                       return;
>                printf("Unknown parameter name '%s'.\n", argv[1]);
>                return;
>        } else if (param->prop_flags & PROP_FLAG_WRITEONLY)
> --
> 1.7.3.5
>

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to