diff options
-rw-r--r-- | packaging/e-mod-tizen-keyrouter.spec | 2 | ||||
-rw-r--r-- | src/e_mod_keyrouter_events.c | 47 | ||||
-rw-r--r-- | src/e_mod_main_wl.c | 18 | ||||
-rw-r--r-- | src/e_mod_main_wl.h | 2 |
4 files changed, 14 insertions, 55 deletions
diff --git a/packaging/e-mod-tizen-keyrouter.spec b/packaging/e-mod-tizen-keyrouter.spec index aed300b..739631d 100644 --- a/packaging/e-mod-tizen-keyrouter.spec +++ b/packaging/e-mod-tizen-keyrouter.spec @@ -1,5 +1,5 @@ Name: e-mod-tizen-keyrouter -Version: 0.2.3 +Version: 0.2.6 Release: 1 Summary: The Enlightenment Keyrouter Module for Tizen URL: http://www.enlightenment.org diff --git a/src/e_mod_keyrouter_events.c b/src/e_mod_keyrouter_events.c index 80c7804..e552687 100644 --- a/src/e_mod_keyrouter_events.c +++ b/src/e_mod_keyrouter_events.c @@ -699,12 +699,11 @@ e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface) char * e_keyrouter_util_cmd_get_from_pid(int pid) { - Eina_List *l; + Eina_List *l, *connected_ec_list; E_Comp_Connected_Client_Info *cdata; - EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL); - - EINA_LIST_FOREACH(e_comp->connected_clients, l, cdata) + connected_ec_list = e_comp_connected_ec_list_get(); + EINA_LIST_FOREACH(connected_ec_list, l, cdata) { if (cdata->pid == pid) return strdup(cdata->name); } @@ -745,46 +744,6 @@ _e_keyrouter_keycode_get_from_keysym(struct xkb_keymap *keymap, xkb_keysym_t key return found_keycodes.keycode; } -int -e_keyrouter_util_keycode_get_from_string(char * name) -{ - struct xkb_keymap *keymap = NULL; - xkb_keysym_t keysym = 0x0; - int keycode = 0; - - keymap = e_comp_wl->xkb.keymap; - EINA_SAFETY_ON_NULL_GOTO(keymap, finish); - - keysym = xkb_keysym_from_name(name, XKB_KEYSYM_NO_FLAGS); - EINA_SAFETY_ON_FALSE_GOTO(keysym != XKB_KEY_NoSymbol, finish); - - keycode = _e_keyrouter_keycode_get_from_keysym(keymap, keysym); - - KLDBG("request name: %s, return value: %d", name, keycode); - - return keycode; - -finish: - return 0; -} - -char * -e_keyrouter_util_keyname_get_from_keycode(int keycode) -{ - struct xkb_state *state; - xkb_keysym_t sym = XKB_KEY_NoSymbol; - char name[256] = {0, }; - - EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->xkb.state, NULL); - - state = e_comp_wl->xkb.state; - sym = xkb_state_key_get_one_sym(state, keycode); - xkb_keysym_get_name(sym, name, sizeof(name)); - - return strdup(name); -} - char * e_keyrouter_util_process_name_get_from_cmd(char *cmd) { diff --git a/src/e_mod_main_wl.c b/src/e_mod_main_wl.c index 59d6d73..311bf64 100644 --- a/src/e_mod_main_wl.c +++ b/src/e_mod_main_wl.c @@ -896,7 +896,7 @@ _e_keyrouter_info_print(void *data, const char *log_path) { if (!krt->HardKeys[i].keycode) continue; - keyname = e_keyrouter_util_keyname_get_from_keycode(i); + keyname = e_comp_wl_input_keymap_keycode_to_keyname(i); fprintf(log_fl, " Key [%3d], Keyname: %s\n", i, keyname); @@ -916,7 +916,7 @@ _e_keyrouter_info_print(void *data, const char *log_path) c = 0; EINA_LIST_FOREACH(rdata->keys, ll, idata) { - keyname = e_keyrouter_util_keyname_get_from_keycode(*idata); + keyname = e_comp_wl_input_keymap_keycode_to_keyname(*idata); if (c == 0) fprintf(log_fl, " registered key: Key [%3d], Keyname: %s\n", *idata, keyname); else @@ -988,7 +988,7 @@ _e_keyrouter_keygrab_print(void *data, const char *log_path) !krt->HardKeys[i].registered_ptr) continue; - keyname = e_keyrouter_util_keyname_get_from_keycode(i); + keyname = e_comp_wl_input_keymap_keycode_to_keyname(i); fprintf(log_fl, " [ Keycode: %d, Keyname: %s ]\n", i, keyname); @@ -1145,6 +1145,7 @@ _e_keyrouter_max_keycode_get(void) static E_Keyrouter_Config_Data * _e_keyrouter_init(E_Module *m) { + wl_display* comp_wl_display; E_Keyrouter_Config_Data *kconfig = NULL; krt = E_NEW(E_Keyrouter, 1); Eina_Bool res = EINA_FALSE; @@ -1167,9 +1168,10 @@ _e_keyrouter_init(E_Module *m) return NULL; } - if (!e_comp) + comp_wl_display = e_comp_wl_display_get(); + if (!comp_wl_display) { - KLERR("Failed to initialize keyrouter module ! (e_comp == NULL)"); + KLERR("Failed to initialize keyrouter module ! (comp_wl_display == NULL)"); goto err; } @@ -1194,7 +1196,7 @@ _e_keyrouter_init(E_Module *m) ecore_idle_enterer_add(_e_keyrouter_cb_idler, NULL); _e_keyrouter_init_handlers(); - krt->global = wl_global_create(e_comp_wl->wl.disp, &tizen_keyrouter_interface, 1, krt, _e_keyrouter_cb_bind); + krt->global = wl_global_create(comp_wl_display, &tizen_keyrouter_interface, 1, krt, _e_keyrouter_cb_bind); if (!krt->global) { KLERR("Failed to create global !"); @@ -1350,7 +1352,7 @@ _e_keyrouter_query_tizen_key_table(void) { if (krt->HardKeys[data->keycode].repeat == EINA_FALSE) { - res = xkb_keymap_key_set_repeats(e_comp_wl->xkb.keymap, data->keycode, 0); + res = xkb_keymap_key_set_repeats(e_comp_wl_input_xkb_keymap_get(), data->keycode, 0); if (!res) { KLWRN("Failed to set repeat key(%d), value(%d)", data->keycode, 0); @@ -1364,7 +1366,7 @@ _e_keyrouter_query_tizen_key_table(void) KLINF("Server create a new cache file: %s", e_comp_wl_input_keymap_path_get(names)); res = unlink(e_comp_wl_input_keymap_path_get(names)); - e_comp_wl_input_keymap_set(NULL, NULL, NULL, NULL, NULL, xkb_context_ref(e_comp_wl->xkb.context), xkb_keymap_ref(e_comp_wl->xkb.keymap)); + e_comp_wl_input_keymap_default_set(); } else KLINF("Currently cache file is exist. Do not change it."); diff --git a/src/e_mod_main_wl.h b/src/e_mod_main_wl.h index 2172a7f..7f9b99b 100644 --- a/src/e_mod_main_wl.h +++ b/src/e_mod_main_wl.h @@ -158,8 +158,6 @@ Eina_Bool IsInvisibleGetWindow(struct wl_resource *surface); struct wl_resource *e_keyrouter_util_get_surface_from_eclient(E_Client *client); int e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface); char *e_keyrouter_util_cmd_get_from_pid(int pid); -int e_keyrouter_util_keycode_get_from_string(char *name); -char *e_keyrouter_util_keyname_get_from_keycode(int keycode); char *e_keyrouter_util_process_name_get_from_cmd(char *cmd); const char *e_keyrouter_mode_to_string(uint32_t mode); |