Drop the callback interface, replace with libevdev_next_event
[platform/upstream/libevdev.git] / libevdev / libevdev-int.h
1 /*
2  * Copyright © 2013 Red Hat, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that copyright
7  * notice and this permission notice appear in supporting documentation, and
8  * that the name of the copyright holders not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  The copyright holders make no representations
11  * about the suitability of this software for any purpose.  It is provided "as
12  * is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20  * OF THIS SOFTWARE.
21  */
22
23 #ifndef libevdev_INT_H
24 #define libevdev_INT_H
25
26 #include <config.h>
27 #include "libevdev.h"
28
29 #define LONG_BITS (sizeof(long) * 8)
30 #define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
31 #define ARRAY_LENGTH(a) (sizeof(a) / (sizeof((a)[0])))
32 #define MAX_NAME 256
33 #define MAX_SLOTS 32
34 #define ABS_MT_MIN ABS_MT_SLOT
35 #define ABS_MT_MAX ABS_MT_TOOL_Y
36 #define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1)
37
38 struct libevdev {
39         int fd;
40         libevdev_log_func_t log;
41
42         char name[MAX_NAME];
43         struct input_id ids;
44         unsigned long bits[NLONGS(EV_CNT)];
45         unsigned long props[NLONGS(INPUT_PROP_CNT)];
46         unsigned long key_bits[NLONGS(KEY_CNT)];
47         unsigned long rel_bits[NLONGS(REL_CNT)];
48         unsigned long abs_bits[NLONGS(ABS_CNT)];
49         unsigned long led_bits[NLONGS(LED_CNT)];
50         unsigned long key_values[NLONGS(KEY_CNT)];
51         struct input_absinfo abs_info[ABS_CNT];
52         unsigned int mt_slot_vals[MAX_SLOTS][ABS_MT_CNT];
53         int num_slots; /**< valid slots in mt_slot_vals */
54
55         int need_sync;
56         int grabbed;
57
58         struct input_event *queue;
59         size_t queue_size; /**< size of queue in elements */
60         size_t queue_next; /**< next event index */
61         size_t queue_nsync; /**< number of sync events */
62 };
63
64 #endif
65