2 #include <cynara-session.h>
3 #include <cynara-client.h>
4 #include <cynara-creds-socket.h>
7 #include <tizen-extension-server-protocol.h>
8 #include <linux/uinput.h>
10 #ifdef TRACE_INPUT_BEGIN
11 #undef TRACE_INPUT_BEGIN
13 #ifdef TRACE_INPUT_END
14 #undef TRACE_INPUT_END
20 #define TRACE_INPUT_BEGIN(NAME) traceBegin(TTRACE_TAG_INPUT, "INPUT:DEVMGR:"#NAME)
21 #define TRACE_INPUT_END() traceEnd(TTRACE_TAG_INPUT)
23 #define TRACE_INPUT_BEGIN(NAME)
24 #define TRACE_INPUT_END()
27 #define DMERR(msg, ARG...) ERR("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
28 #define DMWRN(msg, ARG...) WRN("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
29 #define DMINF(msg, ARG...) INF("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
30 #define DMDBG(msg, ARG...) DBG("[%s:%d] "msg, __FUNCTION__, __LINE__, ##ARG)
33 #include <cynara-session.h>
34 #include <cynara-client.h>
35 #include <cynara-creds-socket.h>
38 #define INPUT_GENERATOR_DEVICE "Input Generator"
39 #define DETENT_DEVICE_NAME "tizen_detent"
40 #define INPUTGEN_MAX_BTN 16
42 typedef struct _E_Devicemgr_Input_Device_Mgr_Data E_Devicemgr_Input_Device_Mgr_Data;
43 typedef struct _E_Devicemgr_Input_Device_User_Data E_Devicemgr_Input_Device_User_Data;
44 typedef struct _E_Devicemgr_Coords E_Devicemgr_Coords;
45 typedef struct _E_Devicemgr_Inputgen_Touch_Axis E_Devicemgr_Inputgen_Touch_Axis;
46 typedef struct _E_Devicemgr_Inputgen_Client_Data E_Devicemgr_Inputgen_Client_Data;
47 typedef struct _E_Devicemgr_Inputgen_Client_Global_Data E_Devicemgr_Inputgen_Client_Global_Data;
48 typedef struct _E_Devicemgr_Inputgen_Device_Data E_Devicemgr_Inputgen_Device_Data;
49 typedef struct _E_Devicemgr_Inputgen_Resource_Data E_Devicemgr_Inputgen_Resource_Data;
51 struct _E_Devicemgr_Input_Device_Mgr_Data
53 struct wl_resource *resource;
54 Eina_Bool is_first_resource : 1;
55 Eina_List *user_data_list;
58 struct _E_Devicemgr_Input_Device_User_Data
60 E_Devicemgr_Input_Device *dev;
61 struct wl_resource *dev_res;
62 struct wl_resource *dev_mgr_res;
63 struct wl_resource *seat_res;
64 E_Devicemgr_Input_Device_Mgr_Data *mgr_data;
67 struct _E_Devicemgr_Coords
72 struct _E_Devicemgr_Inputgen_Client_Data
74 struct wl_client *client;
78 struct _E_Devicemgr_Inputgen_Client_Global_Data
80 struct wl_client *client;
84 struct _E_Devicemgr_Inputgen_Touch_Axis
93 struct _E_Devicemgr_Inputgen_Device_Data
97 char name[UINPUT_MAX_NAME_SIZE];
98 Ecore_Device_Class clas;
101 unsigned int pressed;
102 E_Devicemgr_Coords *coords;
103 E_Devicemgr_Inputgen_Touch_Axis *axis;
104 E_Devicemgr_Inputgen_Touch_Axis axis_tmp;
108 unsigned int pressed;
109 E_Devicemgr_Coords coords;
119 struct _E_Devicemgr_Inputgen_Resource_Data
121 struct wl_resource *resource;
122 char name[UINPUT_MAX_NAME_SIZE];
123 Ecore_Timer *sync_timer;
126 struct _E_Devicemgr_Conf_Edd
130 Eina_Bool button_remap_enable; // enable feature of remap mouse right button to back key
131 Eina_Bool virtual_key_device_enable; // create a virtual keyboard device
132 Eina_Bool virtual_mouse_device_enable; // create a virtual mouse device
133 int back_keycode; // keycode of back key
137 struct _E_Devicemgr_Config_Data
139 E_Config_DD *conf_edd;
140 E_Devicemgr_Conf_Edd *conf;
143 struct _E_Devicemgr_Wl_Data
145 struct wl_global *global;
146 Eina_List *mgr_data_list;
150 Eina_Bool cynara_initialized;
154 void e_devicemgr_conf_init(E_Devicemgr_Config_Data *dconfig);
155 void e_devicemgr_conf_fini(E_Devicemgr_Config_Data *dconfig);
157 Eina_Bool e_devicemgr_wl_init(void);
158 void e_devicemgr_wl_shutdown(void);
159 void e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev);
160 void e_devicemgr_wl_device_del(E_Devicemgr_Input_Device *dev);
161 void e_devicemgr_wl_device_update(E_Devicemgr_Input_Device *dev);
163 void e_devicemgr_wl_block_send_expired(struct wl_resource *resource);
164 int e_devicemgr_block_add(struct wl_client *client, struct wl_resource *resource, uint32_t clas, uint32_t duration);
165 int e_devicemgr_block_remove(struct wl_client *client);
167 Eina_Bool e_devicemgr_block_add_internal(uint32_t clas, uint32_t duration, E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
168 Eina_Bool e_devicemgr_block_remove_internal(E_Devicemgr_Block_Expire_Cb cb_func, void *cb_data);
170 int e_devicemgr_inputgen_add(struct wl_client *client, struct wl_resource *resource, uint32_t clas, const char *name);
171 void e_devicemgr_inputgen_add_with_sync(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);
190 void e_devicemgr_wl_generator_with_sync_send_event(struct wl_resource *resource, int error);
191 void e_devicemgr_inputgen_device_ready_send(E_Devicemgr_Input_Device *dev);
193 int e_devicemgr_keyboard_ungrab(struct wl_client *client, struct wl_resource *surface);
194 int e_devicemgr_keyboard_grab(struct wl_client *client, struct wl_resource *surface, uint32_t subclas);