Ok, it is morning here.  I got my vision back :).

Thank you for the explanation and for taking care of the
xf86-input-wacom version of xsetwacom, which enables the project to
support current/future and legacy X servers simultaneously.

Ping

On Wed, Jun 2, 2010 at 4:31 AM, Peter Hutterer <peter.hutte...@who-t.net> wrote:
> On Wed, Jun 02, 2010 at 12:31:22AM -0700, Ping Cheng wrote:
>> My brain doesn't work after middle night. Why do we need
>>
>> +       *ndata += 1;
>>
>> Do we toggle between 0 and 1?
>
> this is part of the xsetwacom "design". all the special_map_foobar() take
> ndata and data as in/out values. they're expected to fill data and increase
> ndata accordingly. So if you drop two values into data, ndata += 2.
>
> the caller then takes the data array and sets the properties accordingly.
>
> Cheers,
>  Peter
>
>> On Tue, Jun 1, 2010 at 9:43 PM, Peter Hutterer <peter.hutte...@who-t.net> 
>> wrote:
>> > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
>> > ---
>> >  tools/xsetwacom.c |   11 +++++++++++
>> >  1 files changed, 11 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
>> > index 3aea33d..b0a2f39 100644
>> > --- a/tools/xsetwacom.c
>> > +++ b/tools/xsetwacom.c
>> > @@ -1195,6 +1195,7 @@ static int is_modifier(const char* modifier)
>> >  static int special_map_keystrokes(int argc, char **argv, unsigned long 
>> > *ndata, unsigned long* data);
>> >  static int special_map_button(int argc, char **argv, unsigned long 
>> > *ndata, unsigned long* data);
>> >  static int special_map_core(int argc, char **argv, unsigned long *ndata, 
>> > unsigned long *data);
>> > +static int special_map_modetoggle(int argc, char **argv, unsigned long 
>> > *ndata, unsigned long *data);
>> >
>> >  /* Valid keywords for the --set ButtonX options */
>> >  struct keywords {
>> > @@ -1204,6 +1205,7 @@ struct keywords {
>> >        {"key", special_map_keystrokes},
>> >        {"button", special_map_button},
>> >        {"core", special_map_core},
>> > +       {"modetoggle", special_map_modetoggle},
>> >        { NULL, NULL }
>> >  };
>> >
>> > @@ -1221,6 +1223,15 @@ static int special_map_core(int argc, char **argv, 
>> > unsigned long *ndata, unsigne
>> >        return 0;
>> >  }
>> >
>> > +static int special_map_modetoggle(int argc, char **argv, unsigned long 
>> > *ndata, unsigned long *data)
>> > +{
>> > +       data[*ndata] = AC_MODETOGGLE;
>> > +
>> > +       *ndata += 1;
>> > +
>> > +       return 0;
>> > +}
>> > +
>> >  static inline int is_valid_keyword(const char *keyword)
>> >  {
>> >        struct keywords *kw = keywords;
>> > --
>> > 1.7.0.1
>> >
>> >
>

------------------------------------------------------------------------------

_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to