summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2014-08-22 21:54:04 +0200
committerBoris Faure <billiob@gmail.com>2014-08-22 21:54:04 +0200
commit1ef2fbb8a309611873118488d997b9deeb3f2f0a (patch)
treea7f2162eb510829aa9ce9076d6b5e0374ab927bc /src
parent117d9e784081f15f46797a1206ac48157e523e04 (diff)
refactor keys handling in termio: move to keyin, 2nd round!
Diffstat (limited to 'src')
-rw-r--r--src/bin/controls.c4
-rw-r--r--src/bin/keyin.c366
-rw-r--r--src/bin/keyin.h19
-rw-r--r--src/bin/termio.c453
-rw-r--r--src/bin/termio.h5
5 files changed, 457 insertions, 390 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
index be279e8..d18320e 100644
--- a/src/bin/controls.c
+++ b/src/bin/controls.c
@@ -54,7 +54,7 @@ _cb_ct_copy(void *data EINA_UNUSED,
54 Evas_Object *obj EINA_UNUSED, 54 Evas_Object *obj EINA_UNUSED,
55 void *event EINA_UNUSED) 55 void *event EINA_UNUSED)
56{ 56{
57 termio_copy_clipboard(ct_term); 57 termio_take_selection(ct_term, ELM_SEL_TYPE_CLIPBOARD);
58 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata); 58 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
59} 59}
60 60
@@ -63,7 +63,7 @@ _cb_ct_paste(void *data EINA_UNUSED,
63 Evas_Object *obj EINA_UNUSED, 63 Evas_Object *obj EINA_UNUSED,
64 void *event EINA_UNUSED) 64 void *event EINA_UNUSED)
65{ 65{
66 termio_paste_clipboard(ct_term); 66 termio_paste_selection(ct_term, ELM_SEL_TYPE_CLIPBOARD);
67 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata); 67 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
68} 68}
69 69
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index 9a0c44a..f2d02e6 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -1,5 +1,11 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#include <Ecore_Input.h>
3#include <Ecore_IMF.h>
4#include <Ecore_IMF_Evas.h>
5#include "private.h"
2#include "termpty.h" 6#include "termpty.h"
7#include "termio.h"
8#include "termcmd.h"
3#include "keyin.h" 9#include "keyin.h"
4 10
5typedef struct _Keyout Keyout; 11typedef struct _Keyout Keyout;
@@ -12,6 +18,8 @@ struct _Keyout
12 int outlen; 18 int outlen;
13}; 19};
14 20
21
22
15#define KEY(in, out) {in, out, sizeof(in) - 1, sizeof(out) - 1} 23#define KEY(in, out) {in, out, sizeof(in) - 1, sizeof(out) - 1}
16 24
17static const Keyout crlf_keyout[] = 25static const Keyout crlf_keyout[] =
@@ -399,7 +407,107 @@ _key_try(Termpty *ty, const Keyout *map, const Evas_Event_Key_Down *ev)
399} 407}
400 408
401void 409void
402keyin_handle(Termpty *ty, const Evas_Event_Key_Down *ev, 410keyin_compose_seq_reset(Keys_Handler *khdl)
411{
412 char *str;
413
414 EINA_LIST_FREE(khdl->seq, str) eina_stringshare_del(str);
415 khdl->composing = EINA_FALSE;
416}
417
418static Eina_Bool
419_handle_alt_ctrl(const char *keyname, Evas_Object *term)
420{
421 if (!strcmp(keyname, "equal"))
422 termcmd_do(term, NULL, NULL, "f+");
423 else if (!strcmp(keyname, "minus"))
424 termcmd_do(term, NULL, NULL, "f-");
425 else if (!strcmp(keyname, "0"))
426 termcmd_do(term, NULL, NULL, "f");
427 else if (!strcmp(keyname, "9"))
428 termcmd_do(term, NULL, NULL, "fb");
429 else
430 return EINA_FALSE;
431
432 return EINA_TRUE;
433}
434
435static Eina_Bool
436_handle_shift(const Evas_Event_Key_Down *ev, Termpty *ty)
437{
438 if (!strcmp(ev->key, "Prior"))
439 {
440 if (!ty->altbuf)
441 {
442 termio_scroll_delta(ty->obj, 1, 1);
443 return EINA_TRUE;
444 }
445 return EINA_FALSE;
446 }
447 else if (!strcmp(ev->key, "Next"))
448 {
449 if (!ty->altbuf)
450 {
451 termio_scroll_delta(ty->obj, -1, 1);
452 return EINA_TRUE;
453 }
454 return EINA_FALSE;
455 }
456 else if (!strcmp(ev->key, "Up"))
457 {
458 if (!ty->altbuf)
459 {
460 termio_scroll_delta(ty->obj, 1, 0);
461 return EINA_TRUE;
462 }
463 return EINA_FALSE;
464 }
465 else if (!strcmp(ev->key, "Down"))
466 {
467 if (!ty->altbuf)
468 {
469 termio_scroll_delta(ty->obj, -1, 0);
470 return EINA_TRUE;
471 }
472 return EINA_FALSE;
473 }
474 else if (!strcmp(ev->key, "Insert"))
475 {
476 /*XXX CTRL*/
477 if (evas_key_modifier_is_set(ev->modifiers, "Control"))
478 termio_paste_selection(ty->obj, ELM_SEL_TYPE_CLIPBOARD);
479 else
480 termio_paste_selection(ty->obj, ELM_SEL_TYPE_PRIMARY);
481 }
482 else if (!strcmp(ev->key, "KP_Add"))
483 {
484 Config *config = termpty_config_get(ty);
485
486 if (config) termio_font_size_set(ty->obj, config->font.size + 1);
487 }
488 else if (!strcmp(ev->key, "KP_Subtract"))
489 {
490 Config *config = termpty_config_get(ty);
491
492 if (config) termio_font_size_set(ty->obj, config->font.size - 1);
493 }
494 else if (!strcmp(ev->key, "KP_Multiply"))
495 {
496 Config *config = termpty_config_get(ty);
497
498 if (config) termio_font_size_set(ty->obj, 10);
499 }
500 else if (!strcmp(ev->key, "KP_Divide"))
501 termio_take_selection(ty->obj, ELM_SEL_TYPE_CLIPBOARD);
502 else
503 return EINA_FALSE;
504
505 return EINA_TRUE;
506}
507
508
509static void
510_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
403 int alt, int shift, int ctrl) 511 int alt, int shift, int ctrl)
404{ 512{
405 if (!alt) 513 if (!alt)
@@ -513,3 +621,259 @@ keyin_handle(Termpty *ty, const Evas_Event_Key_Down *ev,
513 termpty_write(ty, ev->string, strlen(ev->string)); 621 termpty_write(ty, ev->string, strlen(ev->string));
514 } 622 }
515} 623}
624
625Eina_Bool
626keyin_handle(Keys_Handler *khdl, Termpty *ty, const Evas_Event_Key_Down *ev,
627 int alt, int shift, int ctrl)
628{
629 if ((!alt) && (ctrl) && (!shift))
630 {
631 if (!strcmp(ev->key, "Prior"))
632 {
633 keyin_compose_seq_reset(khdl);
634 evas_object_smart_callback_call(ty->obj, "prev", NULL);
635 return EINA_TRUE;
636 }
637 else if (!strcmp(ev->key, "Next"))
638 {
639 keyin_compose_seq_reset(khdl);
640 evas_object_smart_callback_call(ty->obj, "next", NULL);
641 return EINA_TRUE;
642 }
643 else if (!strcmp(ev->key, "1"))
644 {
645 keyin_compose_seq_reset(khdl);
646 evas_object_smart_callback_call(ty->obj, "tab,1", NULL);
647 return EINA_TRUE;
648 }
649 else if (!strcmp(ev->key, "2"))
650 {
651 keyin_compose_seq_reset(khdl);
652 evas_object_smart_callback_call(ty->obj, "tab,2", NULL);
653 return EINA_TRUE;
654 }
655 else if (!strcmp(ev->key, "3"))
656 {
657 keyin_compose_seq_reset(khdl);
658 evas_object_smart_callback_call(ty->obj, "tab,3", NULL);
659 return EINA_TRUE;
660 }
661 else if (!strcmp(ev->key, "4"))
662 {
663 keyin_compose_seq_reset(khdl);
664 evas_object_smart_callback_call(ty->obj, "tab,4", NULL);
665 return EINA_TRUE;
666 }
667 else if (!strcmp(ev->key, "5"))
668 {
669 keyin_compose_seq_reset(khdl);
670 evas_object_smart_callback_call(ty->obj, "tab,5", NULL);
671 return EINA_TRUE;
672 }
673 else if (!strcmp(ev->key, "6"))
674 {
675 keyin_compose_seq_reset(khdl);
676 evas_object_smart_callback_call(ty->obj, "tab,6", NULL);
677 return EINA_TRUE;
678 }
679 else if (!strcmp(ev->key, "7"))
680 {
681 keyin_compose_seq_reset(khdl);
682 evas_object_smart_callback_call(ty->obj, "tab,7", NULL);
683 return EINA_TRUE;
684 }
685 else if (!strcmp(ev->key, "8"))
686 {
687 keyin_compose_seq_reset(khdl);
688 evas_object_smart_callback_call(ty->obj, "tab,8", NULL);
689 return EINA_TRUE;
690 }
691 else if (!strcmp(ev->key, "9"))
692 {
693 keyin_compose_seq_reset(khdl);
694 evas_object_smart_callback_call(ty->obj, "tab,9", NULL);
695 return EINA_TRUE;
696 }
697 else if (!strcmp(ev->key, "0"))
698 {
699 keyin_compose_seq_reset(khdl);
700 evas_object_smart_callback_call(ty->obj, "tab,0", NULL);
701 return EINA_TRUE;
702 }
703 }
704 if ((!alt) && (ctrl) && (shift))
705 {
706 if (!strcmp(ev->key, "Prior"))
707 {
708 keyin_compose_seq_reset(khdl);
709 evas_object_smart_callback_call(ty->obj, "split,h", NULL);
710 return EINA_TRUE;
711 }
712 else if (!strcmp(ev->key, "Next"))
713 {
714 keyin_compose_seq_reset(khdl);
715 evas_object_smart_callback_call(ty->obj, "split,v", NULL);
716 return EINA_TRUE;
717 }
718 else if (!strcasecmp(ev->key, "t"))
719 {
720 keyin_compose_seq_reset(khdl);
721 evas_object_smart_callback_call(ty->obj, "new", NULL);
722 return EINA_TRUE;
723 }
724 else if (!strcmp(ev->key, "Home"))
725 {
726 keyin_compose_seq_reset(khdl);
727 evas_object_smart_callback_call(ty->obj, "select", NULL);
728 return EINA_TRUE;
729 }
730 else if (!strcasecmp(ev->key, "c"))
731 {
732 keyin_compose_seq_reset(khdl);
733 termio_take_selection(ty->obj, ELM_SEL_TYPE_CLIPBOARD);
734 return EINA_TRUE;
735 }
736 else if (!strcasecmp(ev->key, "v"))
737 {
738 keyin_compose_seq_reset(khdl);
739 termio_paste_selection(ty->obj, ELM_SEL_TYPE_CLIPBOARD);
740 return EINA_TRUE;
741 }
742 else if (!strcmp(ev->keyname, "h"))
743 {
744 term_miniview_toggle(termio_term_get(ty->obj));
745 return EINA_TRUE;
746 }
747 }
748 if ((alt) && (!shift) && (!ctrl))
749 {
750 if (!strcmp(ev->key, "Home"))
751 {
752 keyin_compose_seq_reset(khdl);
753 evas_object_smart_callback_call(ty->obj, "cmdbox", NULL);
754 return EINA_TRUE;
755 }
756 }
757 if ((alt) && (ctrl) && (!shift))
758 {
759 if (_handle_alt_ctrl(ev->key, ty->obj))
760 {
761 keyin_compose_seq_reset(khdl);
762 return EINA_TRUE;
763 }
764 }
765 if (shift)
766 {
767 if (_handle_shift(ev, ty))
768 {
769 keyin_compose_seq_reset(khdl);
770 return EINA_TRUE;
771 }
772 }
773
774
775 /* actions => return Eina_True */
776
777 /* composing */
778 if (khdl->imf)
779 {
780 // EXCEPTION. Don't filter modifiers alt+shift -> breaks emacs
781 // and jed (alt+shift+5 for search/replace for example)
782 // Don't filter modifiers alt, is used by shells
783 if ((!alt) && (!ctrl))
784 {
785 Ecore_IMF_Event_Key_Down imf_ev;
786
787 ecore_imf_evas_event_key_down_wrap((Evas_Event_Key_Down*)ev, &imf_ev);
788 if (!khdl->composing)
789 {
790 if (ecore_imf_context_filter_event
791 (khdl->imf, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&imf_ev))
792 goto end;
793 }
794 }
795 }
796
797 // if term app asked for kbd lock - dont handle here
798 if (ty->state.kbd_lock) return EINA_TRUE;
799 // if app asked us to not do autorepeat - ignore press if is it is the same
800 // timestamp as last one
801 if ((ty->state.no_autorepeat) &&
802 (ev->timestamp == khdl->last_keyup)) return EINA_TRUE;
803 if (!khdl->composing)
804 {
805 Ecore_Compose_State state;
806 char *compres = NULL;
807
808 keyin_compose_seq_reset(khdl);
809 khdl->seq = eina_list_append(khdl->seq, eina_stringshare_add(ev->key));
810 state = ecore_compose_get(khdl->seq, &compres);
811 if (state == ECORE_COMPOSE_MIDDLE) khdl->composing = EINA_TRUE;
812 else khdl->composing = EINA_FALSE;
813 if (!khdl->composing) keyin_compose_seq_reset(khdl);
814 else goto end;
815 }
816 else
817 {
818 Ecore_Compose_State state;
819 char *compres = NULL;
820
821 if (key_is_modifier(ev->key)) goto end;
822 khdl->seq = eina_list_append(khdl->seq, eina_stringshare_add(ev->key));
823 state = ecore_compose_get(khdl->seq, &compres);
824 if (state == ECORE_COMPOSE_NONE) keyin_compose_seq_reset(khdl);
825 else if (state == ECORE_COMPOSE_DONE)
826 {
827 keyin_compose_seq_reset(khdl);
828 if (compres)
829 {
830 termpty_write(ty, compres, strlen(compres));
831 free(compres);
832 compres = NULL;
833 }
834 goto end;
835 }
836 else goto end;
837 }
838
839
840 _handle_key_to_pty(ty, ev, alt, shift, ctrl);
841
842
843end:
844 return EINA_FALSE;
845}
846
847Eina_Bool
848key_is_modifier(const char *key)
849{
850#define STATIC_STR_EQUAL(STR) (!strncmp(key, STR, strlen(STR)))
851 if ((key != NULL) && (
852 STATIC_STR_EQUAL("Shift") ||
853 STATIC_STR_EQUAL("Control") ||
854 STATIC_STR_EQUAL("Alt") ||
855 STATIC_STR_EQUAL("Meta") ||
856 STATIC_STR_EQUAL("Super") ||
857 STATIC_STR_EQUAL("Hyper") ||
858 STATIC_STR_EQUAL("Scroll_Lock") ||
859 STATIC_STR_EQUAL("Num_Lock") ||
860 STATIC_STR_EQUAL("ISO_Level3_Shift") ||
861 STATIC_STR_EQUAL("Caps_Lock")))
862 return EINA_TRUE;
863#undef STATIC_STR_EQUAL
864 return EINA_FALSE;
865}
866
867void
868keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev)
869{
870 khdl->last_keyup = ev->timestamp;
871 if (khdl->imf)
872 {
873 Ecore_IMF_Event_Key_Up imf_ev;
874 ecore_imf_evas_event_key_up_wrap(ev, &imf_ev);
875 if (ecore_imf_context_filter_event
876 (khdl->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev))
877 return;
878 }
879}
diff --git a/src/bin/keyin.h b/src/bin/keyin.h
index c1e6294..f8d1b5c 100644
--- a/src/bin/keyin.h
+++ b/src/bin/keyin.h
@@ -1,7 +1,22 @@
1#ifndef _KEYIN_H__ 1#ifndef _KEYIN_H__
2#define _KEYIN_H__ 1 2#define _KEYIN_H__ 1
3 3
4void keyin_handle(Termpty *ty, const Evas_Event_Key_Down *ev, 4typedef struct _Keys_Handler Keys_Handler;
5 int alt, int shift, int ctrl); 5
6struct _Keys_Handler
7{
8 Ecore_IMF_Context *imf;
9 unsigned int last_keyup;
10 Eina_List *seq;
11 Eina_Bool composing : 1;
12};
13
14void keyin_compose_seq_reset(Keys_Handler *khdl);
15Eina_Bool key_is_modifier(const char *key);
16Eina_Bool keyin_handle(Keys_Handler *khdl, Termpty *ty, const Evas_Event_Key_Down *ev,
17 int alt, int shift, int ctrl);
18
19void keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev);
20
6 21
7#endif 22#endif
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 64e0054..61e4ecf 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -1,7 +1,5 @@
1#include "private.h" 1#include "private.h"
2 2
3#include <Ecore_IMF.h>
4#include <Ecore_IMF_Evas.h>
5#include <Elementary.h> 3#include <Elementary.h>
6#include <Ecore_Input.h> 4#include <Ecore_Input.h>
7 5
@@ -48,7 +46,6 @@ struct _Termio
48 int cx, cy; 46 int cx, cy;
49 int button; 47 int button;
50 } mouse; 48 } mouse;
51 unsigned int last_keyup;
52 struct { 49 struct {
53 char *string; 50 char *string;
54 int x1, y1, x2, y2; 51 int x1, y1, x2, y2;
@@ -65,7 +62,6 @@ struct _Termio
65 } link; 62 } link;
66 int zoom_fontsize_start; 63 int zoom_fontsize_start;
67 int scroll; 64 int scroll;
68 Eina_List *seq;
69 Evas_Object *self; 65 Evas_Object *self;
70 Evas_Object *event; 66 Evas_Object *event;
71 Term *term; 67 Term *term;
@@ -79,17 +75,16 @@ struct _Termio
79 Ecore_Timer *mouseover_delay; 75 Ecore_Timer *mouseover_delay;
80 Evas_Object *win, *theme, *glayer; 76 Evas_Object *win, *theme, *glayer;
81 Config *config; 77 Config *config;
82 Ecore_IMF_Context *imf;
83 const char *sel_str; 78 const char *sel_str;
84 Eina_List *cur_chids; 79 Eina_List *cur_chids;
85 Ecore_Job *sel_reset_job; 80 Ecore_Job *sel_reset_job;
86 double set_sel_at; 81 double set_sel_at;
87 Elm_Sel_Type sel_type; 82 Elm_Sel_Type sel_type;
83 Keys_Handler khdl;
88 Eina_Bool jump_on_change : 1; 84 Eina_Bool jump_on_change : 1;
89 Eina_Bool jump_on_keypress : 1; 85 Eina_Bool jump_on_keypress : 1;
90 Eina_Bool have_sel : 1; 86 Eina_Bool have_sel : 1;
91 Eina_Bool noreqsize : 1; 87 Eina_Bool noreqsize : 1;
92 Eina_Bool composing : 1;
93 Eina_Bool didclick : 1; 88 Eina_Bool didclick : 1;
94 Eina_Bool moved : 1; 89 Eina_Bool moved : 1;
95 Eina_Bool bottom_right : 1; 90 Eina_Bool bottom_right : 1;
@@ -114,8 +109,6 @@ static void _smart_apply(Evas_Object *obj);
114static void _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force); 109static void _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force);
115static void _smart_calculate(Evas_Object *obj); 110static void _smart_calculate(Evas_Object *obj);
116static void _take_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text); 111static void _take_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text);
117static void _take_selection(Evas_Object *obj, Elm_Sel_Type type);
118static void _paste_selection(Evas_Object *obj, Elm_Sel_Type type);
119 112
120 113
121/* {{{ Helpers */ 114/* {{{ Helpers */
@@ -335,6 +328,32 @@ termio_scroll_get(Evas_Object *obj)
335 return sd->scroll; 328 return sd->scroll;
336} 329}
337 330
331
332void termio_scroll_delta(Evas_Object *obj, int delta, int by_page)
333{
334 Termio *sd = evas_object_smart_data_get(obj);
335 EINA_SAFETY_ON_NULL_RETURN(sd);
336
337 if (by_page)
338 {
339 int by = sd->grid.h - 2;
340 if (by > 1)
341 delta *= by;
342 }
343 sd->scroll += delta;
344 if (delta > 0)
345 {
346 if (sd->scroll > sd->pty->backscroll_num)
347 sd->scroll = sd->pty->backscroll_num;
348 }
349 else
350 {
351 if (sd->scroll < 0) sd->scroll = 0;
352 }
353 _smart_update_queue(obj, sd);
354 miniview_position_offset(term_miniview_get(sd->term), delta, EINA_TRUE);
355}
356
338void 357void
339termio_scroll_set(Evas_Object *obj, int scroll) 358termio_scroll_set(Evas_Object *obj, int scroll)
340{ 359{
@@ -1821,129 +1840,8 @@ _smart_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1821 Termio *sd = evas_object_smart_data_get(data); 1840 Termio *sd = evas_object_smart_data_get(data);
1822 1841
1823 EINA_SAFETY_ON_NULL_RETURN(sd); 1842 EINA_SAFETY_ON_NULL_RETURN(sd);
1824 sd->last_keyup = ev->timestamp;
1825 if (sd->imf)
1826 {
1827 Ecore_IMF_Event_Key_Up imf_ev;
1828 ecore_imf_evas_event_key_up_wrap(ev, &imf_ev);
1829 if (ecore_imf_context_filter_event
1830 (sd->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev))
1831 return;
1832 }
1833}
1834static Eina_Bool
1835_is_modifier(const char *key)
1836{
1837#define STATIC_STR_EQUAL(STR) (!strncmp(key, STR, strlen(STR)))
1838 if ((key != NULL) && (
1839 STATIC_STR_EQUAL("Shift") ||
1840 STATIC_STR_EQUAL("Control") ||
1841 STATIC_STR_EQUAL("Alt") ||
1842 STATIC_STR_EQUAL("Meta") ||
1843 STATIC_STR_EQUAL("Super") ||
1844 STATIC_STR_EQUAL("Hyper") ||
1845 STATIC_STR_EQUAL("Scroll_Lock") ||
1846 STATIC_STR_EQUAL("Num_Lock") ||
1847 STATIC_STR_EQUAL("ISO_Level3_Shift") ||
1848 STATIC_STR_EQUAL("Caps_Lock")))
1849 return EINA_TRUE;
1850#undef STATIC_STR_EQUAL
1851 return EINA_FALSE;
1852}
1853
1854static void
1855_compose_seq_reset(Termio *sd)
1856{
1857 char *str;
1858
1859 EINA_LIST_FREE(sd->seq, str) eina_stringshare_del(str);
1860 sd->composing = EINA_FALSE;
1861}
1862
1863static Eina_Bool
1864_handle_alt_ctrl(const char *keyname, Evas_Object *term)
1865{
1866 if (!strcmp(keyname, "equal"))
1867 termcmd_do(term, NULL, NULL, "f+");
1868 else if (!strcmp(keyname, "minus"))
1869 termcmd_do(term, NULL, NULL, "f-");
1870 else if (!strcmp(keyname, "0"))
1871 termcmd_do(term, NULL, NULL, "f");
1872 else if (!strcmp(keyname, "9"))
1873 termcmd_do(term, NULL, NULL, "fb");
1874 else
1875 return EINA_FALSE;
1876 1843
1877 return EINA_TRUE; 1844 keyin_handle_up(&sd->khdl, ev);
1878}
1879
1880static Eina_Bool
1881_handle_shift(const Evas_Event_Key_Down *ev, int by, Evas_Object *term, Termio *sd)
1882{
1883 if (!strcmp(ev->key, "Prior"))
1884 {
1885 if (!(sd->pty->altbuf))
1886 {
1887 sd->scroll += by;
1888 if (sd->scroll > sd->pty->backscroll_num)
1889 sd->scroll = sd->pty->backscroll_num;
1890 _smart_update_queue(term, sd);
1891 miniview_position_offset(term_miniview_get(sd->term), -by, EINA_TRUE);
1892 }
1893 }
1894 else if (!strcmp(ev->key, "Next"))
1895 {
1896 sd->scroll -= by;
1897 if (sd->scroll < 0) sd->scroll = 0;
1898 _smart_update_queue(term, sd);
1899 miniview_position_offset(term_miniview_get(sd->term), by, EINA_TRUE);
1900 }
1901 else if (!strcmp(ev->key, "Up"))
1902 {
1903 sd->scroll += 1;
1904 if (sd->scroll > sd->pty->backscroll_num)
1905 sd->scroll = sd->pty->backscroll_num;
1906 _smart_update_queue(term, sd);
1907 miniview_position_offset(term_miniview_get(sd->term), -1, EINA_TRUE);
1908 }
1909 else if (!strcmp(ev->key, "Down"))
1910 {
1911 sd->scroll -= 1;
1912 if (sd->scroll < 0) sd->scroll = 0;
1913 _smart_update_queue(term, sd);
1914 miniview_position_offset(term_miniview_get(sd->term), 1, EINA_TRUE);
1915 }
1916 else if (!strcmp(ev->key, "Insert"))
1917 {
1918 if (evas_key_modifier_is_set(ev->modifiers, "Control"))
1919 _paste_selection(term, ELM_SEL_TYPE_CLIPBOARD);
1920 else
1921 _paste_selection(term, ELM_SEL_TYPE_PRIMARY);
1922 }
1923 else if (!strcmp(ev->key, "KP_Add"))
1924 {
1925 Config *config = termio_config_get(term);
1926
1927 if (config) _font_size_set(term, config->font.size + 1);
1928 }
1929 else if (!strcmp(ev->key, "KP_Subtract"))
1930 {
1931 Config *config = termio_config_get(term);
1932
1933 if (config) _font_size_set(term, config->font.size - 1);
1934 }
1935 else if (!strcmp(ev->key, "KP_Multiply"))
1936 {
1937 Config *config = termio_config_get(term);
1938
1939 if (config) _font_size_set(term, 10);
1940 }
1941 else if (!strcmp(ev->key, "KP_Divide"))
1942 _take_selection(term, ELM_SEL_TYPE_CLIPBOARD);
1943 else
1944 return EINA_FALSE;
1945
1946 return EINA_TRUE;
1947} 1845}
1948 1846
1949static void 1847static void
@@ -1952,8 +1850,6 @@ _smart_cb_key_down(void *data, Evas *e EINA_UNUSED,
1952{ 1850{
1953 const Evas_Event_Key_Down *ev = event; 1851 const Evas_Event_Key_Down *ev = event;
1954 Termio *sd = evas_object_smart_data_get(data); 1852 Termio *sd = evas_object_smart_data_get(data);
1955 Ecore_Compose_State state;
1956 char *compres = NULL;
1957 int alt = evas_key_modifier_is_set(ev->modifiers, "Alt"); 1853 int alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
1958 int shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); 1854 int shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
1959 int ctrl = evas_key_modifier_is_set(ev->modifiers, "Control"); 1855 int ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
@@ -1964,215 +1860,18 @@ _smart_cb_key_down(void *data, Evas *e EINA_UNUSED,
1964 if (miniview_handle_key(term_miniview_get(sd->term), ev)) 1860 if (miniview_handle_key(term_miniview_get(sd->term), ev))
1965 return; 1861 return;
1966 1862
1967 if ((!alt) && (ctrl) && (!shift))
1968 {
1969 if (!strcmp(ev->key, "Prior"))
1970 {
1971 evas_object_smart_callback_call(data, "prev", NULL);
1972 goto end;
1973 }
1974 else if (!strcmp(ev->key, "Next"))
1975 {
1976 evas_object_smart_callback_call(data, "next", NULL);
1977 goto end;
1978 }
1979 else if (!strcmp(ev->key, "1"))
1980 {
1981 _compose_seq_reset(sd);
1982 evas_object_smart_callback_call(data, "tab,1", NULL);
1983 goto end;
1984 }
1985 else if (!strcmp(ev->key, "2"))
1986 {
1987 _compose_seq_reset(sd);
1988 evas_object_smart_callback_call(data, "tab,2", NULL);
1989 goto end;
1990 }
1991 else if (!strcmp(ev->key, "3"))
1992 {
1993 _compose_seq_reset(sd);
1994 evas_object_smart_callback_call(data, "tab,3", NULL);
1995 goto end;
1996 }
1997 else if (!strcmp(ev->key, "4"))
1998 {
1999 _compose_seq_reset(sd);
2000 evas_object_smart_callback_call(data, "tab,4", NULL);
2001 goto end;
2002 }
2003 else if (!strcmp(ev->key, "5"))
2004 {
2005 _compose_seq_reset(sd);
2006 evas_object_smart_callback_call(data, "tab,5", NULL);
2007 goto end;
2008 }
2009 else if (!strcmp(ev->key, "6"))
2010 {
2011 _compose_seq_reset(sd);
2012 evas_object_smart_callback_call(data, "tab,6", NULL);
2013 goto end;
2014 }
2015 else if (!strcmp(ev->key, "7"))
2016 {
2017 _compose_seq_reset(sd);
2018 evas_object_smart_callback_call(data, "tab,7", NULL);
2019 goto end;
2020 }
2021 else if (!strcmp(ev->key, "8"))
2022 {
2023 _compose_seq_reset(sd);
2024 evas_object_smart_callback_call(data, "tab,8", NULL);
2025 goto end;
2026 }
2027 else if (!strcmp(ev->key, "9"))
2028 {
2029 _compose_seq_reset(sd);
2030 evas_object_smart_callback_call(data, "tab,9", NULL);
2031 goto end;
2032 }
2033 else if (!strcmp(ev->key, "0"))
2034 {
2035 _compose_seq_reset(sd);
2036 evas_object_smart_callback_call(data, "tab,0", NULL);
2037 goto end;
2038 }
2039 }
2040 if ((!alt) && (ctrl) && (shift))
2041 {
2042 if (!strcmp(ev->key, "Prior"))
2043 {
2044 _compose_seq_reset(sd);
2045 evas_object_smart_callback_call(data, "split,h", NULL);
2046 goto end;
2047 }
2048 else if (!strcmp(ev->key, "Next"))
2049 {
2050 _compose_seq_reset(sd);
2051 evas_object_smart_callback_call(data, "split,v", NULL);
2052 goto end;
2053 }
2054 else if (!strcasecmp(ev->key, "t"))
2055 {
2056 _compose_seq_reset(sd);
2057 evas_object_smart_callback_call(data, "new", NULL);
2058 goto end;
2059 }
2060 else if (!strcmp(ev->key, "Home"))
2061 {
2062 _compose_seq_reset(sd);
2063 evas_object_smart_callback_call(data, "select", NULL);
2064 goto end;
2065 }
2066 else if (!strcasecmp(ev->key, "c"))
2067 {
2068 _compose_seq_reset(sd);
2069 _take_selection(data, ELM_SEL_TYPE_CLIPBOARD);
2070 goto end;
2071 }
2072 else if (!strcasecmp(ev->key, "v"))
2073 {
2074 _compose_seq_reset(sd);
2075 _paste_selection(data, ELM_SEL_TYPE_CLIPBOARD);
2076 goto end;
2077 }
2078 else if (!strcmp(ev->keyname, "h"))
2079 {
2080 term_miniview_toggle(sd->term);
2081 goto end;
2082 }
2083 }
2084 if ((alt) && (!shift) && (!ctrl))
2085 {
2086 if (!strcmp(ev->key, "Home"))
2087 {
2088 _compose_seq_reset(sd);
2089 evas_object_smart_callback_call(data, "cmdbox", NULL);
2090 goto end;
2091 }
2092 }
2093 if ((alt) && (ctrl) && (!shift))
2094 {
2095 if (_handle_alt_ctrl(ev->key, data))
2096 {
2097 _compose_seq_reset(sd);
2098 goto end;
2099 }
2100 }
2101 if (sd->imf)
2102 {
2103 // EXCEPTION. Don't filter modifiers alt+shift -> breaks emacs
2104 // and jed (alt+shift+5 for search/replace for example)
2105 // Don't filter modifiers alt, is used by shells
2106 if ((!alt) && (!ctrl))
2107 {
2108 Ecore_IMF_Event_Key_Down imf_ev;
2109
2110 ecore_imf_evas_event_key_down_wrap((Evas_Event_Key_Down*)ev, &imf_ev);
2111 if (!sd->composing)
2112 {
2113 if (ecore_imf_context_filter_event
2114 (sd->imf, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&imf_ev))
2115 goto end;
2116 }
2117 }
2118 }
2119 if (shift)
2120 {
2121 int by = sd->grid.h - 2;
2122 1863
2123 if (by < 1) by = 1; 1864 if (keyin_handle(&sd->khdl, sd->pty, ev, alt, shift, ctrl))
1865 goto end;
2124 1866
2125 if (_handle_shift(ev, by, data, sd))
2126 {
2127 _compose_seq_reset(sd);
2128 goto end;
2129 }
2130 }
2131 if (sd->jump_on_keypress) 1867 if (sd->jump_on_keypress)
2132 { 1868 {
2133 if (!_is_modifier(ev->key)) 1869 if (!key_is_modifier(ev->key))
2134 { 1870 {
2135 sd->scroll = 0; 1871 sd->scroll = 0;
2136 _smart_update_queue(data, sd); 1872 _smart_update_queue(data, sd);
2137 } 1873 }
2138 } 1874 }
2139 // if term app asked fro kbd lock - dont handle here
2140 if (sd->pty->state.kbd_lock) return;
2141 // if app asked us to not do autorepeat - ignore pree is it is the same
2142 // timestamp as last one
2143 if ((sd->pty->state.no_autorepeat) &&
2144 (ev->timestamp == sd->last_keyup)) return;
2145 if (!sd->composing)
2146 {
2147 _compose_seq_reset(sd);
2148 sd->seq = eina_list_append(sd->seq, eina_stringshare_add(ev->key));
2149 state = ecore_compose_get(sd->seq, &compres);
2150 if (state == ECORE_COMPOSE_MIDDLE) sd->composing = EINA_TRUE;
2151 else sd->composing = EINA_FALSE;
2152 if (!sd->composing) _compose_seq_reset(sd);
2153 else goto end;
2154 }
2155 else
2156 {
2157 if (_is_modifier(ev->key)) goto end;
2158 sd->seq = eina_list_append(sd->seq, eina_stringshare_add(ev->key));
2159 state = ecore_compose_get(sd->seq, &compres);
2160 if (state == ECORE_COMPOSE_NONE) _compose_seq_reset(sd);
2161 else if (state == ECORE_COMPOSE_DONE)
2162 {
2163 _compose_seq_reset(sd);
2164 if (compres)
2165 {
2166 termpty_write(sd->pty, compres, strlen(compres));
2167 free(compres);
2168 compres = NULL;
2169 }
2170 goto end;
2171 }
2172 else goto end;
2173 }
2174
2175 keyin_handle(sd->pty, ev, alt, shift, ctrl);
2176end: 1875end:
2177 if (sd->config->flicker_on_key) 1876 if (sd->config->flicker_on_key)
2178 edje_object_signal_emit(sd->cursor.obj, "key,down", "terminology"); 1877 edje_object_signal_emit(sd->cursor.obj, "key,down", "terminology");
@@ -2181,18 +1880,6 @@ end:
2181/* }}} */ 1880/* }}} */
2182/* {{{ Selection */ 1881/* {{{ Selection */
2183 1882
2184void
2185termio_copy_clipboard(Evas_Object *obj)
2186{
2187 _take_selection(obj, ELM_SEL_TYPE_CLIPBOARD);
2188}
2189
2190void
2191termio_paste_clipboard(Evas_Object *obj)
2192{
2193 _paste_selection(obj, ELM_SEL_TYPE_CLIPBOARD);
2194}
2195
2196char * 1883char *
2197termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y, 1884termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y,
2198 size_t *len) 1885 size_t *len)
@@ -2437,8 +2124,8 @@ _take_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text)
2437 sd->sel_str = text; 2124 sd->sel_str = text;
2438} 2125}
2439 2126
2440static void 2127void
2441_take_selection(Evas_Object *obj, Elm_Sel_Type type) 2128termio_take_selection(Evas_Object *obj, Elm_Sel_Type type)
2442{ 2129{
2443 Termio *sd = evas_object_smart_data_get(obj); 2130 Termio *sd = evas_object_smart_data_get(obj);
2444 int start_x = 0, start_y = 0, end_x = 0, end_y = 0; 2131 int start_x = 0, start_y = 0, end_x = 0, end_y = 0;
@@ -2565,8 +2252,8 @@ _getsel_cb(void *data, Evas_Object *obj EINA_UNUSED, Elm_Selection_Data *ev)
2565 return EINA_TRUE; 2252 return EINA_TRUE;
2566} 2253}
2567 2254
2568static void 2255void
2569_paste_selection(Evas_Object *obj, Elm_Sel_Type type) 2256termio_paste_selection(Evas_Object *obj, Elm_Sel_Type type)
2570{ 2257{
2571 Termio *sd = evas_object_smart_data_get(obj); 2258 Termio *sd = evas_object_smart_data_get(obj);
2572 EINA_SAFETY_ON_NULL_RETURN(sd); 2259 EINA_SAFETY_ON_NULL_RETURN(sd);
@@ -3109,8 +2796,8 @@ _imf_cursor_set(Termio *sd)
3109 /* TODO */ 2796 /* TODO */
3110 Evas_Coord cx, cy, cw, ch; 2797 Evas_Coord cx, cy, cw, ch;
3111 evas_object_geometry_get(sd->cursor.obj, &cx, &cy, &cw, &ch); 2798 evas_object_geometry_get(sd->cursor.obj, &cx, &cy, &cw, &ch);
3112 if (sd->imf) 2799 if (sd->khdl.imf)
3113 ecore_imf_context_cursor_location_set(sd->imf, cx, cy, cw, ch); 2800 ecore_imf_context_cursor_location_set(sd->khdl.imf, cx, cy, cw, ch);
3114 /* 2801 /*
3115 ecore_imf_context_cursor_position_set(sd->imf, 0); // how to get it? 2802 ecore_imf_context_cursor_position_set(sd->imf, 0); // how to get it?
3116 */ 2803 */
@@ -3129,11 +2816,11 @@ _smart_cb_focus_in(void *data, Evas *e EINA_UNUSED,
3129 edje_object_signal_emit(sd->cursor.obj, "focus,in", "terminology"); 2816 edje_object_signal_emit(sd->cursor.obj, "focus,in", "terminology");
3130 if (!sd->win) return; 2817 if (!sd->win) return;
3131 elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_TERMINAL); 2818 elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_TERMINAL);
3132 if (sd->imf) 2819 if (sd->khdl.imf)
3133 { 2820 {
3134 ecore_imf_context_input_panel_show(sd->imf); 2821 ecore_imf_context_input_panel_show(sd->khdl.imf);
3135 ecore_imf_context_reset(sd->imf); 2822 ecore_imf_context_reset(sd->khdl.imf);
3136 ecore_imf_context_focus_in(sd->imf); 2823 ecore_imf_context_focus_in(sd->khdl.imf);
3137 _imf_cursor_set(sd); 2824 _imf_cursor_set(sd);
3138 } 2825 }
3139} 2826}
@@ -3150,12 +2837,12 @@ _smart_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
3150 edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology"); 2837 edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology");
3151 if (!sd->win) return; 2838 if (!sd->win) return;
3152 elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_OFF); 2839 elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_OFF);
3153 if (sd->imf) 2840 if (sd->khdl.imf)
3154 { 2841 {
3155 ecore_imf_context_reset(sd->imf); 2842 ecore_imf_context_reset(sd->khdl.imf);
3156 _imf_cursor_set(sd); 2843 _imf_cursor_set(sd);
3157 ecore_imf_context_focus_out(sd->imf); 2844 ecore_imf_context_focus_out(sd->khdl.imf);
3158 ecore_imf_context_input_panel_hide(sd->imf); 2845 ecore_imf_context_input_panel_hide(sd->khdl.imf);
3159 } 2846 }
3160 _remove_links(sd, obj); 2847 _remove_links(sd, obj);
3161} 2848}
@@ -3592,7 +3279,7 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3592 { 3279 {
3593 _sel_line(data, cx, cy - sd->scroll); 3280 _sel_line(data, cx, cy - sd->scroll);
3594 if (sd->pty->selection.is_active) 3281 if (sd->pty->selection.is_active)
3595 _take_selection(data, ELM_SEL_TYPE_PRIMARY); 3282 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY);
3596 sd->didclick = EINA_TRUE; 3283 sd->didclick = EINA_TRUE;
3597 } 3284 }
3598 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) 3285 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
@@ -3604,7 +3291,7 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3604 else 3291 else
3605 _sel_word(data, cx, cy - sd->scroll); 3292 _sel_word(data, cx, cy - sd->scroll);
3606 if (sd->pty->selection.is_active) 3293 if (sd->pty->selection.is_active)
3607 _take_selection(data, ELM_SEL_TYPE_PRIMARY); 3294 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY);
3608 sd->didclick = EINA_TRUE; 3295 sd->didclick = EINA_TRUE;
3609 } 3296 }
3610 else 3297 else
@@ -3692,7 +3379,7 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3692 } 3379 }
3693 else if (ev->button == 2) 3380 else if (ev->button == 2)
3694 { 3381 {
3695 _paste_selection(data, ELM_SEL_TYPE_PRIMARY); 3382 termio_paste_selection(data, ELM_SEL_TYPE_PRIMARY);
3696 } 3383 }
3697 else if (ev->button == 3) 3384 else if (ev->button == 3)
3698 { 3385 {
@@ -3749,13 +3436,13 @@ _smart_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED
3749 sd->pty->selection.end.x = cx; 3436 sd->pty->selection.end.x = cx;
3750 sd->pty->selection.end.y = cy - sd->scroll; 3437 sd->pty->selection.end.y = cy - sd->scroll;
3751 _smart_update_queue(data, sd); 3438 _smart_update_queue(data, sd);
3752 _take_selection(data, ELM_SEL_TYPE_PRIMARY); 3439 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY);
3753 } 3440 }
3754 else 3441 else
3755 { 3442 {
3756 _selection_newline_extend_fix(data); 3443 _selection_newline_extend_fix(data);
3757 _smart_update_queue(data, sd); 3444 _smart_update_queue(data, sd);
3758 _take_selection(data, ELM_SEL_TYPE_PRIMARY); 3445 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY);
3759 } 3446 }
3760 sd->pty->selection.makesel = EINA_FALSE; 3447 sd->pty->selection.makesel = EINA_FALSE;
3761 } 3448 }
@@ -4598,7 +4285,7 @@ _smart_add(Evas_Object *obj)
4598 const char *imf_id = ecore_imf_context_default_id_get(); 4285 const char *imf_id = ecore_imf_context_default_id_get();
4599 Evas *e; 4286 Evas *e;
4600 4287
4601 if (!imf_id) sd->imf = NULL; 4288 if (!imf_id) sd->khdl.imf = NULL;
4602 else 4289 else
4603 { 4290 {
4604 const Ecore_IMF_Context_Info *imf_info; 4291 const Ecore_IMF_Context_Info *imf_info;
@@ -4606,41 +4293,41 @@ _smart_add(Evas_Object *obj)
4606 imf_info = ecore_imf_context_info_by_id_get(imf_id); 4293 imf_info = ecore_imf_context_info_by_id_get(imf_id);
4607 if ((!imf_info->canvas_type) || 4294 if ((!imf_info->canvas_type) ||
4608 (strcmp(imf_info->canvas_type, "evas") == 0)) 4295 (strcmp(imf_info->canvas_type, "evas") == 0))
4609 sd->imf = ecore_imf_context_add(imf_id); 4296 sd->khdl.imf = ecore_imf_context_add(imf_id);
4610 else 4297 else
4611 { 4298 {
4612 imf_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); 4299 imf_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
4613 if (imf_id) sd->imf = ecore_imf_context_add(imf_id); 4300 if (imf_id) sd->khdl.imf = ecore_imf_context_add(imf_id);
4614 } 4301 }
4615 } 4302 }
4616 4303
4617 if (!sd->imf) goto imf_done; 4304 if (!sd->khdl.imf) goto imf_done;
4618 4305
4619 e = evas_object_evas_get(o); 4306 e = evas_object_evas_get(o);
4620 ecore_imf_context_client_window_set 4307 ecore_imf_context_client_window_set
4621 (sd->imf, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(e))); 4308 (sd->khdl.imf, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(e)));
4622 ecore_imf_context_client_canvas_set(sd->imf, e); 4309 ecore_imf_context_client_canvas_set(sd->khdl.imf, e);
4623 4310
4624 ecore_imf_context_event_callback_add 4311 ecore_imf_context_event_callback_add
4625 (sd->imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, sd); 4312 (sd->khdl.imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, sd);
4626 4313
4627 /* make IMF usable by a terminal - no preedit, prediction... */ 4314 /* make IMF usable by a terminal - no preedit, prediction... */
4628 ecore_imf_context_use_preedit_set 4315 ecore_imf_context_use_preedit_set
4629 (sd->imf, EINA_FALSE); 4316 (sd->khdl.imf, EINA_FALSE);
4630 ecore_imf_context_prediction_allow_set 4317 ecore_imf_context_prediction_allow_set
4631 (sd->imf, EINA_FALSE); 4318 (sd->khdl.imf, EINA_FALSE);
4632 ecore_imf_context_autocapital_type_set 4319 ecore_imf_context_autocapital_type_set
4633 (sd->imf, ECORE_IMF_AUTOCAPITAL_TYPE_NONE); 4320 (sd->khdl.imf, ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
4634 ecore_imf_context_input_panel_layout_set 4321 ecore_imf_context_input_panel_layout_set
4635 (sd->imf, ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL); 4322 (sd->khdl.imf, ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL);
4636 ecore_imf_context_input_mode_set 4323 ecore_imf_context_input_mode_set
4637 (sd->imf, ECORE_IMF_INPUT_MODE_FULL); 4324 (sd->khdl.imf, ECORE_IMF_INPUT_MODE_FULL);
4638 ecore_imf_context_input_panel_language_set 4325 ecore_imf_context_input_panel_language_set
4639 (sd->imf, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET); 4326 (sd->khdl.imf, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
4640 ecore_imf_context_input_panel_return_key_type_set 4327 ecore_imf_context_input_panel_return_key_type_set
4641 (sd->imf, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT); 4328 (sd->khdl.imf, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
4642imf_done: 4329imf_done:
4643 if (sd->imf) DBG("Ecore IMF Setup"); 4330 if (sd->khdl.imf) DBG("Ecore IMF Setup");
4644 else WRN(_("Ecore IMF failed")); 4331 else WRN(_("Ecore IMF failed"));
4645 } 4332 }
4646 terms = eina_list_append(terms, obj); 4333 terms = eina_list_append(terms, obj);
@@ -4655,11 +4342,11 @@ _smart_del(Evas_Object *obj)
4655 4342
4656 EINA_SAFETY_ON_NULL_RETURN(sd); 4343 EINA_SAFETY_ON_NULL_RETURN(sd);
4657 terms = eina_list_remove(terms, obj); 4344 terms = eina_list_remove(terms, obj);
4658 if (sd->imf) 4345 if (sd->khdl.imf)
4659 { 4346 {
4660 ecore_imf_context_event_callback_del 4347 ecore_imf_context_event_callback_del
4661 (sd->imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb); 4348 (sd->khdl.imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb);
4662 ecore_imf_context_del(sd->imf); 4349 ecore_imf_context_del(sd->khdl.imf);
4663 } 4350 }
4664 if (sd->cursor.obj) evas_object_del(sd->cursor.obj); 4351 if (sd->cursor.obj) evas_object_del(sd->cursor.obj);
4665 if (sd->event) evas_object_del(sd->event); 4352 if (sd->event) evas_object_del(sd->event);
@@ -4684,7 +4371,7 @@ _smart_del(Evas_Object *obj)
4684 evas_object_del(o); 4371 evas_object_del(o);
4685 } 4372 }
4686 if (sd->link.down.dndobj) evas_object_del(sd->link.down.dndobj); 4373 if (sd->link.down.dndobj) evas_object_del(sd->link.down.dndobj);
4687 _compose_seq_reset(sd); 4374 keyin_compose_seq_reset(&sd->khdl);
4688 if (sd->sel_str) eina_stringshare_del(sd->sel_str); 4375 if (sd->sel_str) eina_stringshare_del(sd->sel_str);
4689 if (sd->sel_reset_job) ecore_job_del(sd->sel_reset_job); 4376 if (sd->sel_reset_job) ecore_job_del(sd->sel_reset_job);
4690 EINA_LIST_FREE(sd->cur_chids, chid) eina_stringshare_del(chid); 4377 EINA_LIST_FREE(sd->cur_chids, chid) eina_stringshare_del(chid);
@@ -4700,7 +4387,7 @@ _smart_del(Evas_Object *obj)
4700 sd->delayed_size_timer = NULL; 4387 sd->delayed_size_timer = NULL;
4701 sd->font.name = NULL; 4388 sd->font.name = NULL;
4702 sd->pty = NULL; 4389 sd->pty = NULL;
4703 sd->imf = NULL; 4390 sd->khdl.imf = NULL;
4704 sd->win = NULL; 4391 sd->win = NULL;
4705 sd->glayer = NULL; 4392 sd->glayer = NULL;
4706 ecore_imf_shutdown(); 4393 ecore_imf_shutdown();
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 77de3b9..ecc2513 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -14,14 +14,15 @@ char *termio_selection_get(Evas_Object *obj,
14 int c1x, int c1y, int c2x, int c2y, 14 int c1x, int c1y, int c2x, int c2y,
15 size_t *len); 15 size_t *len);
16Eina_Bool termio_selection_exists(const Evas_Object *obj); 16Eina_Bool termio_selection_exists(const Evas_Object *obj);
17void termio_scroll_delta(Evas_Object *obj, int delta, int by_page);
17void termio_scroll_set(Evas_Object *obj, int scroll); 18void termio_scroll_set(Evas_Object *obj, int scroll);
18void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y); 19void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y);
19void termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int n); 20void termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int n);
20 21
21void termio_config_update(Evas_Object *obj); 22void termio_config_update(Evas_Object *obj);
22Config *termio_config_get(const Evas_Object *obj); 23Config *termio_config_get(const Evas_Object *obj);
23void termio_copy_clipboard(Evas_Object *obj); 24void termio_take_selection(Evas_Object *obj, Elm_Sel_Type);
24void termio_paste_clipboard(Evas_Object *obj); 25void termio_paste_selection(Evas_Object *obj, Elm_Sel_Type);
25const char *termio_link_get(const Evas_Object *obj); 26const char *termio_link_get(const Evas_Object *obj);
26void termio_mouseover_suspend_pushpop(Evas_Object *obj, int dir); 27void termio_mouseover_suspend_pushpop(Evas_Object *obj, int dir);
27void termio_event_feed_mouse_in(Evas_Object *obj); 28void termio_event_feed_mouse_in(Evas_Object *obj);