From: Enlightenment S. <no-...@en...> - 2011-11-07 23:30:37
|
Log: OMG! DEVILHORNS USING AN EDITOR WITH TABS INSTEAD OF WHITESPACES????? SAY IT AIN'T SO!!! Author: discomfitor Date: 2011-11-07 15:30:27 -0800 (Mon, 07 Nov 2011) New Revision: 64906 Trac: http://trac.enlightenment.org/e/changeset/64906 Modified: trunk/e/src/modules/illume-bluetooth/e_mod_main.c trunk/e/src/modules/illume-home-toggle/e_mod_main.c trunk/e/src/modules/illume-home/e_mod_main.c trunk/e/src/modules/illume-indicator/e_mod_ind_win.c trunk/e/src/modules/illume-kbd-toggle/e_mod_main.c trunk/e/src/modules/illume-keyboard/e_kbd_buf.c trunk/e/src/modules/illume-keyboard/e_kbd_dict.c trunk/e/src/modules/illume-keyboard/e_kbd_int.c trunk/e/src/modules/illume-keyboard/e_mod_config.c trunk/e/src/modules/illume-keyboard/e_mod_main.c trunk/e/src/modules/illume-mode-toggle/e_mod_main.c trunk/e/src/modules/illume2/e_illume.c trunk/e/src/modules/illume2/e_mod_config_animation.c trunk/e/src/modules/illume2/e_mod_kbd.c trunk/e/src/modules/illume2/e_mod_kbd_device.c trunk/e/src/modules/illume2/e_mod_quickpanel.c trunk/e/src/modules/illume2/e_mod_select_window.c Modified: trunk/e/src/modules/illume-bluetooth/e_mod_main.c =================================================================== --- trunk/e/src/modules/illume-bluetooth/e_mod_main.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-bluetooth/e_mod_main.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -169,7 +169,7 @@ } fclose(f); } - free(name); + free(name); } return 0; } Modified: trunk/e/src/modules/illume-home/e_mod_main.c =================================================================== --- trunk/e/src/modules/illume-home/e_mod_main.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-home/e_mod_main.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -254,9 +254,9 @@ if (sm->type != EFREET_MENU_ENTRY_DESKTOP) continue; if (!(desktop = sm->desktop)) continue; - if ((settings) && (sys) && - (eina_list_data_find(settings, desktop)) && - (eina_list_data_find(sys, desktop))) continue; + if ((settings) && (sys) && + (eina_list_data_find(settings, desktop)) && + (eina_list_data_find(sys, desktop))) continue; if ((kbd) && (eina_list_data_find(kbd, desktop))) continue; efreet_desktop_ref(desktop); @@ -650,7 +650,7 @@ } exes = eina_list_remove_list(exes, l); if (exe->timeout) ecore_timer_del(exe->timeout); - if (exe->desktop) efreet_desktop_free(exe->desktop); + if (exe->desktop) efreet_desktop_free(exe->desktop); E_FREE(exe); break; } @@ -740,17 +740,17 @@ EINA_LIST_FOREACH(hwins, l, hwin) { - E_Zone *zone; - E_Desk *desk; - const char *bgfile; + E_Zone *zone; + E_Desk *desk; + const char *bgfile; - zone = hwin->zone; - desk = e_desk_current_get(zone); - if (desk) - bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y); - else - bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1); - edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background"); + zone = hwin->zone; + desk = e_desk_current_get(zone); + if (desk) + bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y); + else + bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1); + edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background"); } return ECORE_CALLBACK_PASS_ON; Modified: trunk/e/src/modules/illume-home-toggle/e_mod_main.c =================================================================== --- trunk/e/src/modules/illume-home-toggle/e_mod_main.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-home-toggle/e_mod_main.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -64,14 +64,14 @@ inst = E_NEW(Instance, 1); inst->o_toggle = edje_object_add(gc->evas); e_theme_edje_object_set(inst->o_toggle, - "base/theme/modules/illume_home_toggle", - "e/modules/illume_home_toggle/main"); + "base/theme/modules/illume_home_toggle", + "e/modules/illume_home_toggle/main"); inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle); inst->gcc->data = inst; edje_object_signal_callback_add(inst->o_toggle, "e,action,home", "", - _cb_action_home, inst); + _cb_action_home, inst); instances = eina_list_append(instances, inst); return inst->gcc; Modified: trunk/e/src/modules/illume-indicator/e_mod_ind_win.c =================================================================== --- trunk/e/src/modules/illume-indicator/e_mod_ind_win.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-indicator/e_mod_ind_win.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -394,9 +394,9 @@ /* tell edj we are going to start moving */ edje_object_signal_emit(iwin->o_base, "e,action,move,start", "e"); - /* tell quickpanel to hide because we are going to drag */ - ecore_x_e_illume_quickpanel_state_send(bd->zone->black_win, - ECORE_X_ILLUME_QUICKPANEL_STATE_OFF); + /* tell quickpanel to hide because we are going to drag */ + ecore_x_e_illume_quickpanel_state_send(bd->zone->black_win, + ECORE_X_ILLUME_QUICKPANEL_STATE_OFF); /* send message that we are going to start dragging */ ecore_x_e_illume_drag_start_send(bd->client.win); Modified: trunk/e/src/modules/illume-kbd-toggle/e_mod_main.c =================================================================== --- trunk/e/src/modules/illume-kbd-toggle/e_mod_main.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-kbd-toggle/e_mod_main.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -71,16 +71,16 @@ inst = E_NEW(Instance, 1); inst->o_toggle = edje_object_add(gc->evas); e_theme_edje_object_set(inst->o_toggle, - "base/theme/modules/illume_kbd_toggle", - "e/modules/illume_kbd_toggle/main"); + "base/theme/modules/illume_kbd_toggle", + "e/modules/illume_kbd_toggle/main"); inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle); inst->gcc->data = inst; edje_object_signal_callback_add(inst->o_toggle, "e,action,vkbd,enable", "", - _cb_action_vkbd_enable, inst); + _cb_action_vkbd_enable, inst); edje_object_signal_callback_add(inst->o_toggle, "e,action,vkbd,disable", "", - _cb_action_vkbd_disable, inst); + _cb_action_vkbd_disable, inst); inst->handlers = eina_list_append(inst->handlers, @@ -160,7 +160,7 @@ if (bd->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) return; ecore_x_e_virtual_keyboard_state_set(bd->client.win, - ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); + ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); } static void @@ -175,7 +175,7 @@ if (bd->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return; ecore_x_e_virtual_keyboard_state_set(bd->client.win, - ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); + ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); } static Eina_Bool Modified: trunk/e/src/modules/illume-keyboard/e_kbd_buf.c =================================================================== --- trunk/e/src/modules/illume-keyboard/e_kbd_buf.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-keyboard/e_kbd_buf.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -25,14 +25,14 @@ if (kbl->ref > 0) return; while (kbl->keys) { - E_Kbd_Buf_Key *ky; - - ky = kbl->keys->data; - if (ky->key) eina_stringshare_del(ky->key); - if (ky->key_shift) eina_stringshare_del(ky->key_shift); - if (ky->key_capslock) eina_stringshare_del(ky->key_capslock); - free(ky); - kbl->keys = eina_list_remove_list(kbl->keys, kbl->keys); + E_Kbd_Buf_Key *ky; + + ky = kbl->keys->data; + if (ky->key) eina_stringshare_del(ky->key); + if (ky->key_shift) eina_stringshare_del(ky->key_shift); + if (ky->key_capslock) eina_stringshare_del(ky->key_capslock); + free(ky); + kbl->keys = eina_list_remove_list(kbl->keys, kbl->keys); } free(kbl); } @@ -42,9 +42,9 @@ { while (kb->string_matches) { - if (kb->string_matches->data) - eina_stringshare_del(kb->string_matches->data); - kb->string_matches = eina_list_remove_list(kb->string_matches, kb->string_matches); + if (kb->string_matches->data) + eina_stringshare_del(kb->string_matches->data); + kb->string_matches = eina_list_remove_list(kb->string_matches, kb->string_matches); } } @@ -62,15 +62,15 @@ for (l = kbl->keys; l; l = l->next) { - E_Kbd_Buf_Key *ky; - - ky = l->data; - if (ky->key) - { - if ((x >= ky->x) && (y >= ky->y) && - (x < (ky->x + ky->w)) && (y < (ky->y + ky->h))) - return ky; - } + E_Kbd_Buf_Key *ky; + + ky = l->data; + if (ky->key) + { + if ((x >= ky->x) && (y >= ky->y) && + (x < (ky->x + ky->w)) && (y < (ky->y + ky->h))) + return ky; + } } return NULL; } @@ -84,21 +84,21 @@ for (l = kbl->keys; l; l = l->next) { - E_Kbd_Buf_Key *ky; - int dist, dx, dy; - - ky = l->data; - if (ky->key) - { - dx = x - (ky->x + (ky->w / 2)); - dy = y - (ky->y + (ky->h / 2)); - dist = (dx * dx) + (dy * dy); - if (dist < dist_closest) - { - ky_closest = ky; - dist_closest = dist; - } - } + E_Kbd_Buf_Key *ky; + int dist, dx, dy; + + ky = l->data; + if (ky->key) + { + dx = x - (ky->x + (ky->w / 2)); + dy = y - (ky->y + (ky->h / 2)); + dist = (dx * dx) + (dy * dy); + if (dist < dist_closest) + { + ky_closest = ky; + dist_closest = dist; + } + } } return ky_closest; } @@ -110,17 +110,17 @@ if ((ky) && (ky->key)) { - if (ks->shift) - { - if (ky->key_shift) str = ky->key_shift; - else str = ky->key; - } - else if (ks->capslock) - { - if (ky->key_capslock) str = ky->key_capslock; - else str = ky->key; - } - else str = ky->key; + if (ks->shift) + { + if (ky->key_shift) str = ky->key_shift; + else str = ky->key; + } + else if (ks->capslock) + { + if (ky->key_capslock) str = ky->key_capslock; + else str = ky->key; + } + else str = ky->key; } return str; } @@ -133,11 +133,11 @@ if (ks->key) str = ks->key; else { - E_Kbd_Buf_Key *ky; - - ky = _e_kbd_buf_at_coord_get(kb, ks->layout, ks->x, ks->y); - if (!ky) ky = _e_kbd_buf_closest_get(kb, ks->layout, ks->x, ks->y); - str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky); + E_Kbd_Buf_Key *ky; + + ky = _e_kbd_buf_at_coord_get(kb, ks->layout, ks->x, ks->y); + if (!ky) ky = _e_kbd_buf_closest_get(kb, ks->layout, ks->x, ks->y); + str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky); } return str; } @@ -154,18 +154,18 @@ _e_kbd_buf_actual_string_clear(kb); EINA_LIST_FOREACH(kb->keystrokes, l, ks) { - const char *str; - - str = _e_kbd_buf_keystroke_string_get(kb, ks); + const char *str; + + str = _e_kbd_buf_keystroke_string_get(kb, ks); if (!str) continue; if (!actual) actual_size += 64, actual = malloc(actual_size); else if ((actual_len + strlen(str) + 1) > actual_size) - { - actual_size += 64; - actual = realloc(actual, actual_size); - } - strcpy(actual + actual_len, str); - actual_len += strlen(str); + { + actual_size += 64; + actual = realloc(actual, actual_size); + } + strcpy(actual + actual_len, str); + actual_len += strlen(str); } kb->actual_string = eina_stringshare_add(actual); free(actual); @@ -178,7 +178,7 @@ for (l = matches; l; l = l->next) { - if (!strcmp(l->data, s)) return s; + if (!strcmp(l->data, s)) return s; } return NULL; } @@ -196,18 +196,18 @@ dicts[2] = kb->dict.data; for (i = 0; i < 3; i++) { - if (!dicts[i]) continue; - e_kbd_dict_matches_lookup(dicts[i]); - e_kbd_dict_matches_first(dicts[i]); - for (;;) - { - word = e_kbd_dict_matches_match_get(dicts[i], &pri); - if (!word) break; - if (!_e_kbd_buf_matches_find(kb->string_matches, word)) - kb->string_matches = eina_list_append(kb->string_matches, - eina_stringshare_add(word)); - e_kbd_dict_matches_next(dicts[i]); - } + if (!dicts[i]) continue; + e_kbd_dict_matches_lookup(dicts[i]); + e_kbd_dict_matches_first(dicts[i]); + for (;;) + { + word = e_kbd_dict_matches_match_get(dicts[i], &pri); + if (!word) break; + if (!_e_kbd_buf_matches_find(kb->string_matches, word)) + kb->string_matches = eina_list_append(kb->string_matches, + eina_stringshare_add(word)); + e_kbd_dict_matches_next(dicts[i]); + } } } @@ -253,8 +253,8 @@ kb->dict.sys = e_kbd_dict_new(buf); if (!kb->dict.sys) { - snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict); - kb->dict.sys = e_kbd_dict_new(buf); + snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict); + kb->dict.sys = e_kbd_dict_new(buf); } e_user_dir_concat_static(buf, "dicts-dynamic"); @@ -264,15 +264,15 @@ kb->dict.personal = e_kbd_dict_new(buf); if (!kb->dict.personal) { - FILE *f; - - f = fopen(buf, "w"); - if (f) - { - fprintf(f, "\n"); - fclose(f); - } - kb->dict.personal = e_kbd_dict_new(buf); + FILE *f; + + f = fopen(buf, "w"); + if (f) + { + fprintf(f, "\n"); + fclose(f); + } + kb->dict.personal = e_kbd_dict_new(buf); } e_user_dir_concat_static(buf, "dicts-dynamic/data.dic"); kb->dict.data = e_kbd_dict_new(buf); @@ -312,8 +312,8 @@ kb->dict.sys = e_kbd_dict_new(buf); if (!kb->dict.sys) { - snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict); - kb->dict.sys = e_kbd_dict_new(buf); + snprintf(buf, sizeof(buf), "%s/dicts/%s", kb->sysdicts, dict); + kb->dict.sys = e_kbd_dict_new(buf); } } @@ -323,13 +323,13 @@ e_kbd_buf_lookup_cancel(kb); while (kb->keystrokes) { - E_Kbd_Buf_Keystroke *ks; - - ks = kb->keystrokes->data; - if (ks->key) eina_stringshare_del(ks->key); - _e_kbd_buf_layout_unref(ks->layout); - free(ks); - kb->keystrokes = eina_list_remove_list(kb->keystrokes, kb->keystrokes); + E_Kbd_Buf_Keystroke *ks; + + ks = kb->keystrokes->data; + if (ks->key) eina_stringshare_del(ks->key); + _e_kbd_buf_layout_unref(ks->layout); + free(ks); + kb->keystrokes = eina_list_remove_list(kb->keystrokes, kb->keystrokes); } _e_kbd_buf_string_matches_clear(kb); if (kb->dict.sys) e_kbd_dict_word_letter_clear(kb->dict.sys); @@ -343,8 +343,8 @@ { if (kb->layout) { - _e_kbd_buf_layout_unref(kb->layout); - kb->layout = NULL; + _e_kbd_buf_layout_unref(kb->layout); + kb->layout = NULL; } } @@ -393,9 +393,9 @@ str = _e_kbd_buf_keystroke_string_get(kb, ks); if (str) { - if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, 0); - if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, 0); - if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, 0); + if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, 0); + if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, 0); + if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, 0); } } @@ -433,26 +433,26 @@ for (l = ks->layout->keys; l; l = l->next) { - E_Kbd_Buf_Key *ky; - const char *str; - int px, py, dx, dy, d; + E_Kbd_Buf_Key *ky; + const char *str; + int px, py, dx, dy, d; - ky = l->data; - px = ky->x + (ky->w / 2); - py = ky->y + (ky->h / 2); - dx = ks->x - px; - dy = ks->y - py; - d = sqrt((dx * dx) + (dy * dy)); - if (d <= ks->layout->fuzz) - { - str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky); - if (str) - { - if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, d); - if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, d); - if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, d); - } - } + ky = l->data; + px = ky->x + (ky->w / 2); + py = ky->y + (ky->h / 2); + dx = ks->x - px; + dy = ks->y - py; + d = sqrt((dx * dx) + (dy * dy)); + if (d <= ks->layout->fuzz) + { + str = _e_kbd_buf_keystroke_key_string_get(kb, ks, ky); + if (str) + { + if (kb->dict.sys) e_kbd_dict_word_letter_add(kb->dict.sys, str, d); + if (kb->dict.personal) e_kbd_dict_word_letter_add(kb->dict.personal, str, d); + if (kb->dict.data) e_kbd_dict_word_letter_add(kb->dict.data, str, d); + } + } } } @@ -504,18 +504,18 @@ l = eina_list_last(kb->keystrokes); if (l) { - E_Kbd_Buf_Keystroke *ks; - - ks = l->data; - if (ks->key) eina_stringshare_del(ks->key); - _e_kbd_buf_layout_unref(ks->layout); - free(ks); - kb->keystrokes = eina_list_remove_list(kb->keystrokes, l); - if (kb->dict.sys) e_kbd_dict_word_letter_delete(kb->dict.sys); - if (kb->dict.personal) e_kbd_dict_word_letter_delete(kb->dict.personal); - if (kb->dict.data) e_kbd_dict_word_letter_delete(kb->dict.data); - _e_kbd_buf_actual_string_update(kb); - _e_kbd_buf_matches_update(kb); + E_Kbd_Buf_Keystroke *ks; + + ks = l->data; + if (ks->key) eina_stringshare_del(ks->key); + _e_kbd_buf_layout_unref(ks->layout); + free(ks); + kb->keystrokes = eina_list_remove_list(kb->keystrokes, l); + if (kb->dict.sys) e_kbd_dict_word_letter_delete(kb->dict.sys); + if (kb->dict.personal) e_kbd_dict_word_letter_delete(kb->dict.personal); + if (kb->dict.data) e_kbd_dict_word_letter_delete(kb->dict.data); + _e_kbd_buf_actual_string_update(kb); + _e_kbd_buf_matches_update(kb); } } Modified: trunk/e/src/modules/illume-keyboard/e_kbd_dict.c =================================================================== --- trunk/e/src/modules/illume-keyboard/e_kbd_dict.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-keyboard/e_kbd_dict.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -15,69 +15,69 @@ int i; const char *table[][2] = { - {"À", "a"}, - {"Á", "a"}, - {"Â", "a"}, - {"Ã", "a"}, - {"Ä", "a"}, - {"Å", "a"}, - {"Æ", "a"}, - {"Ç", "c"}, - {"È", "e"}, - {"É", "e"}, - {"Ê", "e"}, - {"Ë", "e"}, - {"Ì", "i"}, - {"Í", "i"}, - {"Î", "i"}, - {"Ï", "i"}, - {"Ð", "d"}, - {"Ñ", "n"}, - {"Ò", "o"}, - {"Ó", "o"}, - {"Ô", "o"}, - {"Õ", "o"}, - {"Ö", "o"}, - {"×", "x"}, - {"Ø", "o"}, - {"Ù", "u"}, - {"Ú", "u"}, - {"Û", "u"}, - {"Ü", "u"}, - {"Ý", "y"}, - {"Þ", "p"}, - {"ß", "s"}, - {"à", "a"}, - {"á", "a"}, - {"â", "a"}, - {"ã", "a"}, - {"ä", "a"}, - {"å", "a"}, - {"æ", "a"}, - {"ç", "c"}, - {"è", "e"}, - {"é", "e"}, - {"ê", "e"}, - {"ë", "e"}, - {"ì", "i"}, - {"í", "i"}, - {"î", "i"}, - {"ï", "i"}, - {"ð", "o"}, - {"ñ", "n"}, - {"ò", "o"}, - {"ó", "o"}, - {"ô", "o"}, - {"õ", "o"}, - {"ö", "o"}, - {"ø", "o"}, - {"ù", "u"}, - {"ú", "u"}, - {"û", "u"}, - {"ü", "u"}, - {"ý", "y"}, - {"þ", "p"}, - {"ÿ", "y"} + {"À", "a"}, + {"Á", "a"}, + {"Â", "a"}, + {"Ã", "a"}, + {"Ä", "a"}, + {"Å", "a"}, + {"Æ", "a"}, + {"Ç", "c"}, + {"È", "e"}, + {"É", "e"}, + {"Ê", "e"}, + {"Ë", "e"}, + {"Ì", "i"}, + {"Í", "i"}, + {"Î", "i"}, + {"Ï", "i"}, + {"Ð", "d"}, + {"Ñ", "n"}, + {"Ò", "o"}, + {"Ó", "o"}, + {"Ô", "o"}, + {"Õ", "o"}, + {"Ö", "o"}, + {"×", "x"}, + {"Ø", "o"}, + {"Ù", "u"}, + {"Ú", "u"}, + {"Û", "u"}, + {"Ü", "u"}, + {"Ý", "y"}, + {"Þ", "p"}, + {"ß", "s"}, + {"à", "a"}, + {"á", "a"}, + {"â", "a"}, + {"ã", "a"}, + {"ä", "a"}, + {"å", "a"}, + {"æ", "a"}, + {"ç", "c"}, + {"è", "e"}, + {"é", "e"}, + {"ê", "e"}, + {"ë", "e"}, + {"ì", "i"}, + {"í", "i"}, + {"î", "i"}, + {"ï", "i"}, + {"ð", "o"}, + {"ñ", "n"}, + {"ò", "o"}, + {"ó", "o"}, + {"ô", "o"}, + {"õ", "o"}, + {"ö", "o"}, + {"ø", "o"}, + {"ù", "u"}, + {"ú", "u"}, + {"û", "u"}, + {"ü", "u"}, + {"ý", "y"}, + {"þ", "p"}, + {"ÿ", "y"} }; // 63 items if (_e_kbd_normalise_ready) return; @@ -86,17 +86,17 @@ _e_kbd_normalise_base[i] = tolower(i); for (;i < MAXLATIN; i++) { - int glyph, j; + int glyph, j; - for (j = 0; j < 63; j++) - { - evas_string_char_next_get(table[j][0], 0, &glyph); - if (glyph == i) - { - _e_kbd_normalise_base[i] = *table[j][1]; - break; - } - } + for (j = 0; j < 63; j++) + { + evas_string_char_next_get(table[j][0], 0, &glyph); + if (glyph == i) + { + _e_kbd_normalise_base[i] = *table[j][1]; + break; + } + } } } @@ -181,8 +181,8 @@ if (*ps == '\n') *usage = 0; else { - ps++; - *usage = atoi(ps); + ps++; + *usage = atoi(ps); } return wd; } @@ -212,38 +212,38 @@ pglyphs[0] = pglyphs[1] = 0; while (p < e) { - eol = strchr(p, '\n'); - if (!eol) break; - if (eol > p) - { - glyphs[0] = glyphs[1] = 0; - _e_kbd_dict_lookup_build_line(kd, p, eol, glyphs); - if ((glyphs[1] != pglyphs[1]) || (glyphs[0] != pglyphs[0])) - { - int v1, v2; + eol = strchr(p, '\n'); + if (!eol) break; + if (eol > p) + { + glyphs[0] = glyphs[1] = 0; + _e_kbd_dict_lookup_build_line(kd, p, eol, glyphs); + if ((glyphs[1] != pglyphs[1]) || (glyphs[0] != pglyphs[0])) + { + int v1, v2; - if (isspace(glyphs[0])) - { - glyphs[0] = 0; - glyphs[1] = 0; - } - else if (isspace(glyphs[1])) - glyphs[1] = 0; - if (glyphs[0] == 0) - { - pglyphs[0] = pglyphs[1] = 0; - p = eol + 1; - continue; - } - v1 = _e_kbd_dict_letter_normalise(glyphs[0]); - v2 = _e_kbd_dict_letter_normalise(glyphs[1]); - if (!kd->lookup.tuples[v1][v2]) - kd->lookup.tuples[v1][v2] = p; - pglyphs[0] = v1; - pglyphs[1] = v2; - } - } - p = eol + 1; + if (isspace(glyphs[0])) + { + glyphs[0] = 0; + glyphs[1] = 0; + } + else if (isspace(glyphs[1])) + glyphs[1] = 0; + if (glyphs[0] == 0) + { + pglyphs[0] = pglyphs[1] = 0; + p = eol + 1; + continue; + } + v1 = _e_kbd_dict_letter_normalise(glyphs[0]); + v2 = _e_kbd_dict_letter_normalise(glyphs[1]); + if (!kd->lookup.tuples[v1][v2]) + kd->lookup.tuples[v1][v2] = p; + pglyphs[0] = v1; + pglyphs[1] = v2; + } + } + p = eol + 1; } } @@ -256,19 +256,19 @@ if (kd->file.fd < 0) return 0; if (fstat(kd->file.fd, &st) < 0) { - close(kd->file.fd); - return 0; + close(kd->file.fd); + return 0; } kd->file.size = st.st_size; eina_mmap_safety_enabled_set(EINA_TRUE); kd->file.dict = mmap(NULL, kd->file.size, PROT_READ, MAP_SHARED, - kd->file.fd, 0); + kd->file.fd, 0); if ((kd->file.dict== MAP_FAILED) || (!kd->file.dict)) { - close(kd->file.fd); - return 0; + close(kd->file.fd); + return 0; } return 1; } @@ -297,15 +297,15 @@ kd->file.file = eina_stringshare_add(file); if (!kd->file.file) { - free(kd); - return NULL; + free(kd); + return NULL; } kd->file.fd = -1; if (!_e_kbd_dict_open(kd)) { - eina_stringshare_del(kd->file.file); - free(kd); - return NULL; + eina_stringshare_del(kd->file.file); + free(kd); + return NULL; } _e_kbd_dict_lookup_build(kd); return kd; @@ -328,10 +328,10 @@ for (l = kd->changed.writes; l; l = l->next) { - E_Kbd_Dict_Word *kw; + E_Kbd_Dict_Word *kw; - kw = l->data; - if (!strcmp(kw->word, word)) return kw; + kw = l->data; + if (!strcmp(kw->word, word)) return kw; } return NULL; } @@ -346,91 +346,91 @@ if (!kd->changed.writes) return; if (kd->changed.flush_timer) { - ecore_timer_del(kd->changed.flush_timer); - kd->changed.flush_timer = NULL; + ecore_timer_del(kd->changed.flush_timer); + kd->changed.flush_timer = NULL; } ecore_file_unlink(kd->file.file); f = fopen(kd->file.file, "w"); kd->changed.writes = eina_list_sort(kd->changed.writes, - eina_list_count(kd->changed.writes), - _e_kbd_dict_writes_cb_sort); + eina_list_count(kd->changed.writes), + _e_kbd_dict_writes_cb_sort); if (f) { - const char *p, *pn; + const char *p, *pn; - p = kd->file.dict; - while (p) - { - char *wd; - int usage = 0; + p = kd->file.dict; + while (p) + { + char *wd; + int usage = 0; - pn = _e_kbd_dict_line_next(kd, p); - if (!pn) + pn = _e_kbd_dict_line_next(kd, p); + if (!pn) { fclose(f); return; } - wd = _e_kbd_dict_line_parse(kd, p, &usage); - if ((wd) && (strlen(wd) > 0)) - { - if (kd->changed.writes) - { - int writeline = 0; + wd = _e_kbd_dict_line_parse(kd, p, &usage); + if ((wd) && (strlen(wd) > 0)) + { + if (kd->changed.writes) + { + int writeline = 0; - while (kd->changed.writes) - { - E_Kbd_Dict_Word *kw; - int cmp; + while (kd->changed.writes) + { + E_Kbd_Dict_Word *kw; + int cmp; - kw = kd->changed.writes->data; - cmp = _e_kbd_dict_normalized_strcmp(kw->word, wd); - if (cmp < 0) - { - fprintf(f, "%s %i\n", kw->word, kw->usage); - writeline = 1; - eina_stringshare_del(kw->word); - free(kw); - kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); - } - else if (cmp == 0) - { - fprintf(f, "%s %i\n", wd, kw->usage); - if (!strcmp(kw->word, wd)) - writeline = 0; - else - writeline = 1; - eina_stringshare_del(kw->word); - free(kw); - kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); - break; - } - else if (cmp > 0) - { - writeline = 1; - break; - } - } - if (writeline) - fprintf(f, "%s %i\n", wd, usage); - } - else - fprintf(f, "%s %i\n", wd, usage); - } - if (wd) free(wd); - p = pn; - if (p >= (kd->file.dict + kd->file.size)) break; - } - while (kd->changed.writes) - { - E_Kbd_Dict_Word *kw; + kw = kd->changed.writes->data; + cmp = _e_kbd_dict_normalized_strcmp(kw->word, wd); + if (cmp < 0) + { + fprintf(f, "%s %i\n", kw->word, kw->usage); + writeline = 1; + eina_stringshare_del(kw->word); + free(kw); + kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); + } + else if (cmp == 0) + { + fprintf(f, "%s %i\n", wd, kw->usage); + if (!strcmp(kw->word, wd)) + writeline = 0; + else + writeline = 1; + eina_stringshare_del(kw->word); + free(kw); + kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); + break; + } + else if (cmp > 0) + { + writeline = 1; + break; + } + } + if (writeline) + fprintf(f, "%s %i\n", wd, usage); + } + else + fprintf(f, "%s %i\n", wd, usage); + } + if (wd) free(wd); + p = pn; + if (p >= (kd->file.dict + kd->file.size)) break; + } + while (kd->changed.writes) + { + E_Kbd_Dict_Word *kw; - kw = kd->changed.writes->data; - fprintf(f, "%s %i\n", kw->word, kw->usage); - eina_stringshare_del(kw->word); - free(kw); - kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); - } - fclose(f); + kw = kd->changed.writes->data; + fprintf(f, "%s %i\n", kw->word, kw->usage); + eina_stringshare_del(kw->word); + free(kw); + kd->changed.writes = eina_list_remove_list(kd->changed.writes, kd->changed.writes); + } + fclose(f); } _e_kbd_dict_close(kd); if (_e_kbd_dict_open(kd)) _e_kbd_dict_lookup_build(kd); @@ -463,9 +463,9 @@ e_kbd_dict_save(kd); else { - if (kd->changed.flush_timer) - ecore_timer_del(kd->changed.flush_timer); - kd->changed.flush_timer = + if (kd->changed.flush_timer) + ecore_timer_del(kd->changed.flush_timer); + kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd); } } @@ -480,17 +480,17 @@ len = strlen(word); while (p) { - pn = _e_kbd_dict_line_next(kd, p); - if (!pn) return NULL; - if ((pn - p) > len) - { - if (!_e_kbd_dict_normalized_strncmp(p, word, len)) - return p; - } - if (_e_kbd_dict_normalized_strncmp(p, word, baselen)) - return NULL; - p = pn; - if (p >= (kd->file.dict + kd->file.size)) break; + pn = _e_kbd_dict_line_next(kd, p); + if (!pn) return NULL; + if ((pn - p) > len) + { + if (!_e_kbd_dict_normalized_strncmp(p, word, len)) + return p; + } + if (_e_kbd_dict_normalized_strncmp(p, word, baselen)) + return NULL; + p = pn; + if (p >= (kd->file.dict + kd->file.size)) break; } return NULL; } @@ -516,12 +516,12 @@ p2 = strlen(tword); while (tword[0]) { - p2 = evas_string_char_prev_get(tword, p2, &i); - if (p2 < 0) break; - tword[p2] = 0; - p = eina_hash_find(kd->matches.leads, tword); - if (p) - return _e_kbd_dict_find_pointer(kd, p, p2, word); + p2 = evas_string_char_prev_get(tword, p2, &i); + if (p2 < 0) break; + tword[p2] = 0; + p = eina_hash_find(kd->matches.leads, tword); + if (p) + return _e_kbd_dict_find_pointer(kd, p, p2, word); } /* looking at leads going back letters didn't work */ p = kd->file.dict; @@ -533,16 +533,16 @@ v1 = _e_kbd_dict_letter_normalise(glyphs[0]); if (glyphs[1] != 0) { - v2 = _e_kbd_dict_letter_normalise(glyphs[1]); - p = kd->lookup.tuples[v1][v2]; + v2 = _e_kbd_dict_letter_normalise(glyphs[1]); + p = kd->lookup.tuples[v1][v2]; } else { - for (i = 0; i < 128; i++) - { - p = kd->lookup.tuples[v1][i]; - if (p) break; - } + for (i = 0; i < 128; i++) + { + p = kd->lookup.tuples[v1][i]; + if (p) break; + } } return _e_kbd_dict_find_pointer(kd, p, p2, word); } @@ -569,27 +569,27 @@ kw = _e_kbd_dict_changed_write_find(kd, word); if (kw) { - kw->usage += adjust; - if (kd->changed.flush_timer) - ecore_timer_del(kd->changed.flush_timer); - kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd); + kw->usage += adjust; + if (kd->changed.flush_timer) + ecore_timer_del(kd->changed.flush_timer); + kd->changed.flush_timer = ecore_timer_add(5.0, _e_kbd_dict_cb_save_flush, kd); } else { - const char *line; - int usage = 0; + const char *line; + int usage = 0; - line = _e_kbd_dict_find_full(kd, word); - if (line) - { - char *wd; + line = _e_kbd_dict_find_full(kd, word); + if (line) + { + char *wd; - // FIXME: we need to find an EXACT line match - case and all - wd = _e_kbd_dict_line_parse(kd, line, &usage); - if (wd) free(wd); - } - usage += adjust; - _e_kbd_dict_changed_write_add(kd, word, usage); + // FIXME: we need to find an EXACT line match - case and all + wd = _e_kbd_dict_line_parse(kd, line, &usage); + if (wd) free(wd); + } + usage += adjust; + _e_kbd_dict_changed_write_add(kd, word, usage); } } @@ -604,8 +604,8 @@ kw->usage = -1; else { - if (_e_kbd_dict_find_full(kd, word)) - _e_kbd_dict_changed_write_add(kd, word, -1); + if (_e_kbd_dict_find_full(kd, word)) + _e_kbd_dict_changed_write_add(kd, word, -1); } } @@ -617,22 +617,22 @@ e_kbd_dict_word_letter_delete(kd); if (kd->matches.deadends) { - eina_hash_free(kd->matches.deadends); - kd->matches.deadends = NULL; + eina_hash_free(kd->matches.deadends); + kd->matches.deadends = NULL; } if (kd->matches.leads) { - eina_hash_free(kd->matches.leads); - kd->matches.leads = NULL; + eina_hash_free(kd->matches.leads); + kd->matches.leads = NULL; } while (kd->matches.list) { - E_Kbd_Dict_Word *kw; + E_Kbd_Dict_Word *kw; - kw = kd->matches.list->data; - eina_stringshare_del(kw->word); - free(kw); - kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list); + kw = kd->matches.list->data; + eina_stringshare_del(kw->word); + free(kw); + kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list); } } @@ -673,19 +673,19 @@ list = l->data; while (list) { - E_Kbd_Dict_Letter *kl; + E_Kbd_Dict_Letter *kl; - kl = list->data; - eina_stringshare_del(kl->letter); - free(kl); - list = eina_list_remove_list(list, list); + kl = list->data; + eina_stringshare_del(kl->letter); + free(kl); + list = eina_list_remove_list(list, list); } kd->word.letters = eina_list_remove_list(kd->word.letters, l); } static void _e_kbd_dict_matches_lookup_iter(E_Kbd_Dict *kd, Eina_List *word, - Eina_List *more) + Eina_List *more) { Eina_List *l, *list; const char *p; @@ -697,10 +697,10 @@ level++; for (l = word; l; l = l->next) { - kl = l->data; - len += strlen(kl->letter); - dist += kl->dist; - if (kl->dist > maxdist) maxdist = kl->dist; + kl = l->data; + len += strlen(kl->letter); + dist += kl->dist; + if (kl->dist > maxdist) maxdist = kl->dist; } if (maxdist < 1) maxdist = 1; buf = alloca(len + 20); // 20 - just padding enough for 1 more utf8 char @@ -708,8 +708,8 @@ base[0] = 0; for (l = word; l; l = l->next) { - kl = l->data; - strcat(base, kl->letter); + kl = l->data; + strcat(base, kl->letter); } baselen = strlen(base); strcpy(buf, base); @@ -717,97 +717,97 @@ list = more->data; for (l = list; l; l = l->next) { - kl = l->data; - if (kl->dist > maxdist) maxdist = kl->dist; + kl = l->data; + if (kl->dist > maxdist) maxdist = kl->dist; } for (l = list; l; l = l->next) { - kl = l->data; - strcpy(bufapp, kl->letter); - if ((kd->matches.deadends) && eina_hash_find(kd->matches.deadends, buf)) - continue; - p = eina_hash_find(kd->matches.leads, buf); - if (p) p = _e_kbd_dict_find_pointer(kd, p, baselen, buf); - else p = _e_kbd_dict_find(kd, buf); - if (!p) - { - if (!kd->matches.deadends) - kd->matches.deadends = eina_hash_string_superfast_new(NULL); - eina_hash_add(kd->matches.deadends, buf, kd); - continue; - } - else - { - if (!kd->matches.leads) - kd->matches.leads = eina_hash_string_superfast_new(NULL); - eina_hash_add(kd->matches.leads, buf, p); - } - if ((!more->next) || (!more->next->data)) - { - d = dist + kl->dist; - md = maxdist; - for (;;) - { - E_Kbd_Dict_Word *kw; - int usage = 0; + kl = l->data; + strcpy(bufapp, kl->letter); + if ((kd->matches.deadends) && eina_hash_find(kd->matches.deadends, buf)) + continue; + p = eina_hash_find(kd->matches.leads, buf); + if (p) p = _e_kbd_dict_find_pointer(kd, p, baselen, buf); + else p = _e_kbd_dict_find(kd, buf); + if (!p) + { + if (!kd->matches.deadends) + kd->matches.deadends = eina_hash_string_superfast_new(NULL); + eina_hash_add(kd->matches.deadends, buf, kd); + continue; + } + else + { + if (!kd->matches.leads) + kd->matches.leads = eina_hash_string_superfast_new(NULL); + eina_hash_add(kd->matches.leads, buf, p); + } + if ((!more->next) || (!more->next->data)) + { + d = dist + kl->dist; + md = maxdist; + for (;;) + { + E_Kbd_Dict_Word *kw; + int usage = 0; - wd = _e_kbd_dict_line_parse(kd, p, &usage); - if (!wd) break; - if (_e_kbd_dict_normalized_strcmp(wd, buf)) - { - free(wd); - break; - } - kw = E_NEW(E_Kbd_Dict_Word, 1); - if (kw) - { - int accuracy; - int w, b, w2, b2, wc, bc; + wd = _e_kbd_dict_line_parse(kd, p, &usage); + if (!wd) break; + if (_e_kbd_dict_normalized_strcmp(wd, buf)) + { + free(wd); + break; + } + kw = E_NEW(E_Kbd_Dict_Word, 1); + if (kw) + { + int accuracy; + int w, b, w2, b2, wc, bc; - // match any capitalisation - for (w = 0, b = 0; wd[w] && buf[b];) - { - b2 = evas_string_char_next_get(buf, b, &bc); - w2 = evas_string_char_next_get(wd, w, &wc); - if (isupper(bc)) wd[w] = toupper(wc); - w = w2; - b = b2; - } - kw->word = eina_stringshare_add(wd); - // FIXME: magic combination of distance metric and - // frequency of usage. this is simple now, but could - // be tweaked - wc = eina_list_count(word); - if (md < 1) md = 1; + // match any capitalisation + for (w = 0, b = 0; wd[w] && buf[b];) + { + b2 = evas_string_char_next_get(buf, b, &bc); + w2 = evas_string_char_next_get(wd, w, &wc); + if (isupper(bc)) wd[w] = toupper(wc); + w = w2; + b = b2; + } + kw->word = eina_stringshare_add(wd); + // FIXME: magic combination of distance metric and + // frequency of usage. this is simple now, but could + // be tweaked + wc = eina_list_count(word); + if (md < 1) md = 1; - // basically a metric to see how far away the keys that - // were actually pressed are away from the letters of - // this word in a physical on-screen sense - accuracy = md - (d / (wc + 1)); - // usage is the frequency of usage in the dictionary. - // it its < 1 time, it's assumed to be 1. - if (usage < 1) usage = 1; - // multiply usage by a factor of 100 for better detailed - // sorting. 10 == 1/10th factor - usage = 100 + ((usage - 1) * 10); - // and well just multiply and lets see. maybe this can - // do with multiplication factors etc. but simple for - // now. - kw->usage = (usage * accuracy) / md; - kd->matches.list = eina_list_append(kd->matches.list, kw); - } - free(wd); - p = _e_kbd_dict_line_next(kd, p); - if (p >= (kd->file.dict + kd->file.size)) break; - if (!p) break; - } - } - else - { - word = eina_list_append(word, kl); - _e_kbd_dict_matches_lookup_iter(kd, word, more->next); - word = eina_list_remove_list(word, eina_list_last(word)); - } + // basically a metric to see how far away the keys that + // were actually pressed are away from the letters of + // this word in a physical on-screen sense + accuracy = md - (d / (wc + 1)); + // usage is the frequency of usage in the dictionary. + // it its < 1 time, it's assumed to be 1. + if (usage < 1) usage = 1; + // multiply usage by a factor of 100 for better detailed + // sorting. 10 == 1/10th factor + usage = 100 + ((usage - 1) * 10); + // and well just multiply and lets see. maybe this can + // do with multiplication factors etc. but simple for + // now. + kw->usage = (usage * accuracy) / md; + kd->matches.list = eina_list_append(kd->matches.list, kw); + } + free(wd); + p = _e_kbd_dict_line_next(kd, p); + if (p >= (kd->file.dict + kd->file.size)) break; + if (!p) break; + } + } + else + { + word = eina_list_append(word, kl); + _e_kbd_dict_matches_lookup_iter(kd, word, more->next); + word = eina_list_remove_list(word, eina_list_last(word)); + } } level--; } @@ -818,18 +818,18 @@ // find all matches and sort them while (kd->matches.list) { - E_Kbd_Dict_Word *kw; + E_Kbd_Dict_Word *kw; - kw = kd->matches.list->data; - eina_stringshare_del(kw->word); - free(kw); - kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list); + kw = kd->matches.list->data; + eina_stringshare_del(kw->word); + free(kw); + kd->matches.list = eina_list_remove_list(kd->matches.list, kd->matches.list); } if (kd->word.letters) _e_kbd_dict_matches_lookup_iter(kd, NULL, kd->word.letters); kd->matches.list = eina_list_sort(kd->matches.list, - eina_list_count(kd->matches.list), - _e_kbd_dict_matches_lookup_cb_sort); + eina_list_count(kd->matches.list), + _e_kbd_dict_matches_lookup_cb_sort); } EAPI void @@ -852,14 +852,14 @@ // return the word (string utf-8) for the current match if (kd->matches.list_ptr) { - E_Kbd_Dict_Word *kw; + E_Kbd_Dict_Word *kw; - kw = kd->matches.list_ptr->data; - if (kw) - { - *pri_ret = kw->usage; - return kw->word; - } + kw = kd->matches.list_ptr->data; + if (kw) + { + *pri_ret = kw->usage; + return kw->word; + } } return NULL; } Modified: trunk/e/src/modules/illume-keyboard/e_kbd_int.c =================================================================== --- trunk/e/src/modules/illume-keyboard/e_kbd_int.c 2011-11-07 23:29:44 UTC (rev 64905) +++ trunk/e/src/modules/illume-keyboard/e_kbd_int.c 2011-11-07 23:30:27 UTC (rev 64906) @@ -51,16 +51,16 @@ dist = 0x7fffffff; EINA_LIST_FOREACH(ki->layout.keys, l, ky) { - Evas_Coord dx, dy; + Evas_Coord dx, dy; - dx = x - (ky->x + (ky->w / 2)); - dy = y - (ky->y + (ky->h / 2)); - dx = (dx * dx) + (dy * dy); - if (dx < dist) - { - dist = dx; - closest_ky = ky; - } + dx = x - (ky->x + (ky->w / 2)); + dy = y - (ky->y + (ky->h / 2)); + dx = (dx * dx) + (dy * dy); + if (dx < dist) + { + dist = dx; + closest_ky = ky; + } } return closest_ky; } @@ -74,8 +74,8 @@ EINA_LIST_FOREACH(ky->states, l, st) { - if (st->state & ki->layout.state) return st; - if (!found && st->state == NORMAL) found = st; + if (st->state & ki->layout.state) return st; + if (!found && st->state == NORMAL) found = st; } return found; } @@ -91,43 +91,43 @@ e_kbd_buf_layout_fuzz_set(ki->kbuf, ki->layout.fuzz); EINA_LIST_FOREACH(ki->layout.keys, l, ky) { - E_Kbd_Int_Key_State *st; - const char *out, *out_shift, *out_capslock, *out_altgr; + E_Kbd_Int_Key_State *st; + const char *out, *out_shift, *out_capslock, *out_altgr; - out = NULL; - out_shift = NULL; - out_capslock = NULL; - out_altgr = NULL; + out = NULL; + out_shift = NULL; + out_capslock = NULL; + out_altgr = NULL; - EINA_LIST_FOREACH(ky->states, l2, st) - { - if (st->state == NORMAL) - out = st->out; - else if (st->state == SHIFT) - out_shift = st->out; - else if (st->state == CAPSLOCK) - out_capslock = st->out; - else if (st->state == ALTGR) - out_altgr = st->out; - } - if (out) - { - char *s1 = NULL, *s2 = NULL, *s3 = NULL; + EINA_LIST_FOREACH(ky->states, l2, st) + { + if (st->state == NORMAL) + out = st->out; + else if (st->state == SHIFT) + out_shift = st->out; + else if (st->state == CAPSLOCK) + out_capslock = st->out; + else if (st->state == ALTGR) + out_altgr = st->out; + } + if (out) + { + char *s1 = NULL, *s2 = NULL, *s3 = NULL; - if ((out) && (out[0] == '"')) - s1 = strdup(_e_kbd_int_str_unquote(out)); - if ((out_shift) && (out_shift[0] == '"')) - s2 = strdup(_e_kbd_int_str_unquote(out_shift)); - if ((out_altgr) && (out_altgr[0] == '"')) - s2 = strdup(_e_kbd_int_str_unquote(out_altgr)); - if ((out_capslock) && (out_capslock[0] == '"')) - s3 = strdup(_e_kbd_int_str_unquote(out_capslock)); - e_kbd_buf_layout_key_add(ki->kbuf, s1, s2, s3, - ky->x, ky->y, ky->w, ky->h); - if (s1) free(s1); - if (s2) free(s2); - if (s3) free(s3); - } + if ((out) && (out[0] == '"')) + s1 = strdup(_e_kbd_int_str_unquote(out)); + if ((out_shift) && (out_shift[0] == '"')) + s2 = strdup(_e_kbd_int_str_unquote(out_shift)); + if ((out_altgr) && (out_altgr[0] == '"')) + s2 = strdup(_e_kbd_int_str_unquote(out_altgr)); + if ((out_capslock) && (out_capslock[0] == '"')) + s3 = strdup(_e_kbd_int_str_unquote(out_capslock)); + e_kbd_buf_layout_key_add(ki->kbuf, s1, s2, s3, + ky->x, ky->y, ky->w, ky->h); + if (s1) free(s1); + if (s2) free(s2); + if (s3) free(s3); + } } } @@ -139,55 +139,55 @@ EINA_LIST_FOREACH(ki->layout.keys, l, ky) { - E_Kbd_Int_Key_State *st; - int selected; + E_Kbd_Int_Key_State *st; + int selected; - st = _e_kbd_int_key_state_get(ki, ky); - if (st) - { - if (st->label) - edje_object_part_text_set(ky->obj, "e.text.label", st->label); - else - edje_object_part_text_set(ky->obj, "e.text.label", ""); - if (st->icon) - { - char buf[PATH_MAX]; - char *p; + st = _e_kbd_int_key_state_get(ki, ky); + if (st) + { + if (st->label) + edje_object_part_text_set(ky->obj, "e.text.label", st->label); + else + edje_object_part_text_set(ky->obj, "e.text.label", ""); + if (st->icon) + { + char buf[PATH_MAX]; + char *p; - snprintf(buf, sizeof(buf), "%s/%s", ki->layout.directory, st->icon); - p = strrchr(st->icon, '.'); - if (!strcmp(p, ".edj")) - e_icon_file_edje_set(ky->icon_obj, buf, "icon"); - else - e_icon_file_set(ky->icon_obj, buf); - } - else - e_icon_file_set(ky->icon_obj, NULL); - } - selected = 0; - if ((ki->layout.state & SHIFT) && (ky->is_shift)) selected = 1; - if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1; - if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1; - if ((ki->layout.state & ALTGR) && (ky->is_altgr)) selected = 1; - if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1; - if ((ki->layout.state & (SHIFT | CAPSLOCK)) && (ky->is_multi_shift)) + snprintf(buf, sizeof(buf), "%s/%s", ki->layout.directory, st->icon); + p = strrchr(st->icon, '.'); + if (!strcmp(p, ".edj")) + e_icon_file_edje_set(ky->icon_obj, buf, "icon"); + else + e_icon_file_set(ky->icon_obj, buf); + } + else + e_icon_file_set(ky->icon_obj, NULL); + } + selected = 0; + if ((ki->layout.state & SHIFT) && (ky->is_shift)) selected = 1; + if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1; + if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1; + if ((ki->layout.state & ALTGR) && (ky->is_altgr)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1; + if ((ki->layout.state & (SHIFT | CAPSLOCK)) && (ky->is_multi_shift)) selected = 1; - if (selected) - { - if (!ky->selected) - { - edje_object_signal_emit(ky->obj, "e,state,selected", "e"); - ky->selected = 1; - } - } - if (!selected) - { - if (ky->selected) - { - edje_object_signal_emit(ky->obj, "e,state,unselected", "e"); - ky->selected = 0; - } - } + if (selected) + { + if (!ky->selected) + { + edje_object_signal_emit(ky->obj, "e,state,selected", "e"); + ky->selected = 1; + } + } + if (!selected) + { + if (ky->selected) + { + edje_object_signal_emit(ky->obj, "e,state,unselected", "e"); + ky->selected = 0; + } + } } } @@ -200,14 +200,14 @@ e_kbd_buf_word_use(ki->kbuf, str); for (;;) { - char buf[16]; + char buf[16]; - newpos = evas_string_char_next_get(str, pos, &glyph); - if (glyph <= 0) return; - strncpy(buf, str + pos, newpos - pos); - buf[newpos - pos] = 0; - e_kbd_send_string_press(buf, 0); - pos = newpos; + newpos = evas_string_char_next_get(str, pos, &glyph); + if (glyph <= 0) return; + strncpy(buf, str + pos, newpos - pos); + buf[newpos - pos] = 0; + e_kbd_send_string_press(buf, 0); + pos = newpos; } } @@ -234,8 +234,8 @@ e_kbd_send_keysym_press("space", 0); if (km->ki->layout.state & (SHIFT | CTRL | ALT | ALTGR)) { - km->ki->layout.state &= (~(SHIFT | CTRL | ALT | ALTGR)); - _e_kbd_int_layout_state_update(km->ki); + km->ki->layout.state &= (~(SHIFT | CTRL | ALT | ALTGR)); + _e_kbd_int_layout_state_update(km->ki); } _e_kbd_int_matches_update(km->ki); } @@ -250,7 +250,7 @@ km = E_NEW(E_Kbd_Int_Match, 1); if (!km) return; o = _theme_obj_new(ki->win->evas, ki->themedir, - "e/modules/kbd/match/word"); + "e/modules/kbd/match/word"); km->ki = ki; km->str = eina_stringshare_add(str); km->obj = o; @@ -264,7 +264,7 @@ if (num == 0) edje_object_signal_emit(o, "e,state,selected", "e"); edje_object_signal_callback_add(o, "e,action,do,select", "", - _e_kbd_int_cb_match_select, km); + _e_kbd_int_cb_match_select, km); evas_object_show(o); } @@ -275,9 +275,9 @@ EINA_LIST_FREE(ki->matches, km) { - if (km->str) eina_stringshare_del(km->str); - evas_object_del(km->obj); - free(km); + if (km->str) eina_stringshare_del(km->str); + evas_object_del(km->obj); + free(km); } } @@ -296,34 +296,34 @@ matches = e_kbd_buf_string_matches_get(ki->kbuf); if (!matches) { - actual = e_kbd_buf_actual_string_get(ki->kbuf); - if (actual) _e_kbd_int_matches_add(ki, actual, 0); + actual = e_kbd_buf_actual_string_get(ki->kbuf); + if (actual) _e_kbd_int_matches_add(ki, actual, 0); } else { - int i = 0; + int i = 0; - for (i = 0, l = matches; l; l = l->next, i++) - { - _e_kbd_int_matches_add(ki, l->data, i); - e_box_size_min_get(ki->box_obj, &mw, &mh); - edje_object_part_geometry_get(ki->base_obj, "e.swallow.label", - NULL, NULL, &vw, &vh); - if (mw > vw) break; - } + for (i = 0, l = matches; l; l = l->next, i++) + { + _e_kbd_int_matches_add(ki, l->data, i); + e_box_size_min_get(ki->box_obj, &mw, &mh); + edje_object_part_geometry_get(ki->base_obj, "e.swallow.label", + NULL, NULL, &vw, &vh); + if (mw > vw) break; + } - if (!l) - { - actual = e_kbd_buf_actual_string_get(ki->kbuf); - if (actual) - { - const char *str; + if (!l) + { + actual = e_kbd_buf_actual_string_get(ki->kbuf); + if (actual) + { + const char *str; - EINA_LIST_FOREACH(matches, l, str) - if (!strcmp(str, actual)) break; - if (!l) _e_kbd_int_matches_add(ki, actual, i); - } - } + EINA_LIST_FOREACH(matches, l, str) + if (!strcmp(str, actual)) break; + if (!l) _e_kbd_int_matches_add(ki, actual, i); + } + } } e_box_thaw(ki->box_obj); e_box_size_min_get(ki->box_obj, &mw, &mh); @@ -344,111 +344,111 @@ if (ky->is_shift) { - if (ki->layout.state & SHIFT) ki->layout.state &= (~(SHIFT)); - else ki->layout.state |= SHIFT; - _e_kbd_int_layout_state_update(ki); - return; + if (ki->layout.state & SHIFT) ki->layout.state &= (~(SHIFT)); + else ki->layout.state |= SHIFT; + _e_kbd_int_layout_state_update(ki); + return; } if (ky->is_multi_shift) { - if (ki->layout.state & SHIFT) + if (ki->layout.state & SHIFT) { ki->layout.state &= (~(SHIFT)); ki->layout.state |= CAPSLOCK; } - else if (ki->layout.state & CAPSLOCK) + else if (ki->layout.state & CAPSLOCK) ki->layout.state &= (~(CAPSLOCK)); else ki->layout.state |= SHIFT; - _e_kbd_int_layout_state_update(ki); - return; + _e_kbd_int_layout_state_update(ki); + return; } if (ky->is_ctrl) { - if (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); - else ki->layout.state |= CTRL; - if (e_kbd_buf_actual_string_get(ki->kbuf)) _e_kbd_int_buf_send(ki); - e_kbd_buf_clear(ki->kbuf); - _e_kbd_int_layout_state_update(ki); - _e_kbd_int_matches_update(ki); - return; + if (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); + else ki->layout.state |= CTRL; + if (e_kbd_buf_actual_string_get(ki->kbuf)) _e_kbd_int_buf_send(ki); + e_kbd_buf_clear(ki->kbuf); + _e_kbd_int_layout_state_update(ki); + _e_kbd_int_matches_update(ki); + return; } if (ky->is_alt) { - if (ki->layout.state & ALT) ki->layout.state &= (~(ALT)); - else ki->layout.state |= ALT; - if (e_kbd_buf_actual_string_get(ki->kbuf)) _e_kbd_int_buf_send(ki); - e_kbd_buf_clear(ki->kbuf); - _e_kbd_int_layout_state_update(ki); - _e_kbd_int_matches_update(ki); - return; + if (ki->layout.state & ALT) ki->layout.state &= (~(ALT)); + else ki->layout.state |= ALT; + if (e_kbd_buf_actual_string_get(ki->kbuf)) _e_kbd_int_buf_send(ki); + e_kbd_buf_clear(ki->kbuf); + _e_kbd_int_layout_state_update(ki); + _e_kbd_int_matches_update(ki); + return; } if (ky->is_altgr) { - if (ki->layout.state & ALTGR) ki->layout.state &= (~(ALTGR)); - else ki->layout.state |= ALTGR; - _e_kbd_int_layout_state_update(ki); - return; + if (ki->layout.state & ALTGR) ki->layout.state &= (~(ALTGR)); + else ki->layout.state |= ALTGR; + _e_kbd_int_layout_state_update(ki); + return; } if (ky->is_capslock) { - if (ki->layout.state & CAPSLOCK) ki->layout.state &= (~CAPSLOCK); - else ki->layout.state |= CAPSLOCK; - _e_kbd_int_layout_state_update(ki); - return; + if (ki->layout.state & CAPSLOCK) ki->layout.state &= (~CAPSLOCK); + else ki->layout.state |= CAPSLOCK; + _e_kbd_int_layout_state_update(ki); + return; } st = _e_kbd_int_key_state_get(ki, ky); if (st) out = st->out; if (ki->layout.state & (CTRL | ALT)) { - if (out) - { - Kbd_Mod mods = 0; + if (out) + { + Kbd_Mod mods = 0; - if (ki->layout.state & CTRL) mods |= KBD_MOD_CTRL; - if (ki->layout.state & ALT) mods |= KBD_MOD_ALT; - if (out[0] == '"') + if (ki->layout.state & CTRL) mods |= KBD_MOD_CTRL; + if (ki->layout.state & ALT) mods |= KBD_MOD_ALT; + if (out[0] == '"') e_kbd_send_string_press(_e_kbd_int_str_unquote(out), mods); - else - e_kbd_send_keysym_press(out, mods); - } - ki->layout.state &= (~(SHIFT | CTRL | ALT | ALTGR)); - _e_kbd_int_layout_state_update(ki); - e_kbd_buf_lookup(ki->kbuf, _e_kbd_int_matches_update, ki); - return; + else + e_kbd_send_keysym_press(out, mods); + } + ki->layout.state &= (~(SHIFT | CTRL | ALT | ALTGR)); + _e_kbd_int_layout_state_update(ki); + e_kbd_buf_lookup(ki->kbuf, _e_kbd_int_matches_update, ki); + return; } if (out) { - if (out[0] == '"')... [truncated message content] |