On Tue, Jan 19, 2016 at 09:26:27AM -0800, Jason Gerecke wrote:
> The 'last_type' variable within 'get_actions' stores the type of the last
> action encountered. When dealing with "key" or "button" actions, we use
> that information to determine if we need to print out the action prefix
> or not (if the type hasn't changed, its safe to leave the prefix out).
> 
> For some reason, this variable was marked as 'static', which causes it
> to retain its value across invocations. The function is only called once
> for any given button, meaning that we improperly retain the "last_type"
> across buttons. If the last action on a button is of e.g. type "key" and
> the first action of the next button is as well, then the "key" prefix
> will be missing from the printed output of that second button's actions.
> Making this variable non-static fixes this issue and ensures each run
> of the function is independent.
> 
> Fixes: http://sourceforge.net/p/linuxwacom/bugs/303/
> Fixes: https://github.com/linuxwacom/xf86-input-wacom/issues/3
> 
> Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>

Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>

for all three

Cheers,
   Peter

> ---
>  tools/xsetwacom.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
> index c1fec71..95f7a6c 100644
> --- a/tools/xsetwacom.c
> +++ b/tools/xsetwacom.c
> @@ -1951,6 +1951,7 @@ static int get_actions(Display *dpy, XDevice *dev,
>       unsigned long nitems, bytes_after, *data;
>       int i;
>       char buff[1024] = {0};
> +     int last_type;
>  
>       prop = XInternAtom(dpy, param->prop_name, True);
>  
> @@ -1979,9 +1980,9 @@ static int get_actions(Display *dpy, XDevice *dev,
>                  AnyPropertyType, &type, &format, &nitems,
>                  &bytes_after, (unsigned char**)&data);
>  
> +     last_type = 0;
>       for (i = 0; i < nitems; i++)
>       {
> -             static int last_type;
>               unsigned long action = data[i];
>               int current_type;
>               int detail;
> -- 
> 2.7.0
> 
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to