[PATCH] mi: ensure chained button mappings from SD -> MD (#19282)

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 11 22:36:25 PST 2009


On Fri, Jan 09, 2009 at 02:13:34PM -0500, Thomas Jaeger wrote:
> > that's not good. I think there's historical reason to do so, but by now the
> > drivers should just let button mapping to the DIX (unless they need something
> > really special). xsetwacom would be better off using libXi's
> > XSetDeviceButtonMapping.
> 
> I've got a problem now, though.  Apparently some wacom devices have
> various types of scroll wheels, and they are all mapped to button 4/5.
> I initially thought (because of a comment in ProcSetPointerMapping) that
> the restriction that no two physical buttons can be mapped to the same
> logical button was lifted for extended devices, but looking at the spec,
> this is not the case.  The other thing is that the wacom driver allows
> for buttons to mapped to a double click, which once again needs a
> duplicate assignment.  On older X servers, the situation is even worse
> because any XSetPointerMapping() call will override our settings.

this pretty much sums up the "really special" cases I mentioned in my previous
email.
The general rule for button mappings in the driver is - only map it if you do
purposly do not want users to remap this with standard X tools.

Another example I can think of is to remap a button in the driver that needs
to appear hard-wired to a different button.

> Because of all this, I'm inclined to just leave the device button map
> alone and handle all the remapping in the driver (see the attached patch).

ACK. The driver should not worry about the DIX button map, i.e. it should post
button 1 as button 1, regardless of the server's button mapping. 

Cheers,
  Peter

> From d760878f4c74a52467b0b9d5e4ac0ba0af4e583f Mon Sep 17 00:00:00 2001
> From: Thomas Jaeger <ThJaeger at gmail.com>
> Date: Fri, 9 Jan 2009 14:08:20 -0500
> Subject: [PATCH] Don't touch the button map
> 
> ---
>  src/xdrv/wcmCommon.c |   25 ++++++-------------------
>  1 files changed, 6 insertions(+), 19 deletions(-)
> 
> diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c
> index ff834f4..511bacf 100755
> --- a/src/xdrv/wcmCommon.c
> +++ b/src/xdrv/wcmCommon.c
> @@ -548,12 +548,7 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
>  	switch (button & AC_TYPE)
>  	{
>  	case AC_BUTTON:
> -/*		xf86PostButtonEvent(local->dev, is_absolute, button & AC_CODE,
> -*/		/* Dynamically modify the button map as required --
> -		 * to be moved in the place where button mappings are changed
> -		 */
> -		local->dev->button->map [button_idx] = button & AC_CODE;
> -		xf86PostButtonEvent(local->dev, is_absolute, button_idx,
> +		xf86PostButtonEvent(local->dev, is_absolute, button & AC_CODE,
>  			mask != 0,0,naxes,rx,ry,rz,v3,v4,v5);
>  		break;
>  
> @@ -599,27 +594,21 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
>  		break;
>  
>  	case AC_DBLCLICK:
> -		/* Dynamically modify the button map as required --
> -		 * to be moved in the place where button mappings are changed.
> -		 * Only left double is supported.
> -		 */
> -		local->dev->button->map [button_idx] = 1;
> -
>  		if (mask)
>  		{
>  			/* Left button down */
>  			xf86PostButtonEvent(local->dev, is_absolute,
> -				button_idx, 1,0,naxes, 
> +				1, 1,0,naxes, 
>  				rx,ry,rz,v3,v4,v5);
>  
>  			/* Left button up */
>  			xf86PostButtonEvent(local->dev, is_absolute,
> -				button_idx,0,0,naxes,
> +				1,0,0,naxes,
>  				rx,ry,rz,v3,v4,v5);
>  		}
>  
>  		/* Left button down/up upon mask is 1/0 */
> -		xf86PostButtonEvent(local->dev, is_absolute, button_idx, 
> +		xf86PostButtonEvent(local->dev, is_absolute, 1, 
>  			mask != 0,0,naxes,rx,ry,rz,v3,v4,v5);
>  		break;
>  	}
> @@ -748,12 +737,10 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d
>  	{
>  	    case AC_BUTTON:
>  		/* send both button on/off in the same event for pad */
> -		local->dev->button->map [0] = fakeButton & AC_CODE;
> -	
> -		xf86PostButtonEvent(local->dev, is_absolute, 0,
> +		xf86PostButtonEvent(local->dev, is_absolute, fakeButton & AC_CODE,
>  			1,0,naxes,x,y,z,v3,v4,v5);
>  
> -		xf86PostButtonEvent(local->dev, is_absolute, 0,
> +		xf86PostButtonEvent(local->dev, is_absolute, fakeButton & AC_CODE,
>  			0,0,naxes,x,y,z,v3,v4,v5);
>  	    break;




More information about the xorg mailing list