2 #include "e_mod_main.h"
3 #include "e_mod_config.h"
6 /* local function prototypes */
7 static void _il_kbd_stop(void);
8 static void _il_kbd_start(void);
9 static Eina_Bool _il_kbd_cb_exit(void *data, int type, void *event);
12 static E_Kbd_Int *ki = NULL;
13 static Ecore_Exe *_kbd_exe = NULL;
14 static Ecore_Event_Handler *_kbd_exe_exit_handler = NULL;
16 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" };
19 e_modapi_init(E_Module *m)
21 if (!il_kbd_config_init(m)) return NULL;
27 e_modapi_shutdown(E_Module *m __UNUSED__)
30 il_kbd_config_shutdown();
35 e_modapi_save(E_Module *m __UNUSED__)
37 return il_kbd_config_save();
41 il_kbd_cfg_update(void)
50 if (ki) e_kbd_int_free(ki);
52 if (_kbd_exe) ecore_exe_interrupt(_kbd_exe);
54 if (_kbd_exe_exit_handler) ecore_event_handler_del(_kbd_exe_exit_handler);
55 _kbd_exe_exit_handler = NULL;
61 if (il_kbd_cfg->use_internal)
63 ki = e_kbd_int_new(il_kbd_cfg->mod_dir,
64 il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir);
66 else if (il_kbd_cfg->run_keyboard)
68 E_Exec_Instance *inst;
69 Efreet_Desktop *desktop;
71 desktop = efreet_util_desktop_file_id_find(il_kbd_cfg->run_keyboard);
77 kbds = efreet_util_desktop_category_list("Keyboard");
80 EINA_LIST_FOREACH(kbds, l, d)
84 dname = ecore_file_file_get(d->orig_path);
87 if (!strcmp(dname, il_kbd_cfg->run_keyboard))
90 efreet_desktop_ref(desktop);
95 EINA_LIST_FREE(kbds, d)
96 efreet_desktop_free(d);
103 zone = e_util_zone_current_get(e_manager_current_get());
104 inst = e_exec(zone, desktop, NULL, NULL, "illume-keyboard");
107 _kbd_exe = inst->exe;
108 _kbd_exe_exit_handler =
109 ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
110 _il_kbd_cb_exit, NULL);
112 efreet_desktop_free(desktop);
118 _il_kbd_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
120 Ecore_Exe_Event_Del *ev;
123 if (ev->exe == _kbd_exe) _kbd_exe = NULL;
124 return ECORE_CALLBACK_PASS_ON;