On Sun, Nov 21, 2010 at 06:13:37PM -0600, ch...@cnpbagwell.com wrote:
> From: Chris Bagwell <ch...@cnpbagwell.com>
> 
> The code to set nbuttons for non-pad buttons was checking
> for a lot of buttons that no current wacom tablets send
> or that is understood by xf86-input-wacom.  Remove that
> dead code.
> 
> The remaining logic seem to be trying to detect mouse
> versus other tools (stylus mainly) and set button count
> based on that.
> 
> Changed to look for BTN_TOOL_MOUSE to work with wider range
> of tablets without special checks.
> 
> Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
> ---

All four patches merged, thanks.

Cheers,
  Peter

>  src/wcmUSB.c |   29 ++++++++++++++---------------
>  1 files changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 90e8cf6..df8737b 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -28,9 +28,6 @@
>  #include <linux/input.h>
>  #include <sys/utsname.h>
>  
> -#ifndef BTN_TASK
> -#define BTN_TASK 0x117
> -#endif
>  #define MAX_USB_EVENTS 32
>  
>  typedef struct {
> @@ -147,7 +144,7 @@ usbStart(InputInfoPtr pInfo)
>  }
>  
>  /* Key codes used to mark tablet buttons -- must be in sync
> - * with the keycode array in wacom.c kernel driver.
> + * with the keycode array in wacom kernel drivers.
>   */
>  static unsigned short padkey_codes [] = {
>       BTN_0, BTN_1, BTN_2, BTN_3, BTN_4,
> @@ -158,6 +155,11 @@ static unsigned short padkey_codes [] = {
>       BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_SELECT
>  };
>  
> +/* Fixed mapped stylus and mouse buttons */
> +
> +#define WCM_USB_MAX_MOUSE_BUTTONS 5
> +#define WCM_USB_MAX_STYLUS_BUTTONS 3
> +
>  static struct
>  {
>       const unsigned int vendor_id;
> @@ -340,18 +342,15 @@ static Bool usbWcmInit(InputInfoPtr pInfo, char* id, 
> float *version)
>               if (ISBITSET (common->wcmKeys, padkey_codes [i]))
>                       common->padkey_code [common->npadkeys++] = padkey_codes 
> [i];
>  
> -     if (ISBITSET (common->wcmKeys, BTN_TASK))
> -             common->nbuttons = 10;
> -     else if (ISBITSET (common->wcmKeys, BTN_BACK))
> -             common->nbuttons = 9;
> -     else if (ISBITSET (common->wcmKeys, BTN_FORWARD))
> -             common->nbuttons = 8;
> -     else if (ISBITSET (common->wcmKeys, BTN_EXTRA))
> -             common->nbuttons = 7;
> -     else if (ISBITSET (common->wcmKeys, BTN_SIDE))
> -             common->nbuttons = 6;
> +     /* nbuttons tracks maximum buttons on all tools (stylus/mouse).
> +      *
> +      * Mouse support left, middle, right, side, and extra side button.
> +      * Stylus support tip and 2 stlyus buttons.
> +      */
> +     if (ISBITSET (common->wcmKeys, BTN_TOOL_MOUSE))
> +             common->nbuttons = WCM_USB_MAX_MOUSE_BUTTONS;
>       else
> -             common->nbuttons = 5;
> +             common->nbuttons = WCM_USB_MAX_STYLUS_BUTTONS;
>  
>       return Success;
>  }
> -- 
> 1.7.3.2
 

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to