font sizing - listen to elm config change events and re-apply font size

re-applying font size (setting it) will take int account any new scale
value that may be set. this allows elementary_config or any config
tool that is updating config to change scaling and terminology
properly adapts. elementary itself for all widgets already takes care
of its own gui elements, but since the terminal grid is a custom thing
for terminology - it is responsible for doing this itself. now it
does.

@feat
This commit is contained in:
Carsten Haitzler 2020-11-24 09:18:52 +00:00
parent 3ad89d9db4
commit d9a5832bd6
1 changed files with 26 additions and 0 deletions

View File

@ -204,6 +204,7 @@ struct _Win
Evas_Object *cmdbox;
Ecore_Timer *cmdbox_del_timer;
Ecore_Timer *hide_cursor_timer;
Ecore_Event_Handler *config_elm_handler;
unsigned char focused : 1;
unsigned char cmdbox_up : 1;
unsigned char group_input : 1;
@ -1114,6 +1115,11 @@ win_free(Win *wn)
Term *term;
wins = eina_list_remove(wins, wn);
if (wn->config_elm_handler)
{
ecore_event_handler_del(wn->config_elm_handler);
wn->config_elm_handler = NULL;
}
EINA_LIST_FREE(wn->terms, term)
{
term_unref(term);
@ -2128,6 +2134,24 @@ _cb_win_mouse_move(void *data,
tc_child->focus(tc_child, tc);
}
static Eina_Bool
_config_font_size_set(Term *term, void *data EINA_UNUSED)
{
Config *config = termio_config_get(term->termio);
termio_font_size_set(term->termio, config->font.size);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_cb_elm_config_change(void *data, int event EINA_UNUSED, void *info EINA_UNUSED)
{
Win *wn = data;
for_each_term_do(wn, &_config_font_size_set, NULL);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_win_is_visible(const Term_Container *tc, const Term_Container *_child EINA_UNUSED)
{
@ -2314,6 +2338,8 @@ imf_done:
wn->tc.is_focused = EINA_TRUE;
wn->config_elm_handler = ecore_event_handler_add
(ELM_EVENT_CONFIG_ALL_CHANGED, _cb_elm_config_change, wn);
return wn;
}