[PATCH evdev 2/4] Move some stuff into the new alloc function
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 15 15:34:08 PST 2013
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index baa7ac1..a9b1fd2 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2464,7 +2464,25 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
static EvdevPtr
EvdevAlloc(void)
{
+ int i;
EvdevPtr pEvdev = calloc(sizeof(EvdevRec), 1);
+
+ if (!pEvdev)
+ return NULL;
+ /*
+ * We initialize pEvdev->in_proximity to 1 so that device that doesn't use
+ * proximity will still report events.
+ */
+ pEvdev->in_proximity = 1;
+ pEvdev->use_proximity = 1;
+
+#ifdef MULTITOUCH
+ pEvdev->cur_slot = -1;
+#endif
+
+ for (i = 0; i < ArrayLength(pEvdev->axis_map); i++)
+ pEvdev->axis_map[i] = -1;
+
return pEvdev;
}
@@ -2487,17 +2505,6 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
if (rc != Success)
goto error;
-#ifdef MULTITOUCH
- pEvdev->cur_slot = -1;
-#endif
-
- /*
- * We initialize pEvdev->in_proximity to 1 so that device that doesn't use
- * proximity will still report events.
- */
- pEvdev->in_proximity = 1;
- pEvdev->use_proximity = 1;
-
/* Grabbing the event device stops in-kernel event forwarding. In other
words, it disables rfkill and the "Macintosh mouse button emulation".
Note that this needs a server that sets the console to RAW mode. */
--
1.8.1
More information about the xorg-devel
mailing list