On Thu, Feb 18, 2010 at 10:53:44PM -0600, Chris Bagwell wrote:
> Good.  I get to knock out two items at once: A code review and a
> question on porting a linuxwacom change.
> 
> In your description you say add 4 when more then 3 buttons.  So should
> "(nbbuttons > 4)" really be "(nbbuttons >= 4)" (or > 3)?

cood catch, thanks for that. I had the original condition as < 4 and then,
well, you know :) I have amended this to > 3 locally.

> linuxwacom-0.8.5-10 had related patch.  Its math looks buggy if there
> is such a thing as a tablet with 0, 1, or 2 buttons.
> 
>         /* support at least 7 buttons */
>         num_buttons = nbbuttons - 3 ? (7 + (nbbuttons - 3)) : 7;

ouch. this is broken - if nbuttons is 2, the condition evaluates as true and
we get 7 + (2 - 3) => 6 buttons. 
 
>         if (InitButtonClassDeviceStruct(local->dev, num_buttons,
> butmap) == FALSE)
> 
> Fixing to 7 buttons for 3 button case seems a little odd unless pads
> with <= 3 buttons can support touch gesture and we need to always
> reserve those 4-7 buttons to support scroll gesture (which uses
> buttonUp/buttonDown).
> 
> I prefer the simpler +4 approach and don't know enough yet if we
> should always fix to at least 7.

we should always have at least 7 buttons, yes. scroll events (regardless of
how they are produced) should alwasy be possible and there's no real
technical reason to force 3 buttons only on a device.

Cheers,
  Peter

> On Thu, Feb 18, 2010 at 9:38 PM, Peter Hutterer
> <[email protected]> wrote:
> > X expects buttons 4-7 to be the scrolling directions, hence if our device
> > has more than 3 buttons, we need to add 4 to the actual number of buttons
> > reported.
> >
> > Signed-off-by: Peter Hutterer <[email protected]>
> > ---
> > Alexia, I think this one is the reason for the bamboo button issue.
> >
> >
> >  src/xf86Wacom.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
> > index 872e4aa..15ce5a4 100644
> > --- a/src/xf86Wacom.c
> > +++ b/src/xf86Wacom.c
> > @@ -654,7 +654,7 @@ static int wcmRegisterX11Devices (LocalDevicePtr local)
> >                butmap[loop] = loop;
> >
> >        /* FIXME: button labels would be nice */
> > -       if (InitButtonClassDeviceStruct(local->dev, nbbuttons,
> > +       if (InitButtonClassDeviceStruct(local->dev, (nbbuttons > 4) ? 
> > nbbuttons + 4 : nbbuttons,
> >  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
> >                                        btn_labels,
> >  #endif
> > --
> > 1.6.6.1

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to