On Thu, Mar 24, 2011 at 10:54:26AM -0700, Jason Gerecke wrote:
> On Wed, Mar 23, 2011 at 6:30 PM, Peter Hutterer
> <[email protected]> wrote:
> > On Wed, Mar 23, 2011 at 12:58:21PM -0700, Jason Gerecke wrote:
> >> As I'm working on the X11 wheel mapping, I'm finding a few weird
> >> quirks in the code. I pretty much understand 'how' things work, but
> >> I'm not sure why some things are the way they are...
> >>
> >> 1. Why does WACOM_PROP_BUTTON_ACTIONS have room for only 16 buttons,
> >> yet priv->btn_actions (storing the same data) have space for 32? The
> >> functional difference between WCM_MAX_BUTTONS and
> >> WCM_MAX_MOUSE_BUTTONS is not clear.
> >
> > 7d149431c63c43c0ab5b046387b565488ea3d159 has some explanation what
> > WCM_MAX_BUTTONS is, but I can't remember any more details.
> > They were introduced in 2debfce6f9d6bfb206da2e1711d04f42cddd71e1, but
> > the comments in that commit don't really clarify things for me.
> >
> I was hoping it was related to some kind of X server limitation, but
> if you don't have any ideas... I guess I'll stare at it and scratch my
> head some more :D

the server has a MAX_BUTTONS define of 256. it may have been 32 in the past.
though what I suspect is that this was copied from the mouse driver which
had a maxbuttons define for 32. the core protocol certainly supports up to
256 buttons.

> >> 2. Why maintain a seperate raw button codepath when the "actions"
> >> codepath already does the same thing when given a 'button' action?
> >
> > simplicity mainly (and the raw path was there before). note that the button
> > action can be combined with a key action, so "key +ctrl button 1 key -ctrl"
> > is a valid action.
> >
> Would there be any objection to me tearing the raw path out of the
> driver? The two paths are very similar, and nearly duplicate each
> other. The only substantial difference is that non-raw buttons have
> their keys[] interpreted.

no objection. code readability and simplification beats run-time efficiency
any day :)
(note though that the raw button path happens if there is no property
assigned to it but I guess you're aware of that already)

Cheers,
  Peter

> >> 3. Why does xsetwacom take X11 buttons as the first argument to
> >> "Button X"? I can't be alone in thinking it was weird my cintiq was
> >> missing two buttons (6 & 7) and that two other buttons (4 & 5) only
> >> responded to changes via the Strip(Left|Right)(Up|Down) command.
> >
> > This should be documented better. Button mapping in X is complicated to say
> > the least. http://who-t.blogspot.com/2009/06/button-mapping-in-x.html
> >
> > xsetwacom takes x11 buttons because for simple button mappings, it uses
> > XSetDeviceButtonMappings (which requires X buttons).
> > X buttons have the advantage of being easy to debug (for users). A
> > driver-internal button mapping is private to the driver and hard to figure
> > out at the best of times. e.g. which button on your device is Button 1?
> > running xev or xinput will only tell you the logical button 1, not the
> > physical button 1.
> >
> That's a pretty good argument, I suppose. It seems ugly and has
> non-intuitive side-effects, but it has its benefits.

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to