diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-01-15 16:15:47 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-01-23 17:33:10 +1000 |
commit | ffc0a34642d5ab573c2ae63c873a5befd8688493 (patch) | |
tree | 1e225098d55b894aedd26cf024de96fa55e252a2 | |
parent | 93de7b0b73d4c5f6f68e3a2ffe8f76b5212ee016 (diff) |
Move some stuff into the new alloc function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/evdev.c | 29 |
1 files 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. */ |