From: Chris Bagwell <ch...@cnpbagwell.com> This is ground work to allow much easier overriding of default values for case were exact default value is not known until after init phase (for example, if default value depends on resolution of hardware which is not known until after init phase).
Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com> --- src/wcmConfig.c | 5 +++- src/wcmValidateDevice.c | 56 ++++++++++++++++++++++++++++++++++++---------- src/xf86Wacom.h | 3 +- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 94b188d..783966a 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -548,12 +548,15 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) if (!wcmSetType(pInfo, type)) goto SetupProc_fail; - if (!wcmParseOptions(pInfo, need_hotplug, is_dependent)) + if (!wcmPreInitParseOptions(pInfo, need_hotplug, is_dependent)) goto SetupProc_fail; if (!wcmInitModel(pInfo)) goto SetupProc_fail; + if (!wcmPostInitParseOptions(pInfo, need_hotplug, is_dependent)) + goto SetupProc_fail; + if (need_hotplug) { priv->isParent = 1; diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 60d2091..e947fbe 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -678,7 +678,9 @@ int wcmParseSerials (InputInfoPtr pInfo) } /** - * Parse the options for this device. + * Parse the pre-init options for this device. Most useful for options + * needed to properly init a device (baud rate for example). + * * Note that parameters is_primary and is_dependent are mutually exclusive, * though both may be false in the case of an xorg.conf device. * @@ -688,7 +690,8 @@ int wcmParseSerials (InputInfoPtr pInfo) * otherwise. * @retvalue True on success or False otherwise. */ -Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool is_dependent) +Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, + Bool is_dependent) { WacomDevicePtr priv = (WacomDevicePtr)pInfo->private; WacomCommonPtr common = priv->common; @@ -844,8 +847,6 @@ Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool is_dependent) common->wcmThreshold = xf86SetIntOption(pInfo->options, "Threshold", common->wcmThreshold); - common->wcmMaxZ = xf86SetIntOption(pInfo->options, "MaxZ", - common->wcmMaxZ); if (xf86SetBoolOption(pInfo->options, "ButtonsOnly", 0)) priv->flags |= BUTTONS_ONLY_FLAG; @@ -897,14 +898,6 @@ Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool is_dependent) xf86Msg(X_WARNING, "%s: Touch gesture option can only " "be set by a touch tool.\n", pInfo->name); - common->wcmGestureParameters.wcmZoomDistance = - xf86SetIntOption(pInfo->options, "ZoomDistance", - common->wcmGestureParameters.wcmZoomDistanceDefault); - - common->wcmGestureParameters.wcmScrollDistance = - xf86SetIntOption(pInfo->options, "ScrollDistance", - common->wcmGestureParameters.wcmScrollDistanceDefault); - common->wcmGestureParameters.wcmTapTime = xf86SetIntOption(pInfo->options, "TapTime", common->wcmGestureParameters.wcmTapTimeDefault); @@ -934,4 +927,43 @@ error: return FALSE; } +/** + * Parse post-init options for this device. Useful for overriding HW + * specific options computed during init phase (HW distances for example). + * + * 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 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 wcmPostInitParseOptions(InputInfoPtr pInfo, Bool is_primary, + Bool is_dependent) +{ + WacomDevicePtr priv = (WacomDevicePtr)pInfo->private; + WacomCommonPtr common = priv->common; + + common->wcmMaxZ = xf86SetIntOption(pInfo->options, "MaxZ", + common->wcmMaxZ); + + /* 2FG touch device */ + if (TabletHasFeature(common, WCM_2FGT)) + { + + common->wcmGestureParameters.wcmZoomDistance = + xf86SetIntOption(pInfo->options, "ZoomDistance", + common->wcmGestureParameters.wcmZoomDistanceDefault); + + common->wcmGestureParameters.wcmScrollDistance = + xf86SetIntOption(pInfo->options, "ScrollDistance", + common->wcmGestureParameters.wcmScrollDistanceDefault); + } + + + return TRUE; +} + /* vim: set noexpandtab tabstop=8 shiftwidth=8: */ diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index c1b55c9..e58e0b0 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -139,7 +139,8 @@ 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, Bool is_dependent); +extern Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool is_dependent); +extern Bool wcmPostInitParseOptions(InputInfoPtr pInfo, Bool is_primary, Bool is_dependent); extern int wcmParseSerials(InputInfoPtr pinfo); extern void wcmInitialCoordinates(InputInfoPtr pInfo, int axes); extern void wcmInitialScreens(InputInfoPtr pInfo); -- 1.7.7.3 ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel