summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c82
1 files changed, 35 insertions, 47 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index 6b1619d..3139157 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -76,7 +76,7 @@ e_bg_shutdown(void)
76 * The most specific match will be returned 76 * The most specific match will be returned
77 */ 77 */
78EAPI const E_Config_Desktop_Background * 78EAPI const E_Config_Desktop_Background *
79e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y) 79e_bg_config_get(int manager_num, int zone_num, int desk_x, int desk_y)
80{ 80{
81 Eina_List *l, *entries; 81 Eina_List *l, *entries;
82 E_Config_Desktop_Background *bg = NULL, *cfbg = NULL; 82 E_Config_Desktop_Background *bg = NULL, *cfbg = NULL;
@@ -85,7 +85,7 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
85 int current_spec = 0; /* how specific the setting is - we want the least general one that applies */ 85 int current_spec = 0; /* how specific the setting is - we want the least general one that applies */
86 86
87 /* look for desk specific background. */ 87 /* look for desk specific background. */
88 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0) 88 if (manager_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
89 { 89 {
90 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 90 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
91 { 91 {
@@ -93,8 +93,8 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
93 93
94 if (!cfbg) continue; 94 if (!cfbg) continue;
95 spec = 0; 95 spec = 0;
96 if (cfbg->container == container_num) spec++; 96 if (cfbg->manager == manager_num) spec++;
97 else if (cfbg->container >= 0) 97 else if (cfbg->manager >= 0)
98 continue; 98 continue;
99 if (cfbg->zone == zone_num) spec++; 99 if (cfbg->zone == zone_num) spec++;
100 else if (cfbg->zone >= 0) 100 else if (cfbg->zone >= 0)
@@ -144,13 +144,13 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
144} 144}
145 145
146EAPI Eina_Stringshare * 146EAPI Eina_Stringshare *
147e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y) 147e_bg_file_get(int manager_num, int zone_num, int desk_x, int desk_y)
148{ 148{
149 const E_Config_Desktop_Background *cfbg; 149 const E_Config_Desktop_Background *cfbg;
150 const char *bgfile = NULL; 150 const char *bgfile = NULL;
151 int ok = 0; 151 int ok = 0;
152 152
153 cfbg = e_bg_config_get(container_num, zone_num, desk_x, desk_y); 153 cfbg = e_bg_config_get(manager_num, zone_num, desk_x, desk_y);
154 154
155 /* fall back to default */ 155 /* fall back to default */
156 if (cfbg) 156 if (cfbg)
@@ -208,9 +208,9 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
208 208
209 desk = e_desk_current_get(zone); 209 desk = e_desk_current_get(zone);
210 if (desk) 210 if (desk)
211 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y); 211 bgfile = e_bg_file_get(zone->comp->num, zone->num, desk->x, desk->y);
212 else 212 else
213 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1); 213 bgfile = e_bg_file_get(zone->comp->num, zone->num, -1, -1);
214 214
215 if (zone->bg_object) 215 if (zone->bg_object)
216 { 216 {
@@ -233,39 +233,43 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
233 zone->bg_object = NULL; 233 zone->bg_object = NULL;
234 E_FREE_FUNC(zone->transition_object, evas_object_del); 234 E_FREE_FUNC(zone->transition_object, evas_object_del);
235 } 235 }
236 o = edje_object_add(zone->container->bg_evas); 236 o = edje_object_add(zone->comp->evas);
237 evas_object_repeat_events_set(o, 1); 237 evas_object_repeat_events_set(o, 1);
238 zone->transition_object = o; 238 zone->transition_object = o;
239 evas_object_name_set(zone->transition_object, "zone->transition_object");
239 /* FIXME: segv if zone is deleted while up??? */ 240 /* FIXME: segv if zone is deleted while up??? */
240 evas_object_data_set(o, "e_zone", zone); 241 evas_object_data_set(o, "e_zone", zone);
241 snprintf(buf, sizeof(buf), "e/transitions/%s", trans); 242 snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
242 e_theme_edje_object_set(o, "base/theme/transitions", buf); 243 e_theme_edje_object_set(o, "base/theme/transitions", buf);
243 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone); 244 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
244 evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG); 245 evas_object_move(o, zone->x, zone->y);
246 evas_object_resize(o, zone->w, zone->h);
247 evas_object_layer_set(o, E_LAYER_BG);
245 evas_object_clip_set(o, zone->bg_clip_object); 248 evas_object_clip_set(o, zone->bg_clip_object);
246 evas_object_show(o); 249 evas_object_show(o);
247 } 250 }
248 if (eina_str_has_extension(bgfile, ".edj")) 251 if (eina_str_has_extension(bgfile, ".edj"))
249 { 252 {
250 o = edje_object_add(zone->container->bg_evas); 253 o = edje_object_add(zone->comp->evas);
251 edje_object_file_set(o, bgfile, "e/desktop/background"); 254 edje_object_file_set(o, bgfile, "e/desktop/background");
252 if (edje_object_data_get(o, "noanimation")) 255 if (edje_object_data_get(o, "noanimation"))
253 edje_object_animation_set(o, EINA_FALSE); 256 edje_object_animation_set(o, EINA_FALSE);
254 } 257 }
255 else 258 else
256 { 259 {
257 o = e_icon_add(zone->container->bg_evas); 260 o = e_icon_add(zone->comp->evas);
258 e_icon_file_key_set(o, bgfile, NULL); 261 e_icon_file_key_set(o, bgfile, NULL);
259 e_icon_fill_inside_set(o, 0); 262 e_icon_fill_inside_set(o, 0);
260 } 263 }
261 evas_object_data_set(o, "e_zone", zone); 264 evas_object_data_set(o, "e_zone", zone);
262 evas_object_repeat_events_set(o, 1); 265 evas_object_repeat_events_set(o, 1);
263 zone->bg_object = o; 266 zone->bg_object = o;
267 evas_object_name_set(zone->bg_object, "zone->bg_object");
264 if (transition == E_BG_TRANSITION_NONE) 268 if (transition == E_BG_TRANSITION_NONE)
265 { 269 {
266 evas_object_move(o, zone->x, zone->y); 270 evas_object_move(o, zone->x, zone->y);
267 evas_object_resize(o, zone->w, zone->h); 271 evas_object_resize(o, zone->w, zone->h);
268 evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG); 272 evas_object_layer_set(o, E_LAYER_BG);
269 } 273 }
270 evas_object_clip_set(o, zone->bg_clip_object); 274 evas_object_clip_set(o, zone->bg_clip_object);
271 evas_object_show(o); 275 evas_object_show(o);
@@ -285,9 +289,9 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
285 if (zone->bg_object) evas_object_name_set(zone->bg_object, "zone->bg_object"); 289 if (zone->bg_object) evas_object_name_set(zone->bg_object, "zone->bg_object");
286 if (zone->prev_bg_object) evas_object_name_set(zone->prev_bg_object, "zone->prev_bg_object"); 290 if (zone->prev_bg_object) evas_object_name_set(zone->prev_bg_object, "zone->prev_bg_object");
287 if (zone->transition_object) evas_object_name_set(zone->transition_object, "zone->transition_object"); 291 if (zone->transition_object) evas_object_name_set(zone->transition_object, "zone->transition_object");
288 if (zone->comp_zone) e_comp_zone_update(zone->comp_zone);
289 evas_object_move(zone->transition_object, zone->x, zone->y); 292 evas_object_move(zone->transition_object, zone->x, zone->y);
290 evas_object_resize(zone->transition_object, zone->w, zone->h); 293 evas_object_resize(zone->transition_object, zone->w, zone->h);
294 e_comp_canvas_zone_update(zone);
291end: 295end:
292 eina_stringshare_del(bgfile); 296 eina_stringshare_del(bgfile);
293} 297}
@@ -322,7 +326,7 @@ e_bg_default_set(const char *file)
322 e_config->desktop_default_background = NULL; 326 e_config->desktop_default_background = NULL;
323 327
324 ev = E_NEW(E_Event_Bg_Update, 1); 328 ev = E_NEW(E_Event_Bg_Update, 1);
325 ev->container = -1; 329 ev->manager = -1;
326 ev->zone = -1; 330 ev->zone = -1;
327 ev->desk_x = -1; 331 ev->desk_x = -1;
328 ev->desk_y = -1; 332 ev->desk_y = -1;
@@ -330,7 +334,7 @@ e_bg_default_set(const char *file)
330} 334}
331 335
332EAPI void 336EAPI void
333e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file) 337e_bg_add(int manager, int zone, int desk_x, int desk_y, const char *file)
334{ 338{
335 const Eina_List *l; 339 const Eina_List *l;
336 E_Config_Desktop_Background *cfbg; 340 E_Config_Desktop_Background *cfbg;
@@ -341,7 +345,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
341 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 345 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
342 { 346 {
343 if ((cfbg) && 347 if ((cfbg) &&
344 (cfbg->container == container) && 348 (cfbg->manager == manager) &&
345 (cfbg->zone == zone) && 349 (cfbg->zone == zone) &&
346 (cfbg->desk_x == desk_x) && 350 (cfbg->desk_x == desk_x) &&
347 (cfbg->desk_y == desk_y) && 351 (cfbg->desk_y == desk_y) &&
@@ -352,9 +356,9 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
352 } 356 }
353 } 357 }
354 358
355 e_bg_del(container, zone, desk_x, desk_y); 359 e_bg_del(manager, zone, desk_x, desk_y);
356 cfbg = E_NEW(E_Config_Desktop_Background, 1); 360 cfbg = E_NEW(E_Config_Desktop_Background, 1);
357 cfbg->container = container; 361 cfbg->manager = manager;
358 cfbg->zone = zone; 362 cfbg->zone = zone;
359 cfbg->desk_x = desk_x; 363 cfbg->desk_x = desk_x;
360 cfbg->desk_y = desk_y; 364 cfbg->desk_y = desk_y;
@@ -364,7 +368,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
364 e_filereg_register(cfbg->file); 368 e_filereg_register(cfbg->file);
365 369
366 ev = E_NEW(E_Event_Bg_Update, 1); 370 ev = E_NEW(E_Event_Bg_Update, 1);
367 ev->container = container; 371 ev->manager = manager;
368 ev->zone = zone; 372 ev->zone = zone;
369 ev->desk_x = desk_x; 373 ev->desk_x = desk_x;
370 ev->desk_y = desk_y; 374 ev->desk_y = desk_y;
@@ -372,7 +376,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
372} 376}
373 377
374EAPI void 378EAPI void
375e_bg_del(int container, int zone, int desk_x, int desk_y) 379e_bg_del(int manager, int zone, int desk_x, int desk_y)
376{ 380{
377 Eina_List *l; 381 Eina_List *l;
378 E_Config_Desktop_Background *cfbg; 382 E_Config_Desktop_Background *cfbg;
@@ -381,7 +385,7 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
381 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg) 385 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
382 { 386 {
383 if (!cfbg) continue; 387 if (!cfbg) continue;
384 if ((cfbg->container == container) && (cfbg->zone == zone) && 388 if ((cfbg->manager == manager) && (cfbg->zone == zone) &&
385 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y)) 389 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
386 { 390 {
387 e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l); 391 e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l);
@@ -393,7 +397,7 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
393 } 397 }
394 398
395 ev = E_NEW(E_Event_Bg_Update, 1); 399 ev = E_NEW(E_Event_Bg_Update, 1);
396 ev->container = container; 400 ev->manager = manager;
397 ev->zone = zone; 401 ev->zone = zone;
398 ev->desk_x = desk_x; 402 ev->desk_x = desk_x;
399 ev->desk_y = desk_y; 403 ev->desk_y = desk_y;
@@ -403,21 +407,13 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
403EAPI void 407EAPI void
404e_bg_update(void) 408e_bg_update(void)
405{ 409{
406 Eina_List *l, *ll, *lll; 410 const Eina_List *l, *ll;
407 E_Manager *man; 411 E_Comp *c;
408 E_Container *con;
409 E_Zone *zone; 412 E_Zone *zone;
410 413
411 EINA_LIST_FOREACH(e_manager_list(), l, man) 414 EINA_LIST_FOREACH(e_comp_list(), l, c)
412 { 415 EINA_LIST_FOREACH(c->zones, ll, zone)
413 EINA_LIST_FOREACH(man->containers, ll, con) 416 e_zone_bg_reconfigure(zone);
414 {
415 EINA_LIST_FOREACH(con->zones, lll, zone)
416 {
417 e_zone_bg_reconfigure(zone);
418 }
419 }
420 }
421} 417}
422 418
423/* local subsystem functions */ 419/* local subsystem functions */
@@ -507,19 +503,11 @@ _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNU
507{ 503{
508 E_Zone *zone = data; 504 E_Zone *zone = data;
509 505
510 if (zone->prev_bg_object) 506 E_FREE_FUNC(zone->prev_bg_object, evas_object_del);
511 { 507 E_FREE_FUNC(zone->transition_object, evas_object_del);
512 evas_object_del(zone->prev_bg_object);
513 zone->prev_bg_object = NULL;
514 }
515 if (zone->transition_object)
516 {
517 evas_object_del(zone->transition_object);
518 zone->transition_object = NULL;
519 }
520 evas_object_move(zone->bg_object, zone->x, zone->y); 508 evas_object_move(zone->bg_object, zone->x, zone->y);
521 evas_object_resize(zone->bg_object, zone->w, zone->h); 509 evas_object_resize(zone->bg_object, zone->w, zone->h);
522 evas_object_layer_set(zone->bg_object, E_COMP_CANVAS_LAYER_BG); 510 evas_object_layer_set(zone->bg_object, E_LAYER_BG);
523 evas_object_clip_set(zone->bg_object, zone->bg_clip_object); 511 evas_object_clip_set(zone->bg_object, zone->bg_clip_object);
524 evas_object_show(zone->bg_object); 512 evas_object_show(zone->bg_object);
525} 513}