controls: always focus new button
if the terminal is unfocused, the layout is not allowed to get focus anymore. This way we ensure that cases where we have multiple ui elements overlapping cause problems.
This commit is contained in:
parent
c03b2b78e6
commit
4530839249
|
@ -19,6 +19,7 @@ typedef struct _Controls_Ctx {
|
||||||
Evas_Object *base;
|
Evas_Object *base;
|
||||||
Evas_Object *bg;
|
Evas_Object *bg;
|
||||||
Evas_Object *term;
|
Evas_Object *term;
|
||||||
|
Evas_Object *new_btn;
|
||||||
void (*donecb) (void *data);
|
void (*donecb) (void *data);
|
||||||
void *donedata;
|
void *donedata;
|
||||||
} Controls_Ctx;
|
} Controls_Ctx;
|
||||||
|
@ -351,13 +352,13 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
Evas_Object *ct_boxh, *ct_boxv, *ct_box, *ct_box2;
|
Evas_Object *ct_boxh, *ct_boxv, *ct_box, *ct_box2;
|
||||||
Controls_Ctx *ctx;
|
Controls_Ctx *ctx;
|
||||||
|
|
||||||
if (eina_hash_find(controls, &win) ||
|
ctx = eina_hash_find(controls, &win);
|
||||||
elm_layout_content_get(base, "terminology.controls"))
|
if (ctx)
|
||||||
{
|
{
|
||||||
donecb(donedata);
|
donecb(donedata);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ctx = malloc(sizeof(*ctx));
|
ctx = malloc(sizeof(*ctx));
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
ctx->win = win;
|
ctx->win = win;
|
||||||
|
@ -392,7 +393,7 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
o = _button_add(win, _("New"), "window-new",
|
o = _button_add(win, _("New"), "window-new",
|
||||||
_cb_ct_new, ctx);
|
_cb_ct_new, ctx);
|
||||||
elm_box_pack_end(ct_box, o);
|
elm_box_pack_end(ct_box, o);
|
||||||
elm_object_focus_set(o, EINA_TRUE);
|
ctx->new_btn=o;
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
o = _sep_add_h(win);
|
||||||
elm_box_pack_end(ct_box, o);
|
elm_box_pack_end(ct_box, o);
|
||||||
|
@ -483,10 +484,11 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
_cb_mouse_down, ctx);
|
_cb_mouse_down, ctx);
|
||||||
|
|
||||||
elm_layout_signal_emit(base, "controls,show", "terminology");
|
elm_layout_signal_emit(base, "controls,show", "terminology");
|
||||||
elm_object_focus_set(ctx->frame, EINA_TRUE);
|
|
||||||
evas_object_event_callback_add(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
evas_object_event_callback_add(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
||||||
evas_object_event_callback_add(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
evas_object_event_callback_add(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
||||||
}
|
}
|
||||||
|
elm_object_focus_set(ctx->new_btn, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
controls_init(void)
|
controls_init(void)
|
||||||
|
|
|
@ -1389,6 +1389,7 @@ _win_focus(Term_Container *tc, Term_Container *relative)
|
||||||
assert (tc->type == TERM_CONTAINER_TYPE_WIN);
|
assert (tc->type == TERM_CONTAINER_TYPE_WIN);
|
||||||
|
|
||||||
wn = (Win*) tc;
|
wn = (Win*) tc;
|
||||||
|
elm_object_focus_allow_set(wn->base, EINA_TRUE);
|
||||||
DBG("tc:%p tc->is_focused:%d from_child:%d",
|
DBG("tc:%p tc->is_focused:%d from_child:%d",
|
||||||
tc, tc->is_focused, wn->child == relative);
|
tc, tc->is_focused, wn->child == relative);
|
||||||
|
|
||||||
|
@ -1424,6 +1425,8 @@ _win_unfocus(Term_Container *tc, Term_Container *relative)
|
||||||
|
|
||||||
wn = (Win*) tc;
|
wn = (Win*) tc;
|
||||||
|
|
||||||
|
elm_object_focus_allow_set(wn->base, EINA_FALSE);
|
||||||
|
|
||||||
DBG("tc:%p tc->is_focused:%d from_child:%d",
|
DBG("tc:%p tc->is_focused:%d from_child:%d",
|
||||||
tc, tc->is_focused, wn->child == relative);
|
tc, tc->is_focused, wn->child == relative);
|
||||||
elm_win_keyboard_mode_set(wn->win, ELM_WIN_KEYBOARD_OFF);
|
elm_win_keyboard_mode_set(wn->win, ELM_WIN_KEYBOARD_OFF);
|
||||||
|
@ -7351,6 +7354,7 @@ _cb_options(void *data,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Term *term = data;
|
Term *term = data;
|
||||||
|
Term_Container *tc = term->container;
|
||||||
|
|
||||||
term->wn->on_popover++;
|
term->wn->on_popover++;
|
||||||
|
|
||||||
|
@ -7358,6 +7362,8 @@ _cb_options(void *data,
|
||||||
|
|
||||||
controls_show(term->wn->win, term->wn->base, term->bg_edj, term->termio,
|
controls_show(term->wn->win, term->wn->base, term->bg_edj, term->termio,
|
||||||
_cb_options_done, term);
|
_cb_options_done, term);
|
||||||
|
|
||||||
|
tc->unfocus(tc, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue