From 2ceee5a0572c968eb36702589b8b9eec4b4c20ef Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 20 May 2011 14:55:59 +1000 Subject: Adjust to new input PreInit from API 12. New PreInit prototype streamlines the process a bit, leaving most of the task up to the server. Signed-off-by: Peter Hutterer (cherry picked from commit d086b320fef1bde7db149309a6d77f072f8cbdb1) Conflicts: src/wcmConfig.c --- src/wcmConfig.c | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 8c1f555..f21d232 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -223,7 +223,7 @@ static int wcmSetType(InputInfoPtr pInfo, const char *type) * starts making sense again. */ -static const char *default_options[] = +static char *default_options[] = { "StopBits", "1", "DataBits", "8", @@ -326,19 +326,15 @@ static Bool wcmMatchDevice(InputInfoPtr pLocal) /* wcmPreInit - called for each input devices with the driver set to * "wacom" */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 +static int NewWcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags); + static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags) { InputInfoPtr pInfo = NULL; - WacomDevicePtr priv = NULL; - WacomCommonPtr common = NULL; - const char* type; - char* device; - int need_hotplug = 0; - - gWacomModule.wcmDrv = drv; if (!(pInfo = xf86AllocateInput(drv, 0))) - goto SetupProc_fail; + return NULL; pInfo->conf_idev = dev; pInfo->name = dev->identifier; @@ -346,7 +342,29 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags) /* Force default port options to exist because the init * phase is based on those values. */ - xf86CollectInputOptions(pInfo, default_options, NULL); + xf86CollectInputOptions(pInfo, (const char**)default_options, NULL); + + if (NewWcmPreInit(drv, pInfo, flags) == Success) { + pInfo->flags |= XI86_CONFIGURED; + return pInfo; + } else { + xf86DeleteInput(pInfo, 0); + return NULL; + } +} + +static int NewWcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) +#else +static int wcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) +#endif +{ + WacomDevicePtr priv = NULL; + WacomCommonPtr common = NULL; + const char* type; + char* device; + int need_hotplug = 0; + + gWacomModule.wcmDrv = drv; device = xf86SetStrOption(pInfo->options, "Device", NULL); type = xf86FindOptionValue(pInfo->options, "Type"); @@ -410,9 +428,6 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags) if (!wcmParseOptions(pInfo)) goto SetupProc_fail; - /* mark the device configured */ - pInfo->flags |= XI86_CONFIGURED; - if (need_hotplug) { priv->isParent = 1; @@ -425,7 +440,7 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags) pInfo->fd = -1; } - return (pInfo); + return Success; SetupProc_fail: /* restart the device list from the next one */ @@ -445,7 +460,7 @@ SetupProc_fail: xf86DeleteInput(pInfo, 0); } - return NULL; + return BadMatch; } InputDriverRec WACOM = @@ -457,6 +472,9 @@ InputDriverRec WACOM = wcmUninit, /* un-init */ NULL, /* module */ 0 /* ref count */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 + default_options +#endif }; -- cgit v1.2.1