From 31a593b8e02a83eeba4b0121ef9a5e59ab569ece Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Mon, 29 Aug 2011 09:30:18 +0000 Subject: [PATCH] e17/illume-keyboard: add option for default keyboard layout. - resize window to zone->useful_geometry to make it work with shelves SVN revision: 62938 --- src/modules/illume-keyboard/e_kbd_int.c | 16 ++++++++++++---- src/modules/illume-keyboard/e_mod_config.c | 23 ++++++++++++++++++++--- src/modules/illume-keyboard/e_mod_config.h | 4 +++- src/modules/illume-keyboard/e_mod_main.c | 1 + 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/modules/illume-keyboard/e_kbd_int.c b/src/modules/illume-keyboard/e_kbd_int.c index 2d43cae..acb3e8e 100644 --- a/src/modules/illume-keyboard/e_kbd_int.c +++ b/src/modules/illume-keyboard/e_kbd_int.c @@ -899,6 +899,10 @@ _e_kbd_int_layouts_list_default_get(E_Kbd_Int *ki) Eina_List *l; EINA_LIST_FOREACH(ki->layouts, l, kil) + if (kil->type == il_kbd_cfg->layout) + return kil; + + EINA_LIST_FOREACH(ki->layouts, l, kil) if ((!strcmp(ecore_file_file_get(kil->path), "Default.kbd"))) return kil; return NULL; @@ -1729,10 +1733,14 @@ e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts) ecore_x_icccm_hints_set(ki->win->evas_win, 0, 0, 0, 0, 0, 0, 0); e_win_no_remember_set(ki->win, 1); - if (zone->w > zone->h) - e_win_resize(ki->win, zone->w, (zone->h / 2)); + mw = zone->useful_geometry.w; + if (mw < 100) mw = zone->w; + mh = zone->useful_geometry.h; + if (mh < 100) mh = zone->h; + if (mw > mh) + e_win_resize(ki->win, mw, (mh / 2)); else - e_win_resize(ki->win, zone->w, zone->h); + e_win_resize(ki->win, mw, mh); e_win_resize_callback_set(ki->win, _e_kbd_int_cb_resize); e_win_borderless_set(ki->win, 1); @@ -1789,7 +1797,7 @@ e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts) evas_object_resize(ki->base_obj, mw, mh); evas_object_show(ki->base_obj); - e_win_size_min_set(ki->win, zone->w, mh); + e_win_size_min_set(ki->win, zone->useful_geometry.w, mh); ecore_x_e_virtual_keyboard_set(ki->win->evas_win, 1); ki->client_message_handler = diff --git a/src/modules/illume-keyboard/e_mod_config.c b/src/modules/illume-keyboard/e_mod_config.c index 4c1989d..fec9fe2 100644 --- a/src/modules/illume-keyboard/e_mod_config.c +++ b/src/modules/illume-keyboard/e_mod_config.c @@ -1,6 +1,7 @@ #include "e.h" #include "e_mod_main.h" #include "e_mod_config.h" +#include "e_kbd_int.h" /* local function prototypes */ static void *_il_kbd_config_create(E_Config_Dialog *cfd); @@ -33,7 +34,7 @@ il_kbd_config_init(E_Module *m) E_CONFIG_VAL(D, T, hold_timer, DOUBLE); E_CONFIG_VAL(D, T, slide_dim, INT); E_CONFIG_VAL(D, T, scale_height, DOUBLE); - + E_CONFIG_VAL(D, T, layout, INT); il_kbd_cfg = e_config_domain_load("module.illume-keyboard", conf_edd); if ((il_kbd_cfg) && ((il_kbd_cfg->version >> 16) < IL_CONFIG_MAJ)) @@ -56,13 +57,18 @@ il_kbd_config_init(E_Module *m) { /* Add new config variables here */ /* if ((il_kbd_cfg->version & 0xffff) < 1) */ - if ((il_kbd_cfg->version & 0xffff) < IL_CONFIG_MIN) + if ((il_kbd_cfg->version & 0xffff) < 2) { il_kbd_cfg->zoom_level = 4; il_kbd_cfg->slide_dim = 4; il_kbd_cfg->hold_timer = 0.25; il_kbd_cfg->scale_height = 1.0; } + if ((il_kbd_cfg->version & 0xffff) < IL_CONFIG_MIN) + { + il_kbd_cfg->layout = E_KBD_INT_TYPE_ALPHA; + } + il_kbd_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN; } @@ -207,7 +213,7 @@ _il_kbd_config_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_D nn++; } } - + ol = e_widget_label_add(evas, _("Displacement ratio")); e_widget_framelist_object_append(of, ol); sl = e_widget_slider_add(evas, EINA_TRUE, 0, "1/%.0f", 1.0, 10.0, 1.0, 0, @@ -236,6 +242,17 @@ _il_kbd_config_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_D e_widget_framelist_object_append(of, sl); e_widget_list_object_append(list, of, 1, 0, 0.0); + + of = e_widget_framelist_add(evas, _("Layout"), 0); + rg = e_widget_radio_group_new(&(il_kbd_cfg->layout)); + ow = e_widget_radio_add(evas, _("Default"), E_KBD_INT_TYPE_ALPHA, rg); + e_widget_framelist_object_append(of, ow); + evas_object_smart_callback_add(ow, "changed", _il_kbd_config_changed, NULL); + ow = e_widget_radio_add(evas, _("Terminal"), E_KBD_INT_TYPE_TERMINAL, rg); + e_widget_framelist_object_append(of, ow); + evas_object_smart_callback_add(ow, "changed", _il_kbd_config_changed, NULL); + e_widget_list_object_append(list, of, 1, 0, 0.0); + return list; } diff --git a/src/modules/illume-keyboard/e_mod_config.h b/src/modules/illume-keyboard/e_mod_config.h index b45a1dd..d529a3f 100644 --- a/src/modules/illume-keyboard/e_mod_config.h +++ b/src/modules/illume-keyboard/e_mod_config.h @@ -1,7 +1,7 @@ #ifndef E_MOD_CONFIG_H #define E_MOD_CONFIG_H -#define IL_CONFIG_MIN 2 +#define IL_CONFIG_MIN 3 #define IL_CONFIG_MAJ 1 typedef struct _Il_Kbd_Config Il_Kbd_Config; @@ -19,6 +19,8 @@ struct _Il_Kbd_Config int slide_dim; double hold_timer; double scale_height; + int layout; + E_Config_Dialog *cfd; }; diff --git a/src/modules/illume-keyboard/e_mod_main.c b/src/modules/illume-keyboard/e_mod_main.c index 91116e9..358a415 100644 --- a/src/modules/illume-keyboard/e_mod_main.c +++ b/src/modules/illume-keyboard/e_mod_main.c @@ -20,6 +20,7 @@ e_modapi_init(E_Module *m) { if (!il_kbd_config_init(m)) return NULL; _il_kbd_start(); + e_module_delayed_set(m, 1); return m; } -- 2.7.4