summaryrefslogtreecommitdiff
path: root/src/bin/options_font.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-12-23 12:19:40 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-12-23 12:19:40 +0000
commit7720a2e4f05d1ff130c337f7344957af5eccb109 (patch)
treed0b30a6a2eb671363b40a0ea7056439ba580b6db /src/bin/options_font.c
parent20ce6a52f6afd6ba4f3e80d7ad806899b53e5f0d (diff)
make fonts delay loaded .. with soem randomness so they dont batch all
at once... SVN revision: 81658
Diffstat (limited to 'src/bin/options_font.c')
-rw-r--r--src/bin/options_font.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index af578a0..efe63e3 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -89,21 +89,27 @@ _cb_op_font_preview_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *
89} 89}
90 90
91static void 91static void
92_cb_op_font_preview_eval(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__) 92_cb_op_font_preview_delayed_eval(void *data)
93{ 93{
94 Font *f = data; 94 Evas_Object *obj = data;
95 Font *f;
95 Evas_Object *o; 96 Evas_Object *o;
96 Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh; 97 Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
97 Config *config = termio_config_get(f->term); 98 Config *config;
98 char buf[4096];
99 99
100 if (!evas_object_visible_get(obj)) return; 100 if (!evas_object_visible_get(obj)) goto done;
101 if (edje_object_part_swallow_get(obj, "terminology.text.preview")) return; 101 if (edje_object_part_swallow_get(obj, "terminology.text.preview")) goto done;
102 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); 102 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
103 if ((ow < 2) || (oh < 2)) return; 103 if ((ow < 2) || (oh < 2)) goto done;
104 evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh); 104 evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
105 f = evas_object_data_get(obj, "font");
106 if (!f) goto done;
107 config = termio_config_get(f->term);
108 if (!config) goto done;
105 if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh)) 109 if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
106 { 110 {
111 char buf[4096];
112
107 o = evas_object_text_add(evas_object_evas_get(obj)); 113 o = evas_object_text_add(evas_object_evas_get(obj));
108 evas_object_color_set(o, 0, 0, 0, 255); 114 evas_object_color_set(o, 0, 0, 0, 255);
109 evas_object_text_text_set(o, TEST_STRING); 115 evas_object_text_text_set(o, TEST_STRING);
@@ -120,6 +126,34 @@ _cb_op_font_preview_eval(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
120 evas_object_size_hint_min_set(o, ow, oh); 126 evas_object_size_hint_min_set(o, ow, oh);
121 edje_object_part_swallow(obj, "terminology.text.preview", o); 127 edje_object_part_swallow(obj, "terminology.text.preview", o);
122 } 128 }
129done:
130 evas_object_data_del(obj, "delay");
131 return EINA_FALSE;
132}
133
134static void
135_cb_op_font_preview_eval(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
136{
137 Font *f = data;
138 Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
139
140 if (!evas_object_visible_get(obj)) return;
141 if (edje_object_part_swallow_get(obj, "terminology.text.preview")) return;
142 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
143 if ((ow < 2) || (oh < 2)) return;
144 evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
145 if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
146 {
147 Ecore_Timer *timer;
148 double rnd = 0.2;
149
150 timer = evas_object_data_get(obj, "delay");
151 if (timer) return;
152 else evas_object_data_set(obj, "font", f);
153 rnd += (double)(rand() % 100) / 500.0;
154 timer = ecore_timer_add(rnd, _cb_op_font_preview_delayed_eval, obj);
155 evas_object_data_set(obj, "delay", timer);
156 }
123} 157}
124 158
125 159