[E_KEYROUTER_INTERCEPT_HOOK_DELIVER_FOCUS] = NULL,
};
+struct _keygrab_mode {
+ uint32_t keygrab_mode;
+ const char *description;
+};
+
+static struct _keygrab_mode _keygrab_mode_list[] = {
+ { TIZEN_KEYROUTER_MODE_EXCLUSIVE, "== Exclusive Grab ==" },
+ { TIZEN_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE, "== Overridable Exclusive Grab ==" },
+ { TIZEN_KEYROUTER_MODE_TOPMOST, "== Top Position Grab ==" },
+ { TIZEN_KEYROUTER_MODE_SHARED, "== Shared Grab ==" }
+};
+
int _keyrouter_log_dom = -1;
E_API E_Keyrouter_Info e_keyrouter;
_e_keyrouter_input_thread_keygrab_print(void *data)
{
char *log_path = (char *)data;
- Eina_List *l, *excl_ptr_list, *or_excl_ptr_list, *top_ptr_list, *shared_ptr_list;
- E_Keyrouter_Key_List_NodePtr kdata;
+ Eina_List *keygrab_list = NULL;
E_Client *ec_focus;
struct wl_resource *surface_focus;
struct wl_client *wc_focus;
- int pid_focus, pid, i;
- char *cmd_focus, *cmd, *keyname;
+ int pid_focus, i;
+ char *cmd_focus, *keyname;
FILE *log_fl;
log_fl = fopen(log_path, "a");
free(keyname);
keyname = NULL;
- excl_ptr_list = e_keyrouter_hardkeys_list_get(krt->HardKeys, i, TIZEN_KEYROUTER_MODE_EXCLUSIVE);
- if (excl_ptr_list)
- {
- fprintf(log_fl, " == Exclusive Grab ==\n");
- EINA_LIST_FOREACH(excl_ptr_list, l, kdata)
- {
- pid = e_keyrouter_util_get_pid(kdata->wc, kdata->surface);
- cmd = e_keyrouter_util_cmd_get_from_pid(pid);
- fprintf(log_fl, " [surface: %p, client: %p, pid: %d(%s)]\n", kdata->surface, kdata->wc, pid, cmd ?: "Unknown");
- if(cmd) E_FREE(cmd);
- if (kdata->surface)
- {
- fprintf(log_fl, " -- Surface Information --\n");
- fprintf(log_fl, " = wl_client: %p\n", wl_resource_get_client(kdata->surface));
- fprintf(log_fl, " = resource: %s(%d)\n", wl_resource_get_class(kdata->surface), wl_resource_get_id(kdata->surface));
- }
- else
- {
- fprintf(log_fl, " -- Client Information --\n");
- fprintf(log_fl, " = connected fd: %d\n", wl_client_get_fd(kdata->wc));
- }
- }
- }
-
- or_excl_ptr_list = e_keyrouter_hardkeys_list_get(krt->HardKeys, i, TIZEN_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE);
- if (or_excl_ptr_list)
+ for (unsigned int keyrouter_mode_idx = 0;
+ keyrouter_mode_idx < (sizeof(_keygrab_mode_list) / sizeof(_keygrab_mode_list[0]));
+ keyrouter_mode_idx++)
{
- fprintf(log_fl, " == Overidable Exclusive Grab ==\n");
- _e_keyrouter_keygrab_status_print(log_fl, or_excl_ptr_list);
- }
+ keygrab_list = e_keyrouter_hardkeys_list_get(krt->HardKeys, i, _keygrab_mode_list[keyrouter_mode_idx].keygrab_mode);
+ if (!keygrab_list) continue;
- top_ptr_list = e_keyrouter_hardkeys_list_get(krt->HardKeys, i, TIZEN_KEYROUTER_MODE_TOPMOST);
- if (top_ptr_list)
- {
- fprintf(log_fl, " == Top Position Grab ==\n");
- _e_keyrouter_keygrab_status_print(log_fl, top_ptr_list);
- }
-
- shared_ptr_list = e_keyrouter_hardkeys_list_get(krt->HardKeys, i, TIZEN_KEYROUTER_MODE_SHARED);
- if (shared_ptr_list)
- {
- fprintf(log_fl, " == Shared Grab ==\n");
- _e_keyrouter_keygrab_status_print(log_fl, shared_ptr_list);
+ fprintf(log_fl, " %s\n", _keygrab_mode_list[keyrouter_mode_idx].description);
+ _e_keyrouter_keygrab_status_print(log_fl, keygrab_list);
}
fprintf(log_fl, "\n");