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.
This affects the internal default button map as well, physical buttons need to be offset by 4 after the first three. Signed-off-by: Peter Hutterer <[email protected]> --- Thanks for the reviews on the first one, this one looks better now, hopefully. AFAICT the linuxwacom commit Ping pointed me to is still buggy though. http://linuxwacom.cvs.sourceforge.net/viewvc/linuxwacom/linuxwacom-dev/src/xdrv/xf86Wacom.c?r1=1.66&r2=1.67 When I tried this approach, two of my pad buttons (button 3 and 4) would scroll instead of being actual buttons. I think the first hunk of this patch would be applicable to linuxwacom as well. Cheers, Peter src/wcmConfig.c | 5 +++-- src/xf86Wacom.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wcmConfig.c b/src/wcmConfig.c index af3b95b..5d07fc9 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -99,9 +99,10 @@ static int wcmAllocate(LocalDevicePtr local, char* type_name, int flag) priv->nPressCtrl [2] = 100; /* pressure curve x1 */ priv->nPressCtrl [3] = 100; /* pressure curve y1 */ - /* Default button and expresskey values */ + /* Default button and expresskey values, offset buttons 4 and higher + * by the 4 scroll buttons. */ for (i=0; i<WCM_MAX_BUTTONS; i++) - priv->button[i] = i + 1; + priv->button[i] = (i < 3) ? i + 1 : i + 5; priv->nbuttons = WCM_MAX_BUTTONS; /* Default number of buttons */ priv->relup = 5; /* Default relative wheel up event */ diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c index 872e4aa..68df886 100644 --- a/src/xf86Wacom.c +++ b/src/xf86Wacom.c @@ -634,6 +634,9 @@ static int wcmRegisterX11Devices (LocalDevicePtr local) nbaxes = priv->naxes; /* X, Y, Pressure, Tilt-X, Tilt-Y, Wheel */ nbbuttons = priv->nbuttons; /* Use actual number of buttons, if possible */ + + /* if more than 3 buttons, offset by the four scroll buttons */ + nbbuttons = (nbbuttons > 3) ? nbbuttons + 4 : nbbuttons; nbkeys = nbbuttons; /* Same number of keys since any button may be * configured as an either mouse button or key */ -- 1.6.6.1 ------------------------------------------------------------------------------ Download Intel® 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
