On Sun, Apr 3, 2011 at 5:39 PM, Peter Hutterer <peter.hutte...@who-t.net>wrote:

> All tools on the same tablet share the rotation value, so if one of them is
> rotated, all of them must be. Since the property value is stored in the
> server, we need to trigger it explicitly.
>
> Test case:
> $> xsetwacom set "device name stylus" Rotate half
> $> xsetwacom get "device name eraser" Rotate
>
> Should print out the correct rotation value.
>
> Fixes #3070450
>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
>  src/wcmXCommand.c |   30 ++++++++++++++++++++++++++++++
>  1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> index 64ebb8d..9e0b1e8 100644
> --- a/src/wcmXCommand.c
> +++ b/src/wcmXCommand.c
> @@ -540,6 +540,33 @@ static int wcmSetStripProperty(DeviceIntPtr dev, Atom
> property,
>  }
>
>  /**
> + * Update the rotation property for all tools on the same physical tablet
> as
> + * pInfo.
> + */
> +static void wcmUpdateRotationProperty(WacomDevicePtr priv)
> +{
> +       WacomCommonPtr common = priv->common;
> +       WacomDevicePtr other;
> +       char rotation = common->wcmRotate;
> +
> +       for (other = common->wcmDevices; other; other = other->next)
> +       {
> +               InputInfoPtr pInfo;
> +               DeviceIntPtr dev;
> +
> +               if (other == priv)
> +                       continue;
> +
> +               pInfo = other->pInfo;
> +               dev = pInfo->dev;
> +
> +               XIChangeDeviceProperty(dev, prop_rotation, XA_INTEGER, 8,
> +                                      PropModeReplace, 1, &rotation,
> +                                      TRUE);
> +       }
> +}
> +
> +/**
>  * Only allow deletion of a property if it is not being used by any of the
>  * button actions.
>  */
> @@ -643,7 +670,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property,
> XIPropertyValuePtr prop,
>                        return BadValue;
>
>                if (!checkonly && common->wcmRotate != value)
> +               {
>                        wcmRotateTablet(pInfo, value);
>

My initial thought was that we might be able to merge wcmRotateTablet into
wcmUpdateRotationProperty. When I grep'd wcmRotateTablet, I saw it is also
called by wcmDevInit in xf86Wacom.c.

After looking into the content of wcmRotateTablet, I see the call in
wcmDevInit is unnecessary. So, we could remove the wcmRotateTablet call in
wcmDevInit and merge wcmRotateTablet and wcmUpdateRotationProperty.

However, the commit comments, "All tools on the same tablet share the
rotation value, so if one of them is rotated, all of them must be." makes me
think about the wcmRotate in wcmParseOptions (wcmValidateDevice.c). We
either should only allow one tool to set Rotation or need to make sure all
tools on the same tablet are rotated in the same way by xorg.conf.

Ping


> +                       wcmUpdateRotationProperty(priv);
> +               }
>        } else if (property == prop_serials)
>        {
>                return BadValue; /* Read-only */
> --
> 1.7.4.2
>
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to