win: handle title popup like the options popups. Closes T6727
This commit is contained in:
parent
71d9bc2f68
commit
2d5bc93780
|
@ -179,7 +179,8 @@ struct _Win
|
||||||
unsigned char group_input : 1;
|
unsigned char group_input : 1;
|
||||||
unsigned char group_only_visible : 1;
|
unsigned char group_only_visible : 1;
|
||||||
unsigned char group_once_handled : 1;
|
unsigned char group_once_handled : 1;
|
||||||
unsigned char on_options : 1;
|
|
||||||
|
unsigned int on_popover;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -556,7 +557,7 @@ _cb_win_focus_in(void *data,
|
||||||
tc->is_focused = EINA_TRUE;
|
tc->is_focused = EINA_TRUE;
|
||||||
if ((wn->cmdbox_up) && (wn->cmdbox))
|
if ((wn->cmdbox_up) && (wn->cmdbox))
|
||||||
elm_object_focus_set(wn->cmdbox, EINA_TRUE);
|
elm_object_focus_set(wn->cmdbox, EINA_TRUE);
|
||||||
if (wn->on_options)
|
if (wn->on_popover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
term = tc->focused_term_get(tc);
|
term = tc->focused_term_get(tc);
|
||||||
|
@ -1190,7 +1191,7 @@ term_preedit_str_get(Term *term)
|
||||||
Win *wn = term->wn;
|
Win *wn = term->wn;
|
||||||
Term_Container *tc = (Term_Container*) wn;
|
Term_Container *tc = (Term_Container*) wn;
|
||||||
|
|
||||||
if (wn->on_options)
|
if (wn->on_popover)
|
||||||
return NULL;
|
return NULL;
|
||||||
tc = (Term_Container*) wn;
|
tc = (Term_Container*) wn;
|
||||||
term = tc->focused_term_get(tc);
|
term = tc->focused_term_get(tc);
|
||||||
|
@ -1307,7 +1308,7 @@ _cb_win_key_down(void *data,
|
||||||
DBG("GROUP key down (%p) (ctrl:%d)",
|
DBG("GROUP key down (%p) (ctrl:%d)",
|
||||||
wn, evas_key_modifier_is_set(ev->modifiers, "Control"));
|
wn, evas_key_modifier_is_set(ev->modifiers, "Control"));
|
||||||
|
|
||||||
if (wn->on_options)
|
if (wn->on_popover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
||||||
|
@ -1536,7 +1537,7 @@ _cb_win_mouse_down(void *data,
|
||||||
Term_Container *tc = (Term_Container*) wn;
|
Term_Container *tc = (Term_Container*) wn;
|
||||||
Term_Container *tc_child;
|
Term_Container *tc_child;
|
||||||
|
|
||||||
if (wn->on_options || wn->group_input)
|
if (wn->on_popover || wn->group_input)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
term_mouse = tc->find_term_at_coords(tc, ev->canvas.x, ev->canvas.y);
|
term_mouse = tc->find_term_at_coords(tc, ev->canvas.x, ev->canvas.y);
|
||||||
|
@ -1566,7 +1567,7 @@ _cb_win_mouse_move(void *data,
|
||||||
Term_Container *tc = (Term_Container*) wn;
|
Term_Container *tc = (Term_Container*) wn;
|
||||||
Term_Container *tc_child = NULL;
|
Term_Container *tc_child = NULL;
|
||||||
|
|
||||||
if (wn->on_options || wn->group_input)
|
if (wn->on_popover || wn->group_input)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!wn->config->mouse_over_focus)
|
if (!wn->config->mouse_over_focus)
|
||||||
|
@ -4232,6 +4233,29 @@ term_miniview_toggle(Term *term)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_on_popover_done(Win *wn)
|
||||||
|
{
|
||||||
|
Term_Container *tc = (Term_Container*) wn;
|
||||||
|
Eina_List *l;
|
||||||
|
Term *term;
|
||||||
|
|
||||||
|
wn->on_popover--;
|
||||||
|
if (wn->on_popover)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_win_is_focused(wn))
|
||||||
|
return;
|
||||||
|
EINA_LIST_FOREACH(wn->terms, l, term)
|
||||||
|
{
|
||||||
|
DBG("is focused? tc:%p", term->container);
|
||||||
|
if (_term_is_focused(term))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DBG("focus tc:%p", tc);
|
||||||
|
tc->focus(tc, tc);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_set_title_ok_cb(void *data,
|
_set_title_ok_cb(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
@ -4246,9 +4270,8 @@ _set_title_ok_cb(void *data,
|
||||||
title = NULL;
|
title = NULL;
|
||||||
|
|
||||||
termio_title_set(term->termio, title);
|
termio_title_set(term->termio, title);
|
||||||
evas_object_del(popup);
|
elm_object_focus_set(entry, EINA_FALSE);
|
||||||
elm_object_focus_set(term->termio, EINA_TRUE);
|
elm_popup_dismiss(popup);
|
||||||
term_unref(term);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4257,10 +4280,23 @@ _set_title_cancel_cb(void *data,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *popup = data;
|
Evas_Object *popup = data;
|
||||||
Term *term = evas_object_data_get(popup, "term");
|
Evas_Object *entry = elm_object_content_get(popup);
|
||||||
|
|
||||||
|
elm_object_focus_set(entry, EINA_FALSE);
|
||||||
|
elm_popup_dismiss(popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_title_popup_hide(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Term *term = data;
|
||||||
|
Win *wn = term->wn;
|
||||||
|
|
||||||
|
_on_popover_done(wn);
|
||||||
|
|
||||||
evas_object_del(data);
|
|
||||||
elm_object_focus_set(term->termio, EINA_TRUE);
|
|
||||||
term_unref(term);
|
term_unref(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4269,13 +4305,19 @@ term_set_title(Term *term)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Object *popup;
|
Evas_Object *popup;
|
||||||
|
Term_Container *tc = term->container;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(term);
|
EINA_SAFETY_ON_NULL_RETURN(term);
|
||||||
|
term->wn->on_popover++;
|
||||||
|
|
||||||
term_ref(term);
|
term_ref(term);
|
||||||
|
tc->unfocus(tc, NULL);
|
||||||
|
|
||||||
popup = elm_popup_add(term->wn->win);
|
popup = elm_popup_add(term->wn->win);
|
||||||
evas_object_data_set(popup, "term", term);
|
evas_object_data_set(popup, "term", term);
|
||||||
|
evas_object_event_callback_add(popup, EVAS_CALLBACK_HIDE,
|
||||||
|
_cb_title_popup_hide, term);
|
||||||
|
|
||||||
elm_object_part_text_set(popup, "title,text", _("Set title"));
|
elm_object_part_text_set(popup, "title,text", _("Set title"));
|
||||||
|
|
||||||
o = elm_button_add(popup);
|
o = elm_button_add(popup);
|
||||||
|
@ -4293,7 +4335,9 @@ term_set_title(Term *term)
|
||||||
evas_object_smart_callback_add(o, "activated", _set_title_ok_cb, popup);
|
evas_object_smart_callback_add(o, "activated", _set_title_ok_cb, popup);
|
||||||
evas_object_smart_callback_add(o, "aborted", _set_title_cancel_cb, popup);
|
evas_object_smart_callback_add(o, "aborted", _set_title_cancel_cb, popup);
|
||||||
elm_object_content_set(popup, o);
|
elm_object_content_set(popup, o);
|
||||||
|
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
evas_object_show(popup);
|
evas_object_show(popup);
|
||||||
|
|
||||||
elm_object_focus_set(o, EINA_TRUE);
|
elm_object_focus_set(o, EINA_TRUE);
|
||||||
|
@ -5411,26 +5455,9 @@ _cb_options_done(void *data)
|
||||||
{
|
{
|
||||||
Term *orig_term = data;
|
Term *orig_term = data;
|
||||||
Win *wn = orig_term->wn;
|
Win *wn = orig_term->wn;
|
||||||
Term_Container *tc = (Term_Container*) wn;
|
|
||||||
Eina_List *l;
|
|
||||||
Term *term;
|
|
||||||
|
|
||||||
wn->on_options = EINA_FALSE;
|
_on_popover_done(wn);
|
||||||
|
|
||||||
if (!_win_is_focused(wn))
|
|
||||||
goto end;
|
|
||||||
EINA_LIST_FOREACH(wn->terms, l, term)
|
|
||||||
{
|
|
||||||
DBG("is focused? tc:%p", term->container);
|
|
||||||
if (_term_is_focused(term))
|
|
||||||
{
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DBG("focus tc:%p", tc);
|
|
||||||
tc->focus(tc, tc);
|
|
||||||
|
|
||||||
end:
|
|
||||||
term_unref(orig_term);
|
term_unref(orig_term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5442,7 +5469,7 @@ _cb_options(void *data,
|
||||||
Term *term = data;
|
Term *term = data;
|
||||||
Term_Container *tc = term->container;
|
Term_Container *tc = term->container;
|
||||||
|
|
||||||
term->wn->on_options = EINA_TRUE;
|
term->wn->on_popover++;
|
||||||
|
|
||||||
term_ref(term);
|
term_ref(term);
|
||||||
tc->unfocus(tc, NULL);
|
tc->unfocus(tc, NULL);
|
||||||
|
|
Loading…
Reference in New Issue