summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-02-02 23:15:50 +0100
committerBoris Faure <billiob@gmail.com>2016-02-02 23:15:50 +0100
commit1100f4d9644f997e889ec82f1b2278851a5fbcb9 (patch)
tree8f9c08b12e9ab028b803b563f5b43f2dae9d1c66 /src
parente8c4f080ed38c85340edffb46ffed6dbe05a7b55 (diff)
do not use edje cb when term quits. Closes T3105
Also reorganize the code a bit
Diffstat (limited to 'src')
-rw-r--r--src/bin/controls.c2
-rw-r--r--src/bin/main.h3
-rw-r--r--src/bin/termio.c62
-rw-r--r--src/bin/win.c48
4 files changed, 33 insertions, 82 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
index 1640073..d75041a 100644
--- a/src/bin/controls.c
+++ b/src/bin/controls.c
@@ -94,7 +94,7 @@ _cb_ct_miniview(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *even
94static void 94static void
95_cb_ct_close(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 95_cb_ct_close(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
96{ 96{
97 main_close(ct_win, ct_term); 97 term_close(ct_win, ct_term, EINA_FALSE);
98} 98}
99 99
100static void 100static void
diff --git a/src/bin/main.h b/src/bin/main.h
index a378f92..61d387f 100644
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -8,7 +8,8 @@ void main_new(Evas_Object *win, Evas_Object *term);
8void main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir); 8void main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir);
9void main_split_h(Evas_Object *win, Evas_Object *term, char *cmd); 9void main_split_h(Evas_Object *win, Evas_Object *term, char *cmd);
10void main_split_v(Evas_Object *win, Evas_Object *term, char *cmd); 10void main_split_v(Evas_Object *win, Evas_Object *term, char *cmd);
11void main_close(Evas_Object *win, Evas_Object *term); 11void term_close(Evas_Object *win, Evas_Object *term,
12 Eina_Bool hold_if_requested);
12 13
13void main_trans_update(const Config *config); 14void main_trans_update(const Config *config);
14void main_media_update(const Config *config); 15void main_media_update(const Config *config);
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 57f99ea..704c363 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -275,25 +275,6 @@ _win_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event EINA
275 275
276 276
277void 277void
278termio_win_set(Evas_Object *obj, Evas_Object *win)
279{
280 Termio *sd = evas_object_smart_data_get(obj);
281 EINA_SAFETY_ON_NULL_RETURN(sd);
282 if (sd->win)
283 {
284 evas_object_event_callback_del_full(sd->win, EVAS_CALLBACK_DEL,
285 _win_obj_del, obj);
286 sd->win = NULL;
287 }
288 if (win)
289 {
290 sd->win = win;
291 evas_object_event_callback_add(sd->win, EVAS_CALLBACK_DEL,
292 _win_obj_del, obj);
293 }
294}
295
296void
297termio_theme_set(Evas_Object *obj, Evas_Object *theme) 278termio_theme_set(Evas_Object *obj, Evas_Object *theme)
298{ 279{
299 Termio *sd = evas_object_smart_data_get(obj); 280 Termio *sd = evas_object_smart_data_get(obj);
@@ -5474,38 +5455,8 @@ _smart_pty_exited(void *data)
5474{ 5455{
5475 Termio *sd = evas_object_smart_data_get(data); 5456 Termio *sd = evas_object_smart_data_get(data);
5476 5457
5477 if (sd->event) 5458 EINA_SAFETY_ON_NULL_RETURN(sd);
5478 { 5459 term_close(sd->win, sd->self, EINA_TRUE);
5479 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_DOWN,
5480 _smart_cb_mouse_down);
5481 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_UP,
5482 _smart_cb_mouse_up);
5483 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_MOVE,
5484 _smart_cb_mouse_move);
5485 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_IN,
5486 _smart_cb_mouse_in);
5487 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_OUT,
5488 _smart_cb_mouse_out);
5489 evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_WHEEL,
5490 _smart_cb_mouse_wheel);
5491
5492 evas_object_del(sd->event);
5493 sd->event = NULL;
5494 }
5495 if (sd->self)
5496 {
5497 evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_DOWN,
5498 _smart_cb_key_down);
5499 evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_UP,
5500 _smart_cb_key_up);
5501 evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_IN,
5502 _smart_cb_focus_in);
5503 evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_OUT,
5504 _smart_cb_focus_out);
5505 sd->self = NULL;
5506 }
5507
5508 evas_object_smart_callback_call(data, "exited", NULL);
5509} 5460}
5510 5461
5511static void 5462static void
@@ -5906,7 +5857,7 @@ _smart_cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
5906 5857
5907 5858
5908Evas_Object * 5859Evas_Object *
5909termio_add(Evas_Object *parent, Config *config, 5860termio_add(Evas_Object *win, Config *config,
5910 const char *cmd, Eina_Bool login_shell, const char *cd, 5861 const char *cmd, Eina_Bool login_shell, const char *cd,
5911 int w, int h, Term *term) 5862 int w, int h, Term *term)
5912{ 5863{
@@ -5923,8 +5874,8 @@ termio_add(Evas_Object *parent, Config *config,
5923 }; 5874 };
5924 char *mod = NULL; 5875 char *mod = NULL;
5925 5876
5926 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 5877 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
5927 e = evas_object_evas_get(parent); 5878 e = evas_object_evas_get(win);
5928 if (!e) return NULL; 5879 if (!e) return NULL;
5929 5880
5930 if (!_smart) _smart_init(); 5881 if (!_smart) _smart_init();
@@ -5938,8 +5889,9 @@ termio_add(Evas_Object *parent, Config *config,
5938 5889
5939 termio_config_set(obj, config); 5890 termio_config_set(obj, config);
5940 sd->term = term; 5891 sd->term = term;
5892 sd->win = win;
5941 5893
5942 sd->glayer = g = elm_gesture_layer_add(parent); 5894 sd->glayer = g = elm_gesture_layer_add(win);
5943 elm_gesture_layer_attach(g, sd->event); 5895 elm_gesture_layer_attach(g, sd->event);
5944 5896
5945 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, 5897 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS,
diff --git a/src/bin/win.c b/src/bin/win.c
index 610ad44..143984e 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -391,6 +391,7 @@ _solo_focus(Term_Container *tc, Term_Container *relative)
391 if (term->wn->cmdbox) 391 if (term->wn->cmdbox)
392 elm_object_focus_set(term->wn->cmdbox, EINA_FALSE); 392 elm_object_focus_set(term->wn->cmdbox, EINA_FALSE);
393 elm_object_focus_set(term->termio, EINA_TRUE); 393 elm_object_focus_set(term->termio, EINA_TRUE);
394 termio_event_feed_mouse_in(term->termio);
394 395
395 title = termio_title_get(term->termio); 396 title = termio_title_get(term->termio);
396 if (title) 397 if (title)
@@ -1080,16 +1081,21 @@ win_new(const char *name, const char *role, const char *title,
1080} 1081}
1081 1082
1082void 1083void
1083main_close(Evas_Object *win, Evas_Object *term) 1084term_close(Evas_Object *win, Evas_Object *term, Eina_Bool hold_if_requested)
1084{ 1085{
1085 Term *tm; 1086 Term *tm;
1086 Term_Container *tc; 1087 Term_Container *tc;
1087 Win *wn = _win_find(win); 1088 Win *wn = _win_find(win);
1088 1089
1089 if (!wn) return; 1090 if (!wn)
1091 return;
1090 1092
1091 tm = evas_object_data_get(term, "term"); 1093 tm = evas_object_data_get(term, "term");
1092 if (!tm) return; 1094 if (!tm)
1095 return;
1096
1097 if (tm->hold && hold_if_requested)
1098 return;
1093 1099
1094 wn->terms = eina_list_remove(wn->terms, tm); 1100 wn->terms = eina_list_remove(wn->terms, tm);
1095 tc = tm->container; 1101 tc = tm->container;
@@ -1668,7 +1674,7 @@ _cb_tab_close(void *data, Evas_Object *obj EINA_UNUSED,
1668 Win *wn = term->wn; 1674 Win *wn = term->wn;
1669 Evas_Object *win = win_evas_object_get(wn); 1675 Evas_Object *win = win_evas_object_get(wn);
1670 1676
1671 main_close(win, term->termio); 1677 term_close(win, term->termio, EINA_FALSE);
1672} 1678}
1673 1679
1674static void 1680static void
@@ -2132,13 +2138,10 @@ _tabs_close(Term_Container *tc, Term_Container *child)
2132 2138
2133 edje_object_signal_emit(term->bg, "tabcount,off", "terminology"); 2139 edje_object_signal_emit(term->bg, "tabcount,off", "terminology");
2134 2140
2135
2136 count = eina_list_count(tabs->tabs); 2141 count = eina_list_count(tabs->tabs);
2137 if (count == 1) 2142 if (count == 1)
2138 { 2143 {
2139 assert (next_child->type == TERM_CONTAINER_TYPE_SOLO); 2144 assert (next_child->type == TERM_CONTAINER_TYPE_SOLO);
2140 solo = (Solo*)next_child;
2141 term = solo->term;
2142 _tabbar_clear(term); 2145 _tabbar_clear(term);
2143 2146
2144 edje_object_signal_emit(term->bg, "tabcount,off", "terminology"); 2147 edje_object_signal_emit(term->bg, "tabcount,off", "terminology");
@@ -2159,13 +2162,15 @@ _tabs_close(Term_Container *tc, Term_Container *child)
2159 { 2162 {
2160 tabs->current = next_item; 2163 tabs->current = next_item;
2161 /* XXX: refresh */ 2164 /* XXX: refresh */
2162 tc->swallow(tc, child, next_child);
2163 tc_parent->swallow(tc_parent, tc, tc); 2165 tc_parent->swallow(tc_parent, tc, tc);
2166 tc->swallow(tc, child, next_child);
2164 } 2167 }
2165 else 2168 else
2166 { 2169 {
2167 next_item = tabs->current; 2170 next_item = tabs->current;
2168 next_child = next_item->tc; 2171 next_child = next_item->tc;
2172 if (tc->is_focused)
2173 next_child->focus(next_child, tc);
2169 } 2174 }
2170 2175
2171 if (item->tc->selector_img) 2176 if (item->tc->selector_img)
@@ -2178,9 +2183,11 @@ _tabs_close(Term_Container *tc, Term_Container *child)
2178 2183
2179 free(item); 2184 free(item);
2180 count--; 2185 count--;
2181 if (tc->is_focused)
2182 next_child->focus(next_child, tc);
2183 _tabs_refresh(tabs); 2186 _tabs_refresh(tabs);
2187 if (tc->is_focused)
2188 {
2189 next_child->focus(next_child, tc);
2190 }
2184 } 2191 }
2185} 2192}
2186 2193
@@ -2829,6 +2836,7 @@ _term_focus(Term *term)
2829{ 2836{
2830 Term_Container *tc; 2837 Term_Container *tc;
2831 2838
2839 DBG("is focused? tc:%p", term->container);
2832 if (_term_is_focused(term)) 2840 if (_term_is_focused(term))
2833 return; 2841 return;
2834 2842
@@ -2842,6 +2850,7 @@ term_unfocus(Term *term)
2842{ 2850{
2843 Term_Container *tc; 2851 Term_Container *tc;
2844 2852
2853 DBG("is focused? tc:%p", term->container);
2845 if (!_term_is_focused(term)) 2854 if (!_term_is_focused(term))
2846 return; 2855 return;
2847 2856
@@ -3161,6 +3170,7 @@ _term_miniview_check(Term *term)
3161 { 3170 {
3162 if (term->miniview_shown) 3171 if (term->miniview_shown)
3163 { 3172 {
3173 DBG("is focused? tc:%p", term->container);
3164 if (_term_is_focused(term)) 3174 if (_term_is_focused(term))
3165 edje_object_signal_emit(term->bg, "miniview,on", "terminology"); 3175 edje_object_signal_emit(term->bg, "miniview,on", "terminology");
3166 } 3176 }
@@ -3393,6 +3403,7 @@ static void
3393_cb_icon(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 3403_cb_icon(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
3394{ 3404{
3395 Term *term = data; 3405 Term *term = data;
3406 DBG("is focused? tc:%p", term->container);
3396 if (_term_is_focused(term)) 3407 if (_term_is_focused(term))
3397 elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->termio)); 3408 elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->termio));
3398} 3409}
@@ -3868,6 +3879,7 @@ _term_bg_config(Term *term)
3868 } 3879 }
3869 } 3880 }
3870 3881
3882 DBG("is focused? tc:%p", term->container);
3871 if (_term_is_focused(term) && (_win_is_focused(term->wn))) 3883 if (_term_is_focused(term) && (_win_is_focused(term->wn)))
3872 { 3884 {
3873 edje_object_signal_emit(term->bg, "focus,in", "terminology"); 3885 edje_object_signal_emit(term->bg, "focus,in", "terminology");
@@ -3963,6 +3975,7 @@ _cb_options_done(void *data)
3963 if (!_win_is_focused(wn)) return; 3975 if (!_win_is_focused(wn)) return;
3964 EINA_LIST_FOREACH(wn->terms, l, term) 3976 EINA_LIST_FOREACH(wn->terms, l, term)
3965 { 3977 {
3978 DBG("is focused? tc:%p", term->container);
3966 if (_term_is_focused(term)) 3979 if (_term_is_focused(term))
3967 { 3980 {
3968 elm_object_focus_set(term->termio, EINA_TRUE); 3981 elm_object_focus_set(term->termio, EINA_TRUE);
@@ -3984,19 +3997,6 @@ _cb_options(void *data, Evas_Object *obj EINA_UNUSED,
3984 _cb_options_done, term->wn); 3997 _cb_options_done, term->wn);
3985} 3998}
3986 3999
3987static void
3988_cb_exited(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
3989{
3990 Term *term = data;
3991
3992 if (!term->hold)
3993 {
3994 Win *wn = term->wn;
3995 Evas_Object *win = win_evas_object_get(wn);
3996 main_close(win, term->termio);
3997 }
3998}
3999
4000void 4000void
4001term_ref(Term *term) 4001term_ref(Term *term)
4002{ 4002{
@@ -4091,7 +4091,6 @@ term_new(Win *wn, Config *config, const char *cmd,
4091 evas_object_data_set(o, "term", term); 4091 evas_object_data_set(o, "term", term);
4092 colors_term_init(termio_textgrid_get(term->termio), term->bg, config); 4092 colors_term_init(termio_textgrid_get(term->termio), term->bg, config);
4093 4093
4094 termio_win_set(o, wn->win);
4095 termio_theme_set(o, term->bg); 4094 termio_theme_set(o, term->bg);
4096 4095
4097 term->miniview = o = miniview_add(wn->win, term->termio); 4096 term->miniview = o = miniview_add(wn->win, term->termio);
@@ -4115,7 +4114,6 @@ term_new(Win *wn, Config *config, const char *cmd,
4115 edje_object_part_swallow(term->bg, "terminology.content", term->base); 4114 edje_object_part_swallow(term->bg, "terminology.content", term->base);
4116 edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview); 4115 edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview);
4117 evas_object_smart_callback_add(o, "options", _cb_options, term); 4116 evas_object_smart_callback_add(o, "options", _cb_options, term);
4118 evas_object_smart_callback_add(o, "exited", _cb_exited, term);
4119 evas_object_smart_callback_add(o, "bell", _cb_bell, term); 4117 evas_object_smart_callback_add(o, "bell", _cb_bell, term);
4120 evas_object_smart_callback_add(o, "popup", _cb_popup, term); 4118 evas_object_smart_callback_add(o, "popup", _cb_popup, term);
4121 evas_object_smart_callback_add(o, "popup,queue", _cb_popup_queue, term); 4119 evas_object_smart_callback_add(o, "popup,queue", _cb_popup_queue, term);