On Wed, Apr 06, 2011 at 04:20:52PM -0700, Ping Cheng wrote:
> On Mon, Apr 4, 2011 at 11:53 PM, Peter Hutterer 
> <[email protected]>wrote:
> 
> >
> > We only rotate on a per-tablet basis, not per-tool. Don't accept rotation
> > values on dependent devices (unless they're the same, then be quiet about
> > it).
> >
> > Signed-off-by: Peter Hutterer <[email protected]>
> > ---
> > Changes to v1:
> > - use "parent device" in the man page (see the man page additions on the
> >  list)
> > - fix rotation setting for xorg.conf devices, mark devices
> >
> > side effect is that xorg.conf devices that specify different rotation for
> > different devices will not work as requested but at least that's a
> > long-standing bug anyway.
> >
> > we really need flags for hotplugged, parent and xorg.conf devices. but at
> > this stage in the cycle, that's more change than I'd like to introduce.
> >
> 
> I understand. The tag is based on the assumption that the patch is at least
> tested with hotplugging.

thanks. Yes, it's been tested with hotplugging and two different InputClass
section (one with normal wacom matching, one with matching on eraser)

Cheers,
  Peter
 
> >  man/wacom.man           |    4 +++-
> >  src/wcmConfig.c         |   23 ++++++++++++++++++++---
> >  src/wcmValidateDevice.c |   16 ++++++++++++----
> >  src/xf86Wacom.h         |    2 +-
> >  4 files changed, 36 insertions(+), 9 deletions(-)
> >
> > diff --git a/man/wacom.man b/man/wacom.man
> > index 1594836..797b388 100644
> > --- a/man/wacom.man
> > +++ b/man/wacom.man
> > @@ -138,7 +138,9 @@ can be an integer from -1 to 5.  Default is 3 for
> > capacitive tools and
> >  .B Option \fI"Rotate"\fP \fI"CW"|"CCW"|"HALF"|"NONE"\fP
> >  rotates the tablet orientation counterclockwise (CCW) or clockwise (CW) or
> > 180 degrees (HALF).
> >  If you have specific tablet mappings, i.e. TopX/Y or BottomX/Y were set,
> > the mapping will be
> > -applied before rotation. The default is "NONE".
> > +applied before rotation. Rotation must be applied to the parent device
> > +(usually the stylus), rotation settings on hotplugged devices will be
> > +ignored. The default is "NONE".
> >  .TP 4
> >  .B Option \fI"PressCurve"\fP \fI"x1,y1,x2,y2"\fP
> >  sets pressure curve by control points x1, y1, x2, and y2.  Their values
> > are in range
> > diff --git a/src/wcmConfig.c b/src/wcmConfig.c
> > index 4caa529..3ccd902 100644
> > --- a/src/wcmConfig.c
> > +++ b/src/wcmConfig.c
> > @@ -448,6 +448,21 @@ static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
> >        }
> >  }
> >
> > +/**
> > + * Check if this device was hotplugged by the driver by checking the
> > _source
> > + * option.
> > + *
> > + * Must be called before wcmNeedAutoHotplug()
> > + *
> > + * @return True if the source for this device is the wacom driver itself
> > or
> > + * false otherwise.
> > + */
> > +static int wcmIsHotpluggedDevice(InputInfoPtr pInfo)
> > +{
> > +       char *source = xf86CheckStrOption(pInfo->options, "_source", "");
> > +       return !strcmp(source, "_driver/wacom");
> > +}
> > +
> >  /* wcmPreInit - called for each input devices with the driver set to
> >  * "wacom" */
> >  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
> > @@ -487,7 +502,7 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr
> > pInfo, int flags)
> >        WacomCommonPtr common = NULL;
> >        const char*     type;
> >        char*           device, *oldname;
> > -       int             need_hotplug = 0;
> > +       int             need_hotplug = 0, is_dependent = 0;
> >
> >        gWacomModule.wcmDrv = drv;
> >
> > @@ -534,7 +549,9 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr
> > pInfo, int flags)
> >
> >        oldname = pInfo->name;
> >
> > -       if ((need_hotplug = wcmNeedAutoHotplug(pInfo, &type)))
> > +       if (wcmIsHotpluggedDevice(pInfo))
> > +               is_dependent = 1;
> > +       else if ((need_hotplug = wcmNeedAutoHotplug(pInfo, &type)))
> >        {
> >                /* we need subdevices, change the name so all of them have a
> >                   type. */
> > @@ -551,7 +568,7 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr
> > pInfo, int flags)
> >        if (!wcmSetType(pInfo, type))
> >                goto SetupProc_fail;
> >
> > -       if (!wcmParseOptions(pInfo, need_hotplug))
> > +       if (!wcmParseOptions(pInfo, need_hotplug, is_dependent))
> >                goto SetupProc_fail;
> >
> >        if (!wcmInitModel(pInfo))
> > diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
> > index 0b03952..610da22 100644
> > --- a/src/wcmValidateDevice.c
> > +++ b/src/wcmValidateDevice.c
> > @@ -513,6 +513,7 @@ int wcmNeedAutoHotplug(InputInfoPtr pInfo, const char
> > **type)
> >        xf86Msg(X_INFO, "%s: type not specified, assuming '%s'.\n",
> > pInfo->name, *type);
> >        xf86Msg(X_INFO, "%s: other types will be automatically added.\n",
> > pInfo->name);
> >
> > +       /* Note: wcmIsHotpluggedDevice() relies on this */
> >        pInfo->options = xf86AddNewOption(pInfo->options, "Type", *type);
> >        pInfo->options = xf86ReplaceStrOption(pInfo->options, "_source",
> > "_driver/wacom");
> >
> > @@ -521,12 +522,16 @@ int wcmNeedAutoHotplug(InputInfoPtr pInfo, const char
> > **type)
> >
> >  /**
> >  * Parse the options for this device.
> > + * Note that parameters is_primary and is_dependent are mutually
> > exclusive,
> > + * though both may be false in the case of an xorg.conf device.
> >  *
> > - * @param is_primary True if the device is the primary/parent device for
> > + * @param is_primary True if the device is the parent device for
> >  * hotplugging, False if the device is a depent or xorg.conf device.
> > + * @param is_hotplugged True if the device is a dependent device, FALSE
> > + * otherwise.
> >  * @retvalue True on success or False otherwise.
> >  */
> > -Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary)
> > +Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool
> > is_dependent)
> >  {
> >        WacomDevicePtr  priv = (WacomDevicePtr)pInfo->private;
> >        WacomCommonPtr  common = priv->common;
> > @@ -588,8 +593,11 @@ Bool wcmParseOptions(InputInfoPtr pInfo, Bool
> > is_primary)
> >                         goto error;
> >                }
> >
> > -               common->wcmRotate = rotation;
> > -
> > +               if (is_dependent && rotation != common->wcmRotate)
> > +                       xf86Msg(X_INFO, "%s: ignoring rotation of
> > dependent"
> > +                                       " device\n", pInfo->name);
> > +               else
> > +                       common->wcmRotate = rotation;
> >        }
> >
> >        common->wcmRawSample = xf86SetIntOption(pInfo->options, "RawSample",
> > diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
> > index 5351be2..013d378 100644
> > --- a/src/xf86Wacom.h
> > +++ b/src/xf86Wacom.h
> > @@ -140,7 +140,7 @@ extern int wcmNeedAutoHotplug(InputInfoPtr pInfo, const
> > char **type);
> >  extern void wcmHotplugOthers(InputInfoPtr pInfo, const char *basename);
> >
> >  /* setup */
> > -extern Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary);
> > +extern Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool
> > is_dependent);
> >  extern void wcmInitialCoordinates(InputInfoPtr pInfo, int axes);
> >  extern void wcmInitialScreens(InputInfoPtr pInfo);
> >  extern void wcmInitialScreens(InputInfoPtr pInfo);
> > --
> > 1.7.4.2
> >

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to