summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-05-31 17:38:02 +0200
committerBoris Faure <billiob@gmail.com>2015-05-31 17:38:02 +0200
commit231ff2514a0369cffd7bee0f7a35ca66c732639a (patch)
treeabb323d3a2004e0ddcec57cbb7f7219620300bd0 /src
parentbd9f8591e13b3e31f8baf046272d5e646ab58e4b (diff)
fix focus issue with ctxpopup. Closes T2455
Diffstat (limited to 'src')
-rw-r--r--src/bin/termio.c23
-rw-r--r--src/bin/win.c13
-rw-r--r--src/bin/win.h2
3 files changed, 33 insertions, 5 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 44a9015..b911526 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -881,13 +881,15 @@ _cb_ctxp_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
881 Termio *sd = data; 881 Termio *sd = data;
882 EINA_SAFETY_ON_NULL_RETURN(sd); 882 EINA_SAFETY_ON_NULL_RETURN(sd);
883 sd->ctxpopup = NULL; 883 sd->ctxpopup = NULL;
884 elm_object_focus_set(sd->self, EINA_TRUE);
885} 884}
886 885
887static void 886static void
888_cb_ctxp_dismissed(void *data EINA_UNUSED, Evas_Object *obj, 887_cb_ctxp_dismissed(void *data EINA_UNUSED, Evas_Object *obj,
889 void *event EINA_UNUSED) 888 void *event EINA_UNUSED)
890{ 889{
890 Termio *sd = data;
891 EINA_SAFETY_ON_NULL_RETURN(sd);
892 sd->ctxpopup = NULL;
891 evas_object_del(obj); 893 evas_object_del(obj);
892} 894}
893 895
@@ -895,7 +897,12 @@ static void
895_cb_ctxp_link_preview(void *data, Evas_Object *obj, void *event EINA_UNUSED) 897_cb_ctxp_link_preview(void *data, Evas_Object *obj, void *event EINA_UNUSED)
896{ 898{
897 Evas_Object *term = data; 899 Evas_Object *term = data;
900 Termio *sd = evas_object_smart_data_get(term);
901 EINA_SAFETY_ON_NULL_RETURN(sd);
902
898 _activate_link(term, EINA_TRUE); 903 _activate_link(term, EINA_TRUE);
904
905 sd->ctxpopup = NULL;
899 evas_object_del(obj); 906 evas_object_del(obj);
900} 907}
901 908
@@ -903,7 +910,11 @@ static void
903_cb_ctxp_link_open(void *data, Evas_Object *obj, void *event EINA_UNUSED) 910_cb_ctxp_link_open(void *data, Evas_Object *obj, void *event EINA_UNUSED)
904{ 911{
905 Evas_Object *term = data; 912 Evas_Object *term = data;
913 Termio *sd = evas_object_smart_data_get(term);
914 EINA_SAFETY_ON_NULL_RETURN(sd);
906 _activate_link(term, EINA_FALSE); 915 _activate_link(term, EINA_FALSE);
916
917 sd->ctxpopup = NULL;
907 evas_object_del(obj); 918 evas_object_del(obj);
908} 919}
909 920
@@ -915,6 +926,8 @@ _cb_ctxp_link_copy(void *data, Evas_Object *obj, void *event EINA_UNUSED)
915 EINA_SAFETY_ON_NULL_RETURN(sd); 926 EINA_SAFETY_ON_NULL_RETURN(sd);
916 EINA_SAFETY_ON_NULL_RETURN(sd->link.string); 927 EINA_SAFETY_ON_NULL_RETURN(sd->link.string);
917 _take_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, sd->link.string); 928 _take_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, sd->link.string);
929
930 sd->ctxpopup = NULL;
918 evas_object_del(obj); 931 evas_object_del(obj);
919} 932}
920 933
@@ -3398,8 +3411,6 @@ _smart_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
3398 Termio *sd = evas_object_smart_data_get(data); 3411 Termio *sd = evas_object_smart_data_get(data);
3399 EINA_SAFETY_ON_NULL_RETURN(sd); 3412 EINA_SAFETY_ON_NULL_RETURN(sd);
3400 3413
3401 if (sd->ctxpopup) return; /* ctxp triggers focus out we should ignore */
3402
3403 edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology"); 3414 edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology");
3404 if (!sd->win) return; 3415 if (!sd->win) return;
3405 sd->pty->selection.last_click = 0; 3416 sd->pty->selection.last_click = 0;
@@ -3412,6 +3423,7 @@ _smart_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
3412 ecore_imf_context_input_panel_hide(sd->khdl.imf); 3423 ecore_imf_context_input_panel_hide(sd->khdl.imf);
3413 } 3424 }
3414 _remove_links(sd, obj); 3425 _remove_links(sd, obj);
3426 term_unfocus(sd->term);
3415} 3427}
3416 3428
3417static void 3429static void
@@ -3921,7 +3933,11 @@ _handle_mouse_down_single_click(Termio *sd,
3921static void 3933static void
3922_cb_ctxp_sel_copy(void *data, Evas_Object *obj, void *event EINA_UNUSED) 3934_cb_ctxp_sel_copy(void *data, Evas_Object *obj, void *event EINA_UNUSED)
3923{ 3935{
3936 Evas_Object *term = data;
3937 Termio *sd = evas_object_smart_data_get(term);
3938
3924 termio_take_selection(data, ELM_SEL_TYPE_CLIPBOARD); 3939 termio_take_selection(data, ELM_SEL_TYPE_CLIPBOARD);
3940 sd->ctxpopup = NULL;
3925 evas_object_del(obj); 3941 evas_object_del(obj);
3926} 3942}
3927 3943
@@ -3929,7 +3945,6 @@ static void
3929_handle_right_click(Evas_Object *obj, Evas_Event_Mouse_Down *ev, Termio *sd, 3945_handle_right_click(Evas_Object *obj, Evas_Event_Mouse_Down *ev, Termio *sd,
3930 int cx, int cy) 3946 int cx, int cy)
3931{ 3947{
3932 elm_object_focus_set(obj, EINA_TRUE);
3933 if (_mouse_in_selection(sd, cx, cy)) 3948 if (_mouse_in_selection(sd, cx, cy))
3934 { 3949 {
3935 Evas_Object *ctxp; 3950 Evas_Object *ctxp;
diff --git a/src/bin/win.c b/src/bin/win.c
index 9a10b39..ec0b01e 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -459,6 +459,7 @@ static Eina_Bool
459_win_is_focused(Win *wn) 459_win_is_focused(Win *wn)
460{ 460{
461 Term_Container *tc; 461 Term_Container *tc;
462
462 if (!wn) 463 if (!wn)
463 return EINA_FALSE; 464 return EINA_FALSE;
464 465
@@ -2671,6 +2672,18 @@ _term_focus(Term *term)
2671 tc->focus(tc, tc); 2672 tc->focus(tc, tc);
2672} 2673}
2673 2674
2675void
2676term_unfocus(Term *term)
2677{
2678 Term_Container *tc;
2679
2680 if (!_term_is_focused(term))
2681 return;
2682
2683 tc = term->container;
2684 tc->unfocus(tc, tc);
2685}
2686
2674Term * 2687Term *
2675term_prev_get(Term *term) 2688term_prev_get(Term *term)
2676{ 2689{
diff --git a/src/bin/win.h b/src/bin/win.h
index 91a5b8b..9ad21da 100644
--- a/src/bin/win.h
+++ b/src/bin/win.h
@@ -9,7 +9,7 @@ typedef struct _Term Term;
9 9
10 10
11Eina_Bool main_term_popup_exists(const Term *term); 11Eina_Bool main_term_popup_exists(const Term *term);
12void main_term_focus(Term *term); 12void term_unfocus(Term *term);
13 13
14Evas_Object *main_term_evas_object_get(Term *term); 14Evas_Object *main_term_evas_object_get(Term *term);
15Evas_Object *term_miniview_get(Term *term); 15Evas_Object *term_miniview_get(Term *term);