From ffc0a34642d5ab573c2ae63c873a5befd8688493 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 Jan 2013 16:15:47 +1000 Subject: Move some stuff into the new alloc function Signed-off-by: Peter Hutterer --- 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. */ -- cgit v1.2.3