diff options
author | Ping Cheng <pingc@wacom.com> | 2009-12-14 20:51:13 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-16 14:02:09 +1000 |
commit | 1721220517c2e5d4833ea1bb116b10c1e4e2fa62 (patch) | |
tree | 4a7b8e7cee78bd451c0f85b9f925e27b524c1941 | |
parent | 7c3c5c02cc80596f89a56b19eae40a28627162bb (diff) | |
download | xf86-input-wacom-1721220517c2e5d4833ea1bb116b10c1e4e2fa62.tar.gz |
Set Touch and Gesture options during the configuration
We moved the touch and gesture option check from usbWcmInit
to wcmValidateDevice.c since usbWcmInit gets called every time
the device is opened, which is unnecessary for option check
in most cases.
The Tablet PC Button option should also be dealt in the same way.
But it requires extra defines to make it clean, which will affect
more files in the driver. We'll do it in a separate patch later.
Signed-off-by: Ping Cheng <pinglinux@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/wcmConfig.c | 4 | ||||
-rw-r--r-- | src/wcmISDV4.c | 16 | ||||
-rw-r--r-- | src/wcmUSB.c | 25 | ||||
-rw-r--r-- | src/wcmValidateDevice.c | 25 |
4 files changed, 24 insertions, 46 deletions
diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 9a51596..2552ce1 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -32,7 +32,7 @@ extern int wcmIsDuplicate(char* device, LocalDevicePtr local); extern int wcmNeedAutoHotplug(LocalDevicePtr local, const char **type, unsigned long* keys); extern int wcmAutoProbeDevice(LocalDevicePtr local); -extern int wcmParseOptions(LocalDevicePtr local); +extern int wcmParseOptions(LocalDevicePtr local, unsigned long* keys); extern void wcmHotplugOthers(LocalDevicePtr local, unsigned long* keys); extern int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys); @@ -386,7 +386,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) /* Process the common options. */ xf86ProcessCommonOptions(local, local->options); - if (!wcmParseOptions(local)) + if (!wcmParseOptions(local, keys)) goto SetupProc_fail; /* mark the device configured */ diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index 6c70dc3..e684388 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -362,23 +362,7 @@ static int isdv4GetRanges(LocalDevicePtr local) (int)(1 << data[1]); if (data[1]) - { common->wcmTouchResolX = common->wcmTouchResolY = 10; - common->wcmTouchDefault = 1; - } - else - common->wcmTouchDefault = 0; - - /* update touch info */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", - common->wcmTouchDefault); - - if ((common->tablet_id == 0xE2) || - (common->tablet_id == 0xE3)) - common->wcmGestureDefault = 1; - - common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", - common->wcmGestureDefault); common->wcmVersion = ( data[10] | (data[9] << 7) ); ret = Success; diff --git a/src/wcmUSB.c b/src/wcmUSB.c index b5b69a3..ff5d875 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -535,28 +535,13 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmResolY = WacomModelDesc [i].yRes; } - /* a single touch device */ - if (ISBITSET (keys, BTN_TOOL_DOUBLETAP)) - { - /* TouchDefault was off for all devices - * except when touch is supported */ - common->wcmTouchDefault = 1; - } - else if (common->wcmModel && + if (common->wcmModel && strstr(common->wcmModel->name, "TabletPC")) { /* For penabled Tablet PCs, Tablet PC Button * are on by default */ common->wcmTPCButtonDefault = 1; } - - /* 2FG touch device */ - if (ISBITSET (keys, BTN_TOOL_TRIPLETAP)) - { - /* GestureDefault was off for all devices - * except when multi-touch is supported */ - common->wcmGestureDefault = 1; - } } if (!common->wcmModel) @@ -565,14 +550,6 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmResolX = common->wcmResolY = 1016; } - /* check if touch was turned off in xorg.conf */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", - common->wcmTouchDefault); - - /* Touch gesture applies to the whole tablet */ - common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", - common->wcmGestureDefault); - /* check if TPCButton was turned off in xorg.conf for pen */ if (priv->flags & STYLUS_ID) common->wcmTPCButton = xf86SetBoolOption(local->options, diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 45508be..0d5fe14 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -34,7 +34,7 @@ int wcmNeedAutoHotplug(LocalDevicePtr local, const char **type, unsigned long* keys); void wcmHotplugOthers(LocalDevicePtr local, unsigned long* keys); int wcmAutoProbeDevice(LocalDevicePtr local); -int wcmParseOptions(LocalDevicePtr local); +int wcmParseOptions(LocalDevicePtr local, unsigned long* keys); int wcmIsDuplicate(char* device, LocalDevicePtr local); int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys); @@ -394,7 +394,7 @@ int wcmNeedAutoHotplug(LocalDevicePtr local, const char **type, return 1; } -int wcmParseOptions(LocalDevicePtr local) +int wcmParseOptions(LocalDevicePtr local, unsigned long* keys) { WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; @@ -617,8 +617,25 @@ int wcmParseOptions(LocalDevicePtr local) "TPCButton", common->wcmTPCButtonDefault); - /* Touch applies to the whole tablet */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", common->wcmTouchDefault); + /* a single touch device */ + if (ISBITSET (keys, BTN_TOOL_DOUBLETAP)) + { + /* TouchDefault was off for all devices + * except when touch is supported */ + common->wcmTouchDefault = 1; + } + + /* 2FG touch device */ + if (ISBITSET (keys, BTN_TOOL_TRIPLETAP)) + { + /* GestureDefault was off for all devices + * except when multi-touch is supported */ + common->wcmGestureDefault = 1; + } + + /* check if touch was turned off in xorg.conf */ + common->wcmTouch = xf86SetBoolOption(local->options, "Touch", + common->wcmTouchDefault); /* Touch gesture applies to the whole tablet */ common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", |