1 #ifndef E_KEYROUTER_INTERN_H
2 #define E_KEYROUTER_INTERN_H
5 #include "e_keyrouter.h"
6 #include "e_input_event_intern.h"
7 #include "e_device_intern.h"
9 #define CHECK_ERR(val) if (TIZEN_KEYROUTER_ERROR_NONE != val) return;
10 #define CHECK_ERR_VAL(val) if (TIZEN_KEYROUTER_ERROR_NONE != val) return val;
11 #define CHECK_NULL(val) if (!val) return;
12 #define CHECK_NULL_VAL(val) if (!val) return val;
14 #define KLERR(msg, ARG...) ERR(msg, ##ARG)
15 #define KLWRN(msg, ARG...) WRN(msg, ##ARG)
16 #define KLINF(msg, ARG...) INF(msg, ##ARG)
17 #define KLDBG(msg, ARG...) DBG(msg, ##ARG)
19 #define TIZEN_KEYROUTER_MODE_PRESSED TIZEN_KEYROUTER_MODE_REGISTERED+1
20 #define TIZEN_KEYROUTER_MODE_PICTURE_OFF TIZEN_KEYROUTER_MODE_REGISTERED+2
22 typedef unsigned long Time;
24 typedef struct _E_Keyrouter E_Keyrouter;
25 typedef struct _E_Keyrouter* E_KeyrouterPtr;
27 typedef struct _E_Keyrouter_Conf_Edd E_Keyrouter_Conf_Edd;
28 typedef struct _E_Keyrouter_Config_Data E_Keyrouter_Config_Data;
30 typedef struct _E_Keyrouter_Grab_Request E_Keyrouter_Grab_Request;
31 typedef struct _E_Keyrouter_Ungrab_Request E_Keyrouter_Ungrab_Request;
33 typedef struct _E_Keyrouter_Tizen_HWKey E_Keyrouter_Tizen_HWKey;
35 typedef struct _E_Keyrouter_Registered_Window_Info E_Keyrouter_Registered_Window_Info;
37 typedef struct _E_Keyrouter_Event_Key_Long E_Keyrouter_Event_Key_Long;
38 typedef struct _E_Keyrouter_Event_Key_Composition E_Keyrouter_Event_Key_Composition;
40 struct _E_Keyrouter_Conf_Edd
42 int num_keycode; // The numbers of keyrouted keycodes defined by xkb-tizen-data
43 int max_keycode; // The max value of keycodes
44 int pictureoff_disabled; // To disable picture_off feature.
45 double composition_key_wait_time; // The time of waiting to composition key's press events
46 Eina_List *KeyList; // The list of routed key data: E_Keyrouter_Tizen_HWKey
49 struct _E_Keyrouter_Config_Data
51 E_Config_DD *conf_edd;
52 E_Config_DD *conf_hwkeys_edd;
53 E_Keyrouter_Conf_Edd *conf;
58 Ecore_Event_Filter *ef_handler;
60 Eina_List *ignore_list;
62 E_Keyrouter_Config_Data *conf;
64 E_Keyrouter_Grabbed_Key *HardKeys;
66 Eina_Bool isWindowStackChanged;
70 int isPictureOffEnabled;
71 Eina_Bool pictureoff_disabled;
86 E_Input_Event_Handler *_key_down_handler;
87 E_Input_Event_Handler *_key_up_handler;
88 EINA_DEPRECATED GMutex event_handler_mutex;
89 GRecMutex grab_key_mutex;
92 struct _E_Keyrouter_Grab_Request {
98 struct _E_Keyrouter_Ungrab_Request {
103 struct _E_Keyrouter_Intercept_Hook
106 E_Keyrouter_Intercept_Hook_Point hookpoint;
107 E_Keyrouter_Intercept_Hook_Cb func;
109 unsigned char delete_me : 1;
112 struct _E_Keyrouter_Registered_Window_Info
114 struct wl_resource *surface;
118 struct _E_Keyrouter_Tizen_HWKey
126 struct _E_Keyrouter_Event_Key_Long
133 struct _E_Keyrouter_Event_Key_Composition
136 unsigned int timestamp;
141 extern E_API E_KeyrouterPtr krt;
143 extern EINTERN int E_KEYROUTER_EVENT_KEY_LONG;
144 extern EINTERN int E_KEYROUTER_EVENT_KEY_COMPOSITION_PRESS;
145 extern EINTERN int E_KEYROUTER_EVENT_KEY_COMPOSITION_RELEASE;
147 EINTERN int e_keyrouter_init(void);
148 EINTERN int e_keyrouter_shutdown(void);
150 EINTERN int e_keyrouter_longkey_add(int keycode, double time);
151 EINTERN void e_keyrouter_longkey_del(int keycode);
153 EINTERN int e_keyrouter_composition_key_add(int *keys, int count);
154 EINTERN void e_keyrouter_composition_key_del(int *keys, int count);
156 EINTERN void e_keyrouter_event_surface_send(E_Client *ec, int key);
158 EINTERN void e_keyrouter_input_handler_add(void);
160 EINTERN Eina_Bool e_keyrouter_query_tizen_key_table(void);
162 EINTERN int e_keyrouter_set_keygrab_in_list(struct wl_resource *surface, struct wl_client *client, uint32_t key, uint32_t mode);
163 EINTERN int e_keyrouter_prepend_to_keylist(struct wl_resource *surface, struct wl_client *wc, uint32_t key, uint32_t mode, Eina_Bool focused);
164 EINTERN void e_keyrouter_find_and_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key, uint32_t mode);
165 EINTERN void e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc);
166 EINTERN int e_keyrouter_find_key_in_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key);
167 EINTERN Eina_Bool e_keyrouter_process_key_event(void *event, int type);
169 EINTERN struct wl_resource *e_keyrouter_util_get_surface_from_eclient(E_Client *client);
170 EINTERN int e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface);
171 EINTERN char *e_keyrouter_util_cmd_get_from_pid(int pid);
172 EINTERN char *e_keyrouter_util_process_name_get_from_cmd(char *cmd);
173 EINTERN const char *e_keyrouter_mode_to_string(uint32_t mode);
175 EINTERN void e_keyrouter_conf_init(E_Keyrouter_Config_Data *kconfig);
176 EINTERN void e_keyrouter_conf_deinit(E_Keyrouter_Config_Data *kconfig);
178 EINTERN int e_keyrouter_cb_picture_off(const int option, void *data);
180 EINTERN int e_keyrouter_keygrab_set(struct wl_client *client, struct wl_resource *surface, int key, int mode);
181 EINTERN void e_keyrouter_keygrab_unset(struct wl_client *client, struct wl_resource *surface, int key);
183 EINTERN Eina_Bool e_keyrouter_event_process(void *event, E_Device *dev, int type);