5 #include <tizen-extension-server-protocol.h>
7 #include <cynara-session.h>
8 #include <cynara-client.h>
9 #include <cynara-creds-socket.h>
13 #ifdef TRACE_INPUT_BEGIN
14 #undef TRACE_INPUT_BEGIN
16 #ifdef TRACE_INPUT_END
17 #undef TRACE_INPUT_END
23 #define TRACE_INPUT_BEGIN(NAME, ...) traceBegin(TTRACE_TAG_INPUT, "INPUT:KRT:"#NAME, ##__VA_ARGS__)
24 #define TRACE_INPUT_END() traceEnd(TTRACE_TAG_INPUT)
26 #define TRACE_INPUT_BEGIN(NAME)
27 #define TRACE_INPUT_END()
30 /* Temporary value of maximum number of HWKeys */
32 #define CHECK_ERR(val) if (TIZEN_KEYROUTER_ERROR_NONE != val) return;
33 #define CHECK_ERR_VAL(val) if (TIZEN_KEYROUTER_ERROR_NONE != val) return val;
34 #define CHECK_NULL(val) if (!val) return;
35 #define CHECK_NULL_VAL(val) if (!val) return val;
37 extern int _keyrouter_log_dom;
43 #define ERR(...) EINA_LOG_DOM_ERR(_keyrouter_log_dom, __VA_ARGS__)
44 #define WRN(...) EINA_LOG_DOM_WARN(_keyrouter_log_dom, __VA_ARGS__)
45 #define INF(...) EINA_LOG_DOM_INFO(_keyrouter_log_dom, __VA_ARGS__)
46 #define DBG(...) EINA_LOG_DOM_DBG(_keyrouter_log_dom, __VA_ARGS__)
48 #define KLERR(msg, ARG...) ERR(msg, ##ARG)
49 #define KLWRN(msg, ARG...) WRN(msg, ##ARG)
50 #define KLINF(msg, ARG...) INF(msg, ##ARG)
51 #define KLDBG(msg, ARG...) DBG(msg, ##ARG)
53 typedef struct _E_Keyrouter E_Keyrouter;
54 typedef struct _E_Keyrouter* E_KeyrouterPtr;
55 typedef struct _E_Keyrouter_Key_List_Node E_Keyrouter_Key_List_Node;
56 typedef struct _E_Keyrouter_Key_List_Node* E_Keyrouter_Key_List_NodePtr;
57 typedef struct _E_Keyrouter_Tizen_HWKey E_Keyrouter_Tizen_HWKey;
58 typedef struct _E_Keyrouter_Grabbed_Key E_Keyrouter_Grabbed_Key;
59 typedef struct _E_Keyrouter_Grab_Request E_Keyrouter_Grab_Request;
60 typedef struct _E_Keyrouter_Ungrab_Request E_Keyrouter_Ungrab_Request;
61 typedef struct _E_Keyrouter_Registered_Window_Info E_Keyrouter_Registered_Window_Info;
63 typedef struct _E_Keyrouter_Conf_Edd E_Keyrouter_Conf_Edd;
64 typedef struct _E_Keyrouter_Config_Data E_Keyrouter_Config_Data;
66 #define TIZEN_KEYROUTER_MODE_PRESSED TIZEN_KEYROUTER_MODE_REGISTERED+1
67 #define TIZEN_KEYROUTER_MODE_PICTURE_OFF TIZEN_KEYROUTER_MODE_REGISTERED+2
69 typedef enum _E_Keyrouter_Client_Status
74 } E_Keyrouter_Client_Status;
76 typedef unsigned long Time;
78 extern E_KeyrouterPtr krt;
80 struct _E_Keyrouter_Conf_Edd
84 int pictureoff_disabled;
88 struct _E_Keyrouter_Config_Data
91 E_Config_DD *conf_edd;
92 E_Config_DD *conf_hwkeys_edd;
93 E_Keyrouter_Conf_Edd *conf;
96 struct _E_Keyrouter_Registered_Window_Info
98 struct wl_resource *surface;
102 struct _E_Keyrouter_Key_List_Node
104 struct wl_resource *surface;
105 struct wl_client *wc;
107 E_Keyrouter_Client_Status status;
110 struct _E_Keyrouter_Tizen_HWKey
118 struct _E_Keyrouter_Grabbed_Key
122 Eina_Bool no_privcheck;
126 Eina_List *or_excl_ptr;
128 Eina_List *shared_ptr;
129 Eina_List *press_ptr;
130 E_Keyrouter_Key_List_Node *registered_ptr;
131 Eina_List *pic_off_ptr;
136 struct wl_global *global;
137 Ecore_Event_Filter *ef_handler;
139 Eina_List *resources;
141 E_Keyrouter_Config_Data *conf;
143 E_Keyrouter_Grabbed_Key *HardKeys;
144 Eina_List *grab_surface_list;
145 Eina_List *grab_client_list;
147 Eina_List *registered_window_list;
149 Eina_Bool isWindowStackChanged;
151 int max_tizen_hwkeys;
152 int register_none_key;
153 Eina_List *registered_none_key_window_list;
154 Eina_List *invisible_set_window_list;
155 Eina_List *invisible_get_window_list;
156 struct wl_resource * playback_daemon_surface;
160 int isPictureOffEnabled;
161 Eina_Bool pictureoff_disabled;
164 struct _E_Keyrouter_Grab_Request {
170 struct _E_Keyrouter_Ungrab_Request {
177 E_API extern E_Module_Api e_modapi;
178 E_API void *e_modapi_init(E_Module *m);
179 E_API int e_modapi_shutdown(E_Module *m);
180 E_API int e_modapi_save(E_Module *m);
182 int e_keyrouter_set_keygrab_in_list(struct wl_resource *surface, struct wl_client *client, uint32_t key, uint32_t mode);
183 int e_keyrouter_prepend_to_keylist(struct wl_resource *surface, struct wl_client *wc, uint32_t key, uint32_t mode, Eina_Bool focused);
184 void e_keyrouter_find_and_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key, uint32_t mode);
185 void e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc);
186 int e_keyrouter_find_key_in_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key);
187 Eina_Bool e_keyrouter_find_key_in_register_list(uint32_t key);
189 int e_keyrouter_add_client_destroy_listener(struct wl_client *client);
190 int e_keyrouter_add_surface_destroy_listener(struct wl_resource *surface);
192 Eina_Bool e_keyrouter_process_key_event(void *event, int type);
194 int e_keyrouter_set_keyregister(struct wl_client *client, struct wl_resource *surface, uint32_t key);
195 int e_keyrouter_unset_keyregister(struct wl_resource *surface, struct wl_client *client, uint32_t key);
196 Eina_Bool e_keyrouter_is_registered_window(struct wl_resource *surface);
197 void e_keyrouter_clear_registered_window(void);
198 Eina_List* _e_keyrouter_registered_window_key_list(struct wl_resource *surface);
199 Eina_Bool IsNoneKeyRegisterWindow(struct wl_resource *surface);
200 Eina_Bool IsInvisibleSetWindow(struct wl_resource *surface);
201 Eina_Bool IsInvisibleGetWindow(struct wl_resource *surface);
204 struct wl_resource *e_keyrouter_util_get_surface_from_eclient(E_Client *client);
205 int e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface);
206 char *e_keyrouter_util_cmd_get_from_pid(int pid);
207 int e_keyrouter_util_keycode_get_from_string(char *name);
208 char *e_keyrouter_util_keyname_get_from_keycode(int keycode);
209 char *e_keyrouter_util_process_name_get_from_cmd(char *cmd);
210 const char *e_keyrouter_mode_to_string(uint32_t mode);
212 void e_keyrouter_conf_init(E_Keyrouter_Config_Data *kconfig);
213 void e_keyrouter_conf_deinit(E_Keyrouter_Config_Data *kconfig);
214 int e_keyrouter_cb_picture_off(const int option, void *data);