2 #include "e_devicemgr.h"
4 #include <cynara-session.h>
5 #include <cynara-client.h>
6 #include <cynara-creds-socket.h>
9 #include <tizen-extension-server-protocol.h>
10 #include <linux/uinput.h>
12 #ifdef TRACE_INPUT_BEGIN
13 #undef TRACE_INPUT_BEGIN
15 #ifdef TRACE_INPUT_END
16 #undef TRACE_INPUT_END
22 #define TRACE_INPUT_BEGIN(NAME) traceBegin(TTRACE_TAG_INPUT, "INPUT:DEVMGR:"#NAME)
23 #define TRACE_INPUT_END() traceEnd(TTRACE_TAG_INPUT)
25 #define TRACE_INPUT_BEGIN(NAME)
26 #define TRACE_INPUT_END()
29 #define DMERR(msg, ARG...) ERR("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
30 #define DMWRN(msg, ARG...) WRN("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
31 #define DMINF(msg, ARG...) INF("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
32 #define DMDBG(msg, ARG...) DBG("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
35 #include <cynara-session.h>
36 #include <cynara-client.h>
37 #include <cynara-creds-socket.h>
40 #define INPUT_GENERATOR_DEVICE "Input Generator"
41 #define DETENT_DEVICE_NAME "tizen_detent"
42 #define INPUTGEN_MAX_BTN 16
44 typedef struct _E_Devicemgr_Input_Device_Mgr_Data E_Devicemgr_Input_Device_Mgr_Data;
45 typedef struct _E_Devicemgr_Input_Device_User_Data E_Devicemgr_Input_Device_User_Data;
46 typedef struct _E_Devicemgr_Coords E_Devicemgr_Coords;
47 typedef struct _E_Devicemgr_Inputgen_Touch_Axis E_Devicemgr_Inputgen_Touch_Axis;
48 typedef struct _E_Devicemgr_Inputgen_Client_Data E_Devicemgr_Inputgen_Client_Data;
49 typedef struct _E_Devicemgr_Inputgen_Client_Global_Data E_Devicemgr_Inputgen_Client_Global_Data;
50 typedef struct _E_Devicemgr_Inputgen_Device_Data E_Devicemgr_Inputgen_Device_Data;
51 typedef struct _E_Devicemgr_Inputgen_Resource_Data E_Devicemgr_Inputgen_Resource_Data;
53 struct _E_Devicemgr_Input_Device_Mgr_Data
55 struct wl_resource *resource;
56 Eina_Bool is_first_resource : 1;
57 Eina_List *user_data_list;
60 struct _E_Devicemgr_Input_Device_User_Data
62 E_Devicemgr_Input_Device *dev;
63 struct wl_resource *dev_res;
64 struct wl_resource *dev_mgr_res;
65 struct wl_resource *seat_res;
66 E_Devicemgr_Input_Device_Mgr_Data *mgr_data;
69 struct _E_Devicemgr_Coords
74 struct _E_Devicemgr_Inputgen_Client_Data
76 struct wl_client *client;
80 struct _E_Devicemgr_Inputgen_Client_Global_Data
82 struct wl_client *client;
86 struct _E_Devicemgr_Inputgen_Touch_Axis
95 struct _E_Devicemgr_Inputgen_Device_Data
99 char name[UINPUT_MAX_NAME_SIZE];
100 Ecore_Device_Class clas;
103 unsigned int pressed;
104 E_Devicemgr_Coords *coords;
105 E_Devicemgr_Inputgen_Touch_Axis *axis;
106 E_Devicemgr_Inputgen_Touch_Axis axis_tmp;
110 unsigned int pressed;
111 E_Devicemgr_Coords coords;
121 struct _E_Devicemgr_Inputgen_Resource_Data
123 struct wl_resource *resource;
124 char name[UINPUT_MAX_NAME_SIZE];
127 struct _E_Devicemgr_Conf_Edd
131 Eina_Bool button_remap_enable; // enable feature of remap mouse right button to back key
132 Eina_Bool virtual_key_device_enable; // create a virtual keyboard device
133 Eina_Bool virtual_mouse_device_enable; // create a virtual mouse device
134 int back_keycode; // keycode of back key
138 struct _E_Devicemgr_Config_Data
140 E_Config_DD *conf_edd;
141 E_Devicemgr_Conf_Edd *conf;
144 struct _E_Devicemgr_Wl_Data
146 struct wl_global *global;
147 Eina_List *mgr_data_list;
151 Eina_Bool cynara_initialized;
155 void e_devicemgr_conf_init(E_Devicemgr_Config_Data *dconfig);
156 void e_devicemgr_conf_fini(E_Devicemgr_Config_Data *dconfig);
158 Eina_Bool e_devicemgr_wl_init(void);
159 void e_devicemgr_wl_shutdown(void);
160 void e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev);
161 void e_devicemgr_wl_device_del(E_Devicemgr_Input_Device *dev);
162 void e_devicemgr_wl_device_update(E_Devicemgr_Input_Device *dev);
164 void e_devicemgr_wl_block_send_expired(struct wl_resource *resource);
165 int e_devicemgr_block_add(struct wl_client *client, struct wl_resource *resource, uint32_t clas, uint32_t duration);
166 int e_devicemgr_block_remove(struct wl_client *client);
168 Eina_Bool e_devicemgr_block_add_internal(uint32_t clas, uint32_t duration, E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
169 Eina_Bool e_devicemgr_block_remove_internal(E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
171 int e_devicemgr_inputgen_add(struct wl_client *client, struct wl_resource *resource, uint32_t clas, const char *name);
172 void e_devicemgr_inputgen_remove(struct wl_client *client, struct wl_resource *resource, uint32_t clas);
173 int e_devicemgr_inputgen_generate_key(struct wl_client *client, struct wl_resource *resource, const char *keyname, Eina_Bool pressed);
174 int e_devicemgr_inputgen_generate_pointer(struct wl_client *client, struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t button);
175 int e_devicemgr_inputgen_generate_touch(struct wl_client *client, struct wl_resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t finger);
176 void e_devicemgr_inputgen_get_device_info(E_Devicemgr_Input_Device *dev);
177 int e_devicemgr_inputgen_generate_wheel(struct wl_client *client, struct wl_resource *resource, uint32_t type, int32_t value);
178 int e_devicemgr_inputgen_touch_axis_store(struct wl_client *client, struct wl_resource *resource, uint32_t type, double value);
180 int e_devicemgr_create_virtual_device(Ecore_Device_Class clas, const char *name);
181 void e_devicemgr_destroy_virtual_device(int uinp_fd);
183 Eina_Bool e_devicemgr_strcmp(const char *dst, const char *src);
184 int e_devicemgr_input_pointer_warp(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, wl_fixed_t x, wl_fixed_t y);
185 void e_devicemgr_wl_detent_send_event(int detent);
186 Eina_Bool e_devicemgr_input_init(void);
187 void e_devicemgr_input_shutdown(void);
189 void e_devicemgr_wl_touch_max_count_send(int slot, struct wl_resource *res, struct wl_resource *seat_res);