aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-07-14 22:10:54 +0200
committerBoris Faure <billiob@gmail.com>2017-07-14 22:10:54 +0200
commite7b3265662cb122a401c2e6e49cdac985e4d6d0d (patch)
tree94fdb43a5bc0196e3025605363d868c3752f8d4d
parenttycommon: add "directly" to "not running in terminology" (diff)
downloadterminology-e7b3265662cb122a401c2e6e49cdac985e4d6d0d.tar.gz
font: update all terms to this window when changing font (size)
-rw-r--r--src/bin/options_font.c11
-rw-r--r--src/bin/termio.c20
-rw-r--r--src/bin/termio.h1
-rw-r--r--src/bin/win.c15
-rw-r--r--src/bin/win.h4
5 files changed, 45 insertions, 6 deletions
diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index ab13185..f856c71 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -134,6 +134,8 @@ _cb_op_font_sel(void *data,
{
Font *f = data;
Config *config = termio_config_get(f->term);
+ Term *term = termio_term_get(f->term);
+
if ((config->font.name) && (!strcmp(f->full_name, config->font.name)))
return;
if (config->font.name) eina_stringshare_del(config->font.name);
@@ -144,6 +146,7 @@ _cb_op_font_sel(void *data,
elm_object_disabled_set(op_fontslider, f->bitmap);
elm_object_disabled_set(op_fbig, f->bitmap);
config_save(config, NULL);
+ win_font_update(term);
}
static void
@@ -151,15 +154,17 @@ _cb_op_fontsize_sel(void *data,
Evas_Object *obj,
void *_event EINA_UNUSED)
{
- Evas_Object *term = data;
- Config *config = termio_config_get(term);
+ Evas_Object *termio_obj = data;
+ Config *config = termio_config_get(termio_obj);
+ Term *term = termio_term_get(termio_obj);
int size = elm_slider_value_get(obj) + 0.5;
if (config->font.size == size) return;
config->font.size = size;
- _update_sizing(term);
+ _update_sizing(termio_obj);
elm_genlist_realized_items_update(op_fontlist);
config_save(config, NULL);
+ win_font_update(term);
}
static int
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 04dd187..6e3d797 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -465,7 +465,7 @@ _font_size_set(Evas_Object *obj, int size)
if (size < 5) size = 5;
else if (size > 100) size = 100;
- if (config && config->font.size != size)
+ if (config)
{
config->temporary = EINA_TRUE;
config->font.size = size;
@@ -477,6 +477,24 @@ _font_size_set(Evas_Object *obj, int size)
}
void
+termio_font_update(Evas_Object *obj)
+{
+ Termio *sd = evas_object_smart_data_get(obj);
+ Config *config;
+ EINA_SAFETY_ON_NULL_RETURN(sd);
+
+ config = sd->config;
+
+ if (config)
+ {
+ sd->noreqsize = 1;
+ termio_config_update(obj);
+ sd->noreqsize = 0;
+ evas_object_data_del(obj, "sizedone");
+ }
+}
+
+void
termio_font_size_set(Evas_Object *obj, int size)
{
_font_size_set(obj, size);
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 02cb616..049e389 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -21,6 +21,7 @@ void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y);
void termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int n);
void termio_config_update(Evas_Object *obj);
+void termio_font_update(Evas_Object *obj);
Config *termio_config_get(const Evas_Object *obj);
Eina_Bool termio_take_selection(Evas_Object *obj, Elm_Sel_Type);
void termio_paste_selection(Evas_Object *obj, Elm_Sel_Type);
diff --git a/src/bin/win.c b/src/bin/win.c
index 0c8893e..476f9c4 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -4616,6 +4616,21 @@ win_font_size_set(Win *wn, int new_size)
for_each_term_do(wn, &_font_size_set, (void*)(intptr_t)new_size);
}
+static Eina_Bool
+_font_update(Term *term, void *_data EINA_UNUSED)
+{
+ termio_font_update(term->termio);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+void
+win_font_update(Term *term)
+{
+ Win *wn = term->wn;
+ for_each_term_do(wn, &_font_update, NULL);
+}
+
void
windows_free(void)
{
diff --git a/src/bin/win.h b/src/bin/win.h
index 5096175..b44fb25 100644
--- a/src/bin/win.h
+++ b/src/bin/win.h
@@ -59,8 +59,8 @@ void term_down(Term *term);
void term_left(Term *term);
void term_right(Term *term);
-void
-win_font_size_set(Win *wn, int new_size);
+void win_font_size_set(Win *wn, int new_size);
+void win_font_update(Term *term);
Eina_Bool
term_has_popmedia(const Term *term);