42a3b474f06e9a3f35f4bf445cd17adb208eb954
[platform/upstream/enlightenment.git] / src / bin / e_devicemgr.h
1 #ifdef E_TYPEDEFS
2
3 typedef enum _E_Devicemgr_Intercept_Hook_Point
4 {
5    E_DEVICEMGR_INTERCEPT_HOOK_DETENT,
6    E_DEVICEMGR_INTERCEPT_HOOK_LAST
7 } E_Devicemgr_Intercept_Hook_Point;
8
9 typedef Eina_Bool (*E_Devicemgr_Intercept_Hook_Cb) (void *data, int point, void *event);
10 typedef struct _E_Devicemgr_Intercept_Hook E_Devicemgr_Intercept_Hook;
11
12 typedef struct _E_Devicemgr_Conf_Edd E_Devicemgr_Conf_Edd;
13 typedef struct _E_Devicemgr_Config_Data E_Devicemgr_Config_Data;
14 typedef struct _E_Devicemgr_Wl_Data E_Devicemgr_Wl_Data;
15
16 typedef struct _E_Devicemgr_Input_Device
17 {
18    Eina_List *resources;
19    const char *name;
20    const char *seat_name;
21    const char *identifier;
22    Ecore_Device_Class clas;
23    Ecore_Device_Subclass subclas;
24 } E_Devicemgr_Input_Device;
25
26 typedef struct _E_Devicemgr_Input_Device_Multi
27 {
28    double radius_x;
29    double radius_y;
30    double pressure;
31    double angle;
32 } E_Devicemgr_Input_Device_Multi;
33
34 typedef struct _E_Devicemgr E_Devicemgr;
35
36 typedef void (*E_Devicemgr_Block_Expire_Cb) (void *data);
37
38 #else
39 #ifndef E_DEVICEMGR_H
40 #define E_DEVICEMGR_H
41
42 extern E_API E_Devicemgr *e_devicemgr;
43
44 struct _E_Devicemgr
45 {
46    E_Devicemgr_Config_Data *dconfig;
47    E_Devicemgr_Wl_Data *wl_data;
48
49    Eina_List *handlers;
50
51    Eina_List *device_list;
52    E_Devicemgr_Input_Device *last_device_ptr;
53    E_Devicemgr_Input_Device *last_device_touch;
54    E_Devicemgr_Input_Device *last_device_kbd;
55    E_Devicemgr_Input_Device_Multi *multi;
56
57    struct
58      {
59         unsigned int devtype;
60         struct wl_client *client;
61         Ecore_Timer *duration_timer;
62
63         unsigned int internal_devtype;
64         Ecore_Timer *internal_duration_timer;
65         E_Devicemgr_Block_Expire_Cb internal_cb_func;
66         void *internal_cb_data;
67      } block;
68
69    int virtual_key_device_fd;
70    int virtual_mouse_device_fd;
71
72    struct
73    {
74       Eina_List *kbd_list;
75       Eina_List *ptr_list;
76       Eina_List *touch_list;
77
78       Eina_List *resource_list;
79    } inputgen;
80
81    struct
82    {
83       char *identifier;
84    } detent;
85
86    Eina_List *watched_clients;
87
88    int max_touch_count;
89    GRecMutex device_list_mutex;
90
91    struct
92    {
93       struct wl_client *client;
94       E_Client *ec;
95       unsigned int subtype;
96    } keyboard_grab;
97 };
98
99 struct _E_Devicemgr_Intercept_Hook
100 {
101    EINA_INLIST;
102    E_Devicemgr_Intercept_Hook_Point hookpoint;
103    E_Devicemgr_Intercept_Hook_Cb func;
104    void *data;
105    unsigned char delete_me : 1;
106 };
107
108 EINTERN E_Devicemgr_Intercept_Hook *e_devicemgr_intercept_hook_add(E_Devicemgr_Intercept_Hook_Point hookpoint, E_Devicemgr_Intercept_Hook_Cb func, const void *data);
109 EINTERN void e_devicemgr_intercept_hook_del(E_Devicemgr_Intercept_Hook *ch);
110 EINTERN Eina_Bool e_devicemgr_intercept_hook_call(E_Devicemgr_Intercept_Hook_Point hookpoint, void *event);
111 E_API Eina_Bool e_devicemgr_is_blocking_event(Ecore_Device_Class clas);
112 EINTERN int e_devicemgr_inputgen_key_event_add(const char *key, Eina_Bool pressed, char *identifier);
113
114 EINTERN int e_devicemgr_init(void);
115 EINTERN int e_devicemgr_shutdown(void);
116
117 EINTERN Eina_Bool e_devicemgr_detent_is_detent(const char *name);
118
119 EINTERN Eina_Bool e_devicemgr_block_internal_add(Ecore_Device_Class clas, Eina_Bool all_clas, uint32_t duration, E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
120 EINTERN Eina_Bool e_devicemgr_block_internal_remove(E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
121
122 E_API Eina_Bool e_devicemgr_block_reset(void);
123
124 EINTERN Eina_Bool e_devicemgr_keyboard_grab_subtype_is_grabbed(Ecore_Device_Subclass subclas);
125
126 #endif
127 #endif
128