summaryrefslogtreecommitdiff
path: root/src/bin/options_font.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-07-02 12:06:44 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-07-02 12:06:44 +0000
commit4fd2814c02e21c40b92bb2b47477a2c410d7d52b (patch)
treee3c63cc3913810c6ed138477318c714e32cc15b2 /src/bin/options_font.c
parent5ecbbb7f2315650b13a1b41b94aee20a3f003f3c (diff)
avoid size creep during font options changes by remembering size at
start and any "suspected" real resizing by the user. SVN revision: 73156
Diffstat (limited to 'src/bin/options_font.c')
-rw-r--r--src/bin/options_font.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index 4f4b644..5c93e2a 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -21,22 +21,24 @@ struct _Font
21 21
22static Eina_List *fonts = NULL; 22static Eina_List *fonts = NULL;
23static Eina_Hash *fonthash = NULL; 23static Eina_Hash *fonthash = NULL;
24static Evas_Coord tsize_w = 0, tsize_h = 0;
25static int expecting_resize = 0;
24 26
25static void 27static void
26_update_sizing(Evas_Object *term) 28_update_sizing(Evas_Object *term)
27{ 29{
28 Evas_Coord ow = 0, oh = 0, mw = 1, mh = 1, w, h; 30 Evas_Coord mw = 1, mh = 1, w, h;
29 31
30 evas_object_data_del(term, "sizedone"); 32 evas_object_data_del(term, "sizedone");
31 termio_config_update(term); 33 termio_config_update(term);
32 evas_object_geometry_get(term, NULL, NULL, &ow, &oh);
33 evas_object_size_hint_min_get(term, &mw, &mh); 34 evas_object_size_hint_min_get(term, &mw, &mh);
34 if (mw < 1) mw = 1; 35 if (mw < 1) mw = 1;
35 if (mh < 1) mh = 1; 36 if (mh < 1) mh = 1;
36 w = ow / mw; 37 w = tsize_w / mw;
37 h = oh / mh; 38 h = tsize_h / mh;
38 evas_object_data_del(term, "sizedone"); 39 evas_object_data_del(term, "sizedone");
39 evas_object_size_hint_request_set(term, w * mw, h * mh); 40 evas_object_size_hint_request_set(term, w * mw, h * mh);
41 expecting_resize = 1;
40} 42}
41 43
42static void 44static void
@@ -166,6 +168,26 @@ _cb_op_font_group_text_get(void *data, Evas_Object *obj __UNUSED__, const char *
166 return strdup(data); 168 return strdup(data);
167} 169}
168 170
171static void
172_cb_term_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
173{
174 Evas_Object *term = data;
175 if (expecting_resize)
176 {
177 expecting_resize = 0;
178 return;
179 }
180 evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
181}
182
183static void
184_cb_font_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
185{
186 Evas_Object *term = data;
187 evas_object_event_callback_del_full(term, EVAS_CALLBACK_RESIZE,
188 _cb_term_resize, term);
189}
190
169void 191void
170options_font_clear(void) 192options_font_clear(void)
171{ 193{
@@ -331,4 +353,11 @@ options_font(Evas_Object *opbox, Evas_Object *term)
331 evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 353 evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
332 evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 354 evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
333 evas_object_show(o); 355 evas_object_show(o);
356
357 expecting_resize = 0;
358 evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
359 evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
360 _cb_term_resize, term);
361 evas_object_event_callback_add(opbox, EVAS_CALLBACK_DEL,
362 _cb_font_del, term);
334} 363}