summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-09-10 10:26:47 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-11-25 13:04:53 +1000
commitf85c4b580c074f7054eac98753d1f4e91f08305e (patch)
treedeeecd1033ea0ac6ab0021914a75b4136b8b4851 /src
parentca93073692a4b8fab32945d76a1d1d16a435c800 (diff)
Adjust to new PreInit for ABI 12.
Most of the init is now handled by the server, not by the driver. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/acecad.c50
-rw-r--r--src/acecad.h4
2 files changed, 42 insertions, 12 deletions
diff --git a/src/acecad.c b/src/acecad.c
index e81c141..da788a0 100644
--- a/src/acecad.c
+++ b/src/acecad.c
@@ -125,7 +125,10 @@ _X_EXPORT InputDriverRec ACECAD =
NULL,
AceCadPreInit,
NULL,
- NULL
+ NULL,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
+ default_options
+#endif
};
static XF86ModuleVersionInfo VersionRec =
@@ -328,20 +331,18 @@ ProbeFound:
#endif
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+static int NewAceCadPreInit(InputDriverPtr drv, InputInfoPtr dev, int flags);
+
static InputInfoPtr
AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr local = xf86AllocateInput(drv, 0);
AceCadPrivatePtr priv = calloc (1, sizeof(AceCadPrivateRec));
- int speed;
- int msgtype;
- char *s;
- if ((!local) || (!priv))
+ if ((!local))
goto SetupProc_fail;
- memset(priv, 0, sizeof(AceCadPrivateRec));
-
local->name = dev->identifier;
local->type_name = XI_TABLET;
local->flags = XI86_SEND_DRAG_EVENTS;
@@ -356,13 +357,38 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
local->private = priv;
local->private_flags = 0;
local->conf_idev = dev;
- local->device_control = DeviceControl;
/*local->always_core_feedback = 0;*/
xf86CollectInputOptions(local, default_options, NULL);
xf86OptionListReport(local->options);
+ if (NewAceCadPreInit(drv, local, flags) == Success)
+ return local;
+
+SetupProc_fail:
+ return NULL;
+}
+
+static int
+NewAceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
+#else
+static int
+AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
+#endif
+{
+ AceCadPrivatePtr priv = calloc (1, sizeof(AceCadPrivateRec));
+ int speed;
+ int msgtype;
+ char *s;
+
+ if (!priv)
+ return BadAlloc;
+
+ memset(priv, 0, sizeof(AceCadPrivateRec));
+
+ local->device_control = DeviceControl;
+
priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 );
s = xf86FindOptionValue(local->options, "Device");
@@ -457,11 +483,11 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
xf86Msg(msgtype, "%s is in %s mode\n", local->name, (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
DBG (9, XisbTrace (priv->buffer, 1));
- local->history_size = xf86SetIntOption(local->options , "HistorySize", 0);
-
xf86ProcessCommonOptions(local, local->options);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
local->flags |= XI86_CONFIGURED;
+#endif
if (local->fd != -1)
{
@@ -475,7 +501,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
RemoveEnabledDevice (local->fd);
local->fd = -1;
- return local;
+ return Success;
/*
* If something went wrong, cleanup and return NULL
@@ -491,7 +517,7 @@ SetupProc_fail:
local->private = NULL;
}
xf86DeleteInput(local, 0);
- return NULL;
+ return BadAlloc;
}
static Bool
diff --git a/src/acecad.h b/src/acecad.h
index 342b940..a2b5c66 100644
--- a/src/acecad.h
+++ b/src/acecad.h
@@ -106,7 +106,11 @@ static Bool ReverseConvertProc(InputInfoPtr , int , int , int*);
static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int);
+#else
+static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
+#endif
#ifdef HAVE_LINUX_INPUT_H
static void USBReadInput (InputInfoPtr);
static Bool USBQueryHardware (InputInfoPtr);