Compare commits

...

1 Commits

Author SHA1 Message Date
Marcel Hollerbach e800a57821 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.
2020-12-09 10:40:59 +01:00
2 changed files with 111 additions and 104 deletions

View File

@ -19,6 +19,7 @@ typedef struct _Controls_Ctx {
Evas_Object *base;
Evas_Object *bg;
Evas_Object *term;
Evas_Object *new_btn;
void (*donecb) (void *data);
void *donedata;
} 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;
Controls_Ctx *ctx;
if (eina_hash_find(controls, &win) ||
elm_layout_content_get(base, "terminology.controls"))
ctx = eina_hash_find(controls, &win);
if (ctx)
{
donecb(donedata);
return;
}
else
{
ctx = malloc(sizeof(*ctx));
assert(ctx);
ctx->win = win;
@ -392,6 +393,7 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
o = _button_add(win, _("New"), "window-new",
_cb_ct_new, ctx);
elm_box_pack_end(ct_box, o);
ctx->new_btn=o;
o = _sep_add_h(win);
elm_box_pack_end(ct_box, o);
@ -482,10 +484,11 @@ controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
_cb_mouse_down, ctx);
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->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
}
elm_object_focus_set(ctx->new_btn, EINA_TRUE);
}
void
controls_init(void)

View File

@ -1379,6 +1379,7 @@ _win_focus(Term_Container *tc, Term_Container *relative)
assert (tc->type == TERM_CONTAINER_TYPE_WIN);
wn = (Win*) tc;
elm_object_focus_allow_set(wn->base, EINA_TRUE);
DBG("tc:%p tc->is_focused:%d from_child:%d",
tc, tc->is_focused, wn->child == relative);
@ -1414,6 +1415,8 @@ _win_unfocus(Term_Container *tc, Term_Container *relative)
wn = (Win*) tc;
elm_object_focus_allow_set(wn->base, EINA_FALSE);
DBG("tc:%p tc->is_focused:%d from_child:%d",
tc, tc->is_focused, wn->child == relative);
elm_win_keyboard_mode_set(wn->win, ELM_WIN_KEYBOARD_OFF);
@ -7304,10 +7307,11 @@ _cb_options(void *data,
term->wn->on_popover++;
term_ref(term);
tc->unfocus(tc, NULL);
controls_show(term->wn->win, term->wn->base, term->bg_edj, term->termio,
_cb_options_done, term);
tc->unfocus(tc, NULL);
}
void