summaryrefslogtreecommitdiff
path: root/src/bin/controls.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-15 12:43:13 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-15 13:33:23 +0900
commit86b0d64c54e74facf6fa13c383090c290777c931 (patch)
tree130a0f9a06b0b788a8c23e18771abe29562bad12 /src/bin/controls.c
parent450d27162701b9ea84dbd00f1bb36c240537b32c (diff)
fix focus restoration when creating new tabs or splits by allowing cb
to restore it.
Diffstat (limited to 'src/bin/controls.c')
-rw-r--r--src/bin/controls.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
index 2e12390..f016dbb 100644
--- a/src/bin/controls.c
+++ b/src/bin/controls.c
@@ -12,6 +12,8 @@ static Evas_Object *ct_box2 = NULL, *ct_over = NULL;
12static Eina_Bool ct_out = EINA_FALSE; 12static Eina_Bool ct_out = EINA_FALSE;
13static Ecore_Timer *ct_del_timer = NULL; 13static Ecore_Timer *ct_del_timer = NULL;
14static Evas_Object *ct_win = NULL, *ct_bg = NULL, *ct_term = NULL; 14static Evas_Object *ct_win = NULL, *ct_bg = NULL, *ct_term = NULL;
15static void (*ct_donecb) (void *data) = NULL;
16static void *ct_donedata = NULL;
15 17
16static Eina_Bool 18static Eina_Bool
17_cb_ct_del_delay(void *data __UNUSED__) 19_cb_ct_del_delay(void *data __UNUSED__)
@@ -31,14 +33,14 @@ _cb_ct_del_delay(void *data __UNUSED__)
31static void 33static void
32_cb_ct_copy(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 34_cb_ct_copy(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
33{ 35{
34 controls_toggle(ct_win, ct_bg, ct_term); 36 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
35 termio_copy_clipboard(data); 37 termio_copy_clipboard(data);
36} 38}
37 39
38static void 40static void
39_cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 41_cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
40{ 42{
41 controls_toggle(ct_win, ct_bg, ct_term); 43 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
42 termio_paste_clipboard(data); 44 termio_paste_clipboard(data);
43} 45}
44 46
@@ -69,21 +71,21 @@ _cb_ct_close(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __U
69static void 71static void
70_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 72_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
71{ 73{
72 controls_toggle(ct_win, ct_bg, ct_term); 74 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
73 options_toggle(ct_win, ct_bg, ct_term); 75 options_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
74} 76}
75 77
76static void 78static void
77_cb_ct_about(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 79_cb_ct_about(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
78{ 80{
79 controls_toggle(ct_win, ct_bg, ct_term); 81 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
80 about_toggle(ct_win, ct_bg, ct_term); 82 about_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
81} 83}
82 84
83static void 85static void
84_cb_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) 86_cb_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
85{ 87{
86 controls_toggle(ct_win, ct_bg, ct_term); 88 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
87} 89}
88 90
89static void 91static void
@@ -93,7 +95,8 @@ _cb_saved_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUS
93 { 95 {
94 if (obj == ct_term) 96 if (obj == ct_term)
95 { 97 {
96 if (ct_out) controls_toggle(ct_win, ct_bg, ct_term); 98 if (ct_out)
99 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
97 ct_term = NULL; 100 ct_term = NULL;
98 } 101 }
99 else 102 else
@@ -146,7 +149,8 @@ _button_add(Evas_Object *win, const char *label, const char *icon, Evas_Smart_Cb
146} 149}
147 150
148void 151void
149controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term) 152controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
153 void (*donecb) (void *data), void *donedata)
150{ 154{
151 Evas_Object *o; 155 Evas_Object *o;
152 156
@@ -154,10 +158,15 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
154 { 158 {
155 if (options_active_get()) 159 if (options_active_get())
156 { 160 {
157 options_toggle(win, bg, term); 161 options_toggle(win, bg, term, ct_donecb, ct_donedata);
158 return; 162 return;
159 } 163 }
160 } 164 }
165 if ((win != ct_win) && (ct_frame))
166 {
167 evas_object_del(ct_frame);
168 ct_frame = NULL;
169 }
161 if (!ct_frame) 170 if (!ct_frame)
162 { 171 {
163 ct_frame = o = elm_frame_add(win); 172 ct_frame = o = elm_frame_add(win);
@@ -233,6 +242,8 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
233 ct_win = win; 242 ct_win = win;
234 ct_bg = bg; 243 ct_bg = bg;
235 ct_term = term; 244 ct_term = term;
245 ct_donecb = donecb;
246 ct_donedata = donedata;
236 edje_object_signal_emit(bg, "controls,show", "terminology"); 247 edje_object_signal_emit(bg, "controls,show", "terminology");
237 ct_out = EINA_TRUE; 248 ct_out = EINA_TRUE;
238 elm_object_focus_set(ct_frame, EINA_TRUE); 249 elm_object_focus_set(ct_frame, EINA_TRUE);
@@ -252,7 +263,8 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
252 edje_object_signal_emit(ct_bg, "controls,hide", "terminology"); 263 edje_object_signal_emit(ct_bg, "controls,hide", "terminology");
253 ct_out = EINA_FALSE; 264 ct_out = EINA_FALSE;
254 elm_object_focus_set(ct_frame, EINA_FALSE); 265 elm_object_focus_set(ct_frame, EINA_FALSE);
255 elm_object_focus_set(ct_term, EINA_TRUE); 266 if (ct_donecb) ct_donecb(ct_donedata);
267// elm_object_focus_set(ct_term, EINA_TRUE);
256 if (ct_del_timer) ecore_timer_del(ct_del_timer); 268 if (ct_del_timer) ecore_timer_del(ct_del_timer);
257 ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL); 269 ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
258 } 270 }