raster pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=d9a5832bd6f2c37144fae4b5f8783355fba8c747

commit d9a5832bd6f2c37144fae4b5f8783355fba8c747
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Tue Nov 24 09:18:52 2020 +0000

    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
---
 src/bin/win.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/bin/win.c b/src/bin/win.c
index 7c01728..b390963 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -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;
 }
 

-- 


Reply via email to