fix focus restoration when creating new tabs or splits by allowing cb
to restore it.
This commit is contained in:
parent
450d271627
commit
86b0d64c54
|
@ -10,6 +10,8 @@ static Eina_Bool ab_out = EINA_FALSE;
|
||||||
static Ecore_Timer *ab_del_timer = NULL;
|
static Ecore_Timer *ab_del_timer = NULL;
|
||||||
static Evas_Object *saved_win = NULL;
|
static Evas_Object *saved_win = NULL;
|
||||||
static Evas_Object *saved_bg = NULL;
|
static Evas_Object *saved_bg = NULL;
|
||||||
|
static void (*ab_donecb) (void *data) = NULL;
|
||||||
|
static void *ab_donedata = NULL;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_ab_del_delay(void *data __UNUSED__)
|
_cb_ab_del_delay(void *data __UNUSED__)
|
||||||
|
@ -24,11 +26,12 @@ _cb_ab_del_delay(void *data __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||||
{
|
{
|
||||||
about_toggle(saved_win, saved_bg, data);
|
about_toggle(saved_win, saved_bg, data, ab_donecb, ab_donedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
|
||||||
|
@ -122,6 +125,8 @@ about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
edje_object_signal_emit(bg, "about,show", "terminology");
|
edje_object_signal_emit(bg, "about,show", "terminology");
|
||||||
elm_object_signal_emit(ab_layout, "begin" ,"terminology");
|
elm_object_signal_emit(ab_layout, "begin" ,"terminology");
|
||||||
ab_out = EINA_TRUE;
|
ab_out = EINA_TRUE;
|
||||||
|
ab_donecb = donecb;
|
||||||
|
ab_donedata = donedata;
|
||||||
elm_object_focus_set(ab_layout, EINA_TRUE);
|
elm_object_focus_set(ab_layout, EINA_TRUE);
|
||||||
if (ab_del_timer)
|
if (ab_del_timer)
|
||||||
{
|
{
|
||||||
|
@ -137,7 +142,8 @@ about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
edje_object_signal_emit(bg, "about,hide", "terminology");
|
edje_object_signal_emit(bg, "about,hide", "terminology");
|
||||||
ab_out = EINA_FALSE;
|
ab_out = EINA_FALSE;
|
||||||
elm_object_focus_set(ab_layout, EINA_FALSE);
|
elm_object_focus_set(ab_layout, EINA_FALSE);
|
||||||
elm_object_focus_set(term, EINA_TRUE);
|
if (ab_donecb) ab_donecb(ab_donedata);
|
||||||
|
// elm_object_focus_set(term, EINA_TRUE);
|
||||||
if (ab_del_timer) ecore_timer_del(ab_del_timer);
|
if (ab_del_timer) ecore_timer_del(ab_del_timer);
|
||||||
ab_del_timer = ecore_timer_add(10.0, _cb_ab_del_delay, NULL);
|
ab_del_timer = ecore_timer_add(10.0, _cb_ab_del_delay, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
void about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term);
|
void about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata);
|
||||||
|
|
|
@ -12,6 +12,8 @@ static Evas_Object *ct_box2 = NULL, *ct_over = NULL;
|
||||||
static Eina_Bool ct_out = EINA_FALSE;
|
static Eina_Bool ct_out = EINA_FALSE;
|
||||||
static Ecore_Timer *ct_del_timer = NULL;
|
static Ecore_Timer *ct_del_timer = NULL;
|
||||||
static Evas_Object *ct_win = NULL, *ct_bg = NULL, *ct_term = NULL;
|
static Evas_Object *ct_win = NULL, *ct_bg = NULL, *ct_term = NULL;
|
||||||
|
static void (*ct_donecb) (void *data) = NULL;
|
||||||
|
static void *ct_donedata = NULL;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_ct_del_delay(void *data __UNUSED__)
|
_cb_ct_del_delay(void *data __UNUSED__)
|
||||||
|
@ -31,14 +33,14 @@ _cb_ct_del_delay(void *data __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_cb_ct_copy(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_ct_copy(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term);
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
termio_copy_clipboard(data);
|
termio_copy_clipboard(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term);
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
termio_paste_clipboard(data);
|
termio_paste_clipboard(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,21 +71,21 @@ _cb_ct_close(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __U
|
||||||
static void
|
static void
|
||||||
_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term);
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
options_toggle(ct_win, ct_bg, ct_term);
|
options_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_about(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_ct_about(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term);
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
about_toggle(ct_win, ct_bg, ct_term);
|
about_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
_cb_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term);
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -93,7 +95,8 @@ _cb_saved_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUS
|
||||||
{
|
{
|
||||||
if (obj == ct_term)
|
if (obj == ct_term)
|
||||||
{
|
{
|
||||||
if (ct_out) controls_toggle(ct_win, ct_bg, ct_term);
|
if (ct_out)
|
||||||
|
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
||||||
ct_term = NULL;
|
ct_term = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -146,7 +149,8 @@ _button_add(Evas_Object *win, const char *label, const char *icon, Evas_Smart_Cb
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
|
||||||
|
@ -154,10 +158,15 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
{
|
{
|
||||||
if (options_active_get())
|
if (options_active_get())
|
||||||
{
|
{
|
||||||
options_toggle(win, bg, term);
|
options_toggle(win, bg, term, ct_donecb, ct_donedata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((win != ct_win) && (ct_frame))
|
||||||
|
{
|
||||||
|
evas_object_del(ct_frame);
|
||||||
|
ct_frame = NULL;
|
||||||
|
}
|
||||||
if (!ct_frame)
|
if (!ct_frame)
|
||||||
{
|
{
|
||||||
ct_frame = o = elm_frame_add(win);
|
ct_frame = o = elm_frame_add(win);
|
||||||
|
@ -233,6 +242,8 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
ct_win = win;
|
ct_win = win;
|
||||||
ct_bg = bg;
|
ct_bg = bg;
|
||||||
ct_term = term;
|
ct_term = term;
|
||||||
|
ct_donecb = donecb;
|
||||||
|
ct_donedata = donedata;
|
||||||
edje_object_signal_emit(bg, "controls,show", "terminology");
|
edje_object_signal_emit(bg, "controls,show", "terminology");
|
||||||
ct_out = EINA_TRUE;
|
ct_out = EINA_TRUE;
|
||||||
elm_object_focus_set(ct_frame, EINA_TRUE);
|
elm_object_focus_set(ct_frame, EINA_TRUE);
|
||||||
|
@ -252,7 +263,8 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
edje_object_signal_emit(ct_bg, "controls,hide", "terminology");
|
edje_object_signal_emit(ct_bg, "controls,hide", "terminology");
|
||||||
ct_out = EINA_FALSE;
|
ct_out = EINA_FALSE;
|
||||||
elm_object_focus_set(ct_frame, EINA_FALSE);
|
elm_object_focus_set(ct_frame, EINA_FALSE);
|
||||||
elm_object_focus_set(ct_term, EINA_TRUE);
|
if (ct_donecb) ct_donecb(ct_donedata);
|
||||||
|
// elm_object_focus_set(ct_term, EINA_TRUE);
|
||||||
if (ct_del_timer) ecore_timer_del(ct_del_timer);
|
if (ct_del_timer) ecore_timer_del(ct_del_timer);
|
||||||
ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
|
ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
void controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term);
|
void controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata);
|
||||||
|
|
||||||
|
|
|
@ -854,12 +854,27 @@ _cb_size_hint(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UN
|
||||||
term->wn->size_job = ecore_job_add(_size_job, term->wn);
|
term->wn->size_job = ecore_job_add(_size_job, term->wn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_options_done(void *data)
|
||||||
|
{
|
||||||
|
Win *wn = data;
|
||||||
|
Eina_List *l;
|
||||||
|
Term *term;
|
||||||
|
|
||||||
|
if (!wn->focused) return;
|
||||||
|
EINA_LIST_FOREACH(wn->terms, l, term)
|
||||||
|
{
|
||||||
|
if (term->focused) elm_object_focus_set(term->term, EINA_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_options(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_options(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
{
|
{
|
||||||
Term *term = data;
|
Term *term = data;
|
||||||
|
|
||||||
controls_toggle(term->wn->win, term->wn->base, term->term);
|
controls_toggle(term->wn->win, term->wn->base, term->term,
|
||||||
|
_cb_options_done, term->wn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
|
@ -19,6 +19,8 @@ static Eina_Bool op_out = EINA_FALSE;
|
||||||
static Ecore_Timer *op_del_timer = NULL;
|
static Ecore_Timer *op_del_timer = NULL;
|
||||||
static Evas_Object *saved_win = NULL;
|
static Evas_Object *saved_win = NULL;
|
||||||
static Evas_Object *saved_bg = NULL;
|
static Evas_Object *saved_bg = NULL;
|
||||||
|
static void (*op_donecb) (void *data) = NULL;
|
||||||
|
static void *op_donedata = NULL;
|
||||||
static int mode = -1;
|
static int mode = -1;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -101,7 +103,7 @@ _cb_op_del_delay(void *data __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||||
{
|
{
|
||||||
options_toggle(saved_win, saved_bg, data);
|
options_toggle(saved_win, saved_bg, data, op_donecb, op_donedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -123,7 +125,8 @@ _cb_opdt_hide_done(void *data, Evas_Object *obj __UNUSED__, const char *sig __UN
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
|
||||||
|
@ -218,6 +221,8 @@ options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
|
|
||||||
edje_object_signal_emit(bg, "options,show", "terminology");
|
edje_object_signal_emit(bg, "options,show", "terminology");
|
||||||
op_out = EINA_TRUE;
|
op_out = EINA_TRUE;
|
||||||
|
op_donecb = donecb;
|
||||||
|
op_donedata = donedata;
|
||||||
elm_object_focus_set(op_toolbar, EINA_TRUE);
|
elm_object_focus_set(op_toolbar, EINA_TRUE);
|
||||||
if (op_del_timer)
|
if (op_del_timer)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +241,8 @@ options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
|
||||||
edje_object_signal_emit(bg, "optdetails,hide", "terminology");
|
edje_object_signal_emit(bg, "optdetails,hide", "terminology");
|
||||||
op_out = EINA_FALSE;
|
op_out = EINA_FALSE;
|
||||||
elm_object_focus_set(op_frame, EINA_FALSE);
|
elm_object_focus_set(op_frame, EINA_FALSE);
|
||||||
elm_object_focus_set(term, EINA_TRUE);
|
if (op_donecb) op_donecb(op_donedata);
|
||||||
|
// elm_object_focus_set(term, EINA_TRUE);
|
||||||
if (op_del_timer) ecore_timer_del(op_del_timer);
|
if (op_del_timer) ecore_timer_del(op_del_timer);
|
||||||
op_del_timer = ecore_timer_add(10.0, _cb_op_del_delay, NULL);
|
op_del_timer = ecore_timer_add(10.0, _cb_op_del_delay, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
void options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term);
|
void options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata);
|
||||||
Eina_Bool options_active_get(void);
|
Eina_Bool options_active_get(void);
|
||||||
|
|
Loading…
Reference in New Issue