On Mon, Jan 18, 2016 at 9:01 PM, Peter Hutterer
<peter.hutte...@who-t.net> wrote:
> On Mon, Jan 18, 2016 at 10:48:57AM -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.
>>
>> Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
>> ---
>>  tools/xsetwacom.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
>> index c1fec71..3374d58 100644
>> --- a/tools/xsetwacom.c
>> +++ b/tools/xsetwacom.c
>> @@ -1981,7 +1981,7 @@ static int get_actions(Display *dpy, XDevice *dev,
>>
>>       for (i = 0; i < nitems; i++)
>>       {
>> -             static int last_type;
>> +             int last_type = 0;
>
> yes to the removal of static, but don't you need to move it out of the loop
> then? the point of last_type is that it retains the value of data[i-1] for
> comparison. If you remove the static, you can't be guaranteed of that.
>
> Cheers,
>    Peter
>

Derp. Update (along with some other related fixes) coming shortly.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....

------------------------------------------------------------------------------
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