summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-27 23:24:12 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-27 23:24:12 +0900
commitbcbc26371076f8580c7ff5dc937131e4a1f19d62 (patch)
treefd2205e5e965852949cc918fbc0b0bb95607d933
parentf80f73a7c9cf663ccb3db9634a72d7fcc294bd90 (diff)
Revert "e widget bgpreview - stop using livethumb as it cuases performance issues"
This reverts commit f80f73a7c9cf663ccb3db9634a72d7fcc294bd90.
-rw-r--r--src/bin/e_widget_bgpreview.c59
1 files changed, 56 insertions, 3 deletions
diff --git a/src/bin/e_widget_bgpreview.c b/src/bin/e_widget_bgpreview.c
index a9b5c2d02..f66eb8063 100644
--- a/src/bin/e_widget_bgpreview.c
+++ b/src/bin/e_widget_bgpreview.c
@@ -10,7 +10,7 @@ struct _E_Widget_Data
10typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data; 10typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data;
11struct _E_Widget_Desk_Data 11struct _E_Widget_Desk_Data
12{ 12{
13 Evas_Object *icon, *live, *cont; 13 Evas_Object *icon, *thumb, *live, *cont;
14 int zone, x, y; 14 int zone, x, y;
15 Ecore_Event_Handler *bg_upd_hdl; 15 Ecore_Event_Handler *bg_upd_hdl;
16 Ecore_Job *resize_job; 16 Ecore_Job *resize_job;
@@ -19,6 +19,7 @@ struct _E_Widget_Desk_Data
19 19
20/* local function prototypes */ 20/* local function prototypes */
21static void _e_wid_data_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); 21static void _e_wid_data_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
22static void _e_wid_livethumb_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
22static void _e_wid_del_hook(Evas_Object *obj); 23static void _e_wid_del_hook(Evas_Object *obj);
23static void _e_wid_reconfigure(E_Widget_Data *wd); 24static void _e_wid_reconfigure(E_Widget_Data *wd);
24static void _e_wid_desk_cb_config(void *data, Evas *evas, Evas_Object *obj, void *event); 25static void _e_wid_desk_cb_config(void *data, Evas *evas, Evas_Object *obj, void *event);
@@ -97,9 +98,12 @@ e_widget_bgpreview_desk_add(Evas *e, E_Zone *zone, int x, int y)
97 98
98 if (eina_str_has_extension(bgfile, ".edj")) 99 if (eina_str_has_extension(bgfile, ".edj"))
99 { 100 {
100 dd->live = o = edje_object_add(e); 101 dd->live = e_livethumb_add(e);
102 dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live));
101 edje_object_file_set(o, bgfile, "e/desktop/background"); 103 edje_object_file_set(o, bgfile, "e/desktop/background");
102 _bgpreview_viewport_update(o, zone, x, y); 104 _bgpreview_viewport_update(o, zone, x, y);
105 e_livethumb_thumb_set(dd->live, o);
106 evas_object_show(dd->thumb);
103 } 107 }
104 else if ((eina_str_has_extension(bgfile, ".gif")) || 108 else if ((eina_str_has_extension(bgfile, ".gif")) ||
105 (eina_str_has_extension(bgfile, ".png")) || 109 (eina_str_has_extension(bgfile, ".png")) ||
@@ -124,6 +128,7 @@ e_widget_bgpreview_desk_add(Evas *e, E_Zone *zone, int x, int y)
124 128
125 evas_object_data_set(dd->cont, "desk_data", dd); 129 evas_object_data_set(dd->cont, "desk_data", dd);
126 evas_object_event_callback_add(dd->cont, EVAS_CALLBACK_DEL, _e_wid_data_del, dd); 130 evas_object_event_callback_add(dd->cont, EVAS_CALLBACK_DEL, _e_wid_data_del, dd);
131 evas_object_event_callback_add(dd->cont, EVAS_CALLBACK_RESIZE, _e_wid_livethumb_resize, dd);
127 132
128 dd->bg_upd_hdl = ecore_event_handler_add(E_EVENT_BG_UPDATE, 133 dd->bg_upd_hdl = ecore_event_handler_add(E_EVENT_BG_UPDATE,
129 _e_wid_cb_bg_update, dd); 134 _e_wid_cb_bg_update, dd);
@@ -150,6 +155,48 @@ e_widget_bgpreview_desk_configurable_set(Evas_Object *obj, Eina_Bool enable)
150 dd->configurable = enable; 155 dd->configurable = enable;
151} 156}
152 157
158/* local function prototypes */
159static void
160_e_wid_livethumb_resize_job(void *data)
161{
162 E_Widget_Desk_Data *dd = data;
163 E_Zone *zone;
164 int w, h;
165
166 if (dd->thumb)
167 {
168 zone = e_comp_object_util_zone_get(dd->live);
169 if (!zone) zone = eina_list_data_get(e_comp->zones);
170 evas_object_geometry_get(dd->cont, NULL, NULL, &w, &h);
171 if ((w != zone->w) || (h != zone->h))
172 {
173 w *= 2;
174 h *= 2;
175 if (w > 128)
176 {
177 w = 128;
178 h = (zone->h * w) / zone->w;
179 }
180 if (h > 128)
181 {
182 h = 128;
183 w = (zone->w * h) / zone->h;
184 }
185 }
186 e_livethumb_vsize_set(dd->live, w, h);
187 }
188 dd->resize_job = NULL;
189}
190
191static void
192_e_wid_livethumb_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
193{
194 E_Widget_Desk_Data *dd = data;
195
196 if (!dd->resize_job)
197 dd->resize_job = ecore_job_add(_e_wid_livethumb_resize_job, dd);
198}
199
153static void 200static void
154_e_wid_data_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 201_e_wid_data_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
155{ 202{
@@ -312,14 +359,19 @@ _e_wid_cb_bg_update(void *data, int type, void *event)
312 zone = e_comp_zone_number_get(dd->zone); 359 zone = e_comp_zone_number_get(dd->zone);
313 bgfile = e_bg_file_get(dd->zone, dd->x, dd->y); 360 bgfile = e_bg_file_get(dd->zone, dd->x, dd->y);
314 361
362 if (dd->thumb) evas_object_del(dd->thumb);
363 dd->thumb = NULL;
315 if (dd->live) evas_object_del(dd->live); 364 if (dd->live) evas_object_del(dd->live);
316 dd->live = NULL; 365 dd->live = NULL;
317 366
318 if (eina_str_has_extension(bgfile, ".edj")) 367 if (eina_str_has_extension(bgfile, ".edj"))
319 { 368 {
320 dd->live = o = edje_object_add(e); 369 dd->live = e_livethumb_add(e);
370 dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live));
321 edje_object_file_set(o, bgfile, "e/desktop/background"); 371 edje_object_file_set(o, bgfile, "e/desktop/background");
322 _bgpreview_viewport_update(o, zone, dd->x, dd->y); 372 _bgpreview_viewport_update(o, zone, dd->x, dd->y);
373 e_livethumb_thumb_set(dd->live, o);
374 evas_object_show(dd->thumb);
323 } 375 }
324 else if ((eina_str_has_extension(bgfile, ".gif")) || 376 else if ((eina_str_has_extension(bgfile, ".gif")) ||
325 (eina_str_has_extension(bgfile, ".png")) || 377 (eina_str_has_extension(bgfile, ".png")) ||
@@ -335,6 +387,7 @@ _e_wid_cb_bg_update(void *data, int type, void *event)
335 { 387 {
336 dd->live = o = e_video_add(e, bgfile, EINA_TRUE); 388 dd->live = o = e_video_add(e, bgfile, EINA_TRUE);
337 } 389 }
390 _e_wid_livethumb_resize_job(dd);
338 eina_stringshare_del(bgfile); 391 eina_stringshare_del(bgfile);
339 392
340 evas_object_size_hint_weight_set(dd->live, 1, 1); 393 evas_object_size_hint_weight_set(dd->live, 1, 1);