3 /* E_Desk is a child object of E_Zone. A desk is essentially a background
4 * and an associated set of client windows. Each zone can have an arbitrary
8 static void _e_desk_free(E_Desk *desk);
9 static void _e_desk_event_desk_show_free(void *data, void *ev);
10 static void _e_desk_event_desk_before_show_free(void *data, void *ev);
11 static void _e_desk_event_desk_after_show_free(void *data, void *ev);
12 static void _e_desk_event_desk_deskshow_free(void *data, void *ev);
13 static void _e_desk_event_desk_name_change_free(void *data, void *ev);
14 static void _e_desk_event_desk_window_profile_change_free(void *data, void *ev);
15 static void _e_desk_show_begin(E_Desk *desk, int mode, int x, int dy);
16 static void _e_desk_show_end(E_Desk *desk);
17 static Eina_Bool _e_desk_show_animator(void *data);
18 static void _e_desk_hide_begin(E_Desk *desk, int mode, int dx, int dy);
19 static void _e_desk_hide_end(E_Desk *desk);
20 static Eina_Bool _e_desk_hide_animator(void *data);
22 EAPI int E_EVENT_DESK_SHOW = 0;
23 EAPI int E_EVENT_DESK_BEFORE_SHOW = 0;
24 EAPI int E_EVENT_DESK_AFTER_SHOW = 0;
25 EAPI int E_EVENT_DESK_DESKSHOW = 0;
26 EAPI int E_EVENT_DESK_NAME_CHANGE = 0;
27 EAPI int E_EVENT_DESK_WINDOW_PROFILE_CHANGE = 0;
32 E_EVENT_DESK_SHOW = ecore_event_type_new();
33 E_EVENT_DESK_BEFORE_SHOW = ecore_event_type_new();
34 E_EVENT_DESK_AFTER_SHOW = ecore_event_type_new();
35 E_EVENT_DESK_DESKSHOW = ecore_event_type_new();
36 E_EVENT_DESK_NAME_CHANGE = ecore_event_type_new();
37 E_EVENT_DESK_WINDOW_PROFILE_CHANGE = ecore_event_type_new();
48 e_desk_new(E_Zone *zone, int x, int y)
52 E_Config_Desktop_Name *cfname;
53 E_Config_Desktop_Window_Profile *cfprof;
57 E_OBJECT_CHECK_RETURN(zone, NULL);
58 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
60 desk = E_OBJECT_ALLOC(E_Desk, E_DESK_TYPE, _e_desk_free);
61 if (!desk) return NULL;
67 /* Get current desktop's name */
68 EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
70 if ((cfname->container >= 0) &&
71 ((int) zone->container->num != cfname->container)) continue;
72 if ((cfname->zone >= 0) &&
73 ((int) zone->num != cfname->zone)) continue;
74 if ((cfname->desk_x != desk->x) || (cfname->desk_y != desk->y))
76 desk->name = eina_stringshare_add(cfname->name);
83 snprintf(name, sizeof(name), _(e_config->desktop_default_name), x, y);
84 desk->name = eina_stringshare_add(name);
87 /* Get window profile name for current desktop */
89 EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
91 if ((cfprof->container >= 0) &&
92 ((int)zone->container->num != cfprof->container)) continue;
93 if ((cfprof->zone >= 0) &&
94 ((int)zone->num != cfprof->zone)) continue;
95 if ((cfprof->desk_x != desk->x) || (cfprof->desk_y != desk->y))
97 desk->window_profile = eina_stringshare_add(cfprof->profile);
104 desk->window_profile = eina_stringshare_add
105 (e_config->desktop_default_window_profile);
112 e_desk_name_set(E_Desk *desk, const char *name)
114 E_Event_Desk_Name_Change *ev;
116 E_OBJECT_CHECK(desk);
117 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
119 eina_stringshare_replace(&desk->name, name);
121 ev = E_NEW(E_Event_Desk_Name_Change, 1);
123 e_object_ref(E_OBJECT(desk));
124 ecore_event_add(E_EVENT_DESK_NAME_CHANGE, ev,
125 _e_desk_event_desk_name_change_free, NULL);
129 e_desk_name_add(int container, int zone, int desk_x, int desk_y, const char *name)
131 E_Config_Desktop_Name *cfname;
133 e_desk_name_del(container, zone, desk_x, desk_y);
135 cfname = E_NEW(E_Config_Desktop_Name, 1);
136 cfname->container = container;
138 cfname->desk_x = desk_x;
139 cfname->desk_y = desk_y;
140 if (name) cfname->name = eina_stringshare_add(name);
141 else cfname->name = NULL;
142 e_config->desktop_names = eina_list_append(e_config->desktop_names, cfname);
146 e_desk_name_del(int container, int zone, int desk_x, int desk_y)
149 E_Config_Desktop_Name *cfname = NULL;
151 EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
153 if ((cfname->container == container) && (cfname->zone == zone) &&
154 (cfname->desk_x == desk_x) && (cfname->desk_y == desk_y))
156 e_config->desktop_names =
157 eina_list_remove_list(e_config->desktop_names, l);
158 if (cfname->name) eina_stringshare_del(cfname->name);
166 e_desk_name_update(void)
168 Eina_List *m, *c, *z, *l;
173 E_Config_Desktop_Name *cfname;
177 EINA_LIST_FOREACH(e_manager_list(), m, man)
179 EINA_LIST_FOREACH(man->containers, c, con)
181 EINA_LIST_FOREACH(con->zones, z, zone)
183 for (d_x = 0; d_x < zone->desk_x_count; d_x++)
185 for (d_y = 0; d_y < zone->desk_y_count; d_y++)
187 desk = zone->desks[d_x + zone->desk_x_count * d_y];
190 EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
192 if ((cfname->container >= 0) &&
193 ((int) con->num != cfname->container)) continue;
194 if ((cfname->zone >= 0) &&
195 ((int) zone->num != cfname->zone)) continue;
196 if ((cfname->desk_x != d_x) ||
197 (cfname->desk_y != d_y)) continue;
198 e_desk_name_set(desk, cfname->name);
205 snprintf(name, sizeof(name),
206 _(e_config->desktop_default_name),
208 e_desk_name_set(desk, name);
218 e_desk_show(E_Desk *desk)
222 E_Event_Desk_Show *ev;
223 E_Event_Desk_Before_Show *eev;
224 E_Event_Desk_After_Show *eeev;
225 Edje_Message_Float_Set *msg;
228 int was_zone = 0, x, y, dx = 0, dy = 0;
230 E_OBJECT_CHECK(desk);
231 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
232 if (desk->visible) return;
234 eev = E_NEW(E_Event_Desk_Before_Show, 1);
235 eev->desk = e_desk_current_get(desk->zone);
236 e_object_ref(E_OBJECT(eev->desk));
237 ecore_event_add(E_EVENT_DESK_BEFORE_SHOW, eev,
238 _e_desk_event_desk_before_show_free, NULL);
240 ecore_x_window_shadow_tree_flush();
241 for (x = 0; x < desk->zone->desk_x_count; x++)
243 for (y = 0; y < desk->zone->desk_y_count; y++)
247 desk2 = e_desk_at_xy_get(desk->zone, x, y);
251 dx = desk->x - desk2->x;
252 dy = desk->y - desk2->y;
253 if (e_config->desk_flip_animate_mode > 0)
254 _e_desk_hide_begin(desk2, e_config->desk_flip_animate_mode,
261 desk->zone->desk_x_current = desk->x;
262 desk->zone->desk_y_current = desk->y;
265 msg = alloca(sizeof(Edje_Message_Float_Set) + (4 * sizeof(double)));
267 msg->val[0] = e_config->desk_flip_animate_time;
268 msg->val[1] = (double) desk->x;
269 msg->val[2] = (double) desk->zone->desk_x_count;
270 msg->val[3] = (double) desk->y;
271 msg->val[4] = (double) desk->zone->desk_y_count;
272 edje_object_message_send(desk->zone->bg_object, EDJE_MESSAGE_FLOAT_SET, 0, msg);
274 if (desk->zone->bg_object) was_zone = 1;
275 if (e_config->desk_flip_animate_mode == 0)
277 bl = e_container_border_list_first(desk->zone->container);
278 while ((bd = e_container_border_list_next(bl)))
280 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
282 if ((bd->desk == desk) || (bd->sticky))
285 e_border_desk_set(bd, desk);
287 e_border_hide(bd, 2);
290 e_container_border_list_free(bl);
293 if (e_config->desk_flip_animate_mode > 0)
294 _e_desk_show_begin(desk, e_config->desk_flip_animate_mode, dx, dy);
297 if (e_config->focus_last_focused_per_desktop)
298 e_desk_last_focused_focus(desk);
302 e_bg_zone_update(desk->zone, E_BG_TRANSITION_DESK);
304 e_bg_zone_update(desk->zone, E_BG_TRANSITION_START);
306 ev = E_NEW(E_Event_Desk_Show, 1);
308 e_object_ref(E_OBJECT(desk));
309 ecore_event_add(E_EVENT_DESK_SHOW, ev, _e_desk_event_desk_show_free, NULL);
311 EINA_LIST_FOREACH(e_shelf_list(), l, es)
314 E_Config_Shelf *cf_es;
316 E_Config_Shelf_Desk *sd;
320 if (!es->cfg->desk_show_mode) continue;
322 if (!cf_es) continue;
324 zone = e_util_zone_current_get(e_manager_current_get());
325 if (cf_es->zone != (int) zone->num) continue;
327 EINA_LIST_FOREACH(es->cfg->desk_list, ll, sd)
330 if ((desk->x == sd->x) && (desk->y == sd->y))
342 if (e_config->desk_flip_animate_mode == 0)
344 eeev = E_NEW(E_Event_Desk_After_Show, 1);
345 eeev->desk = e_desk_current_get(desk->zone);
346 e_object_ref(E_OBJECT(eeev->desk));
347 ecore_event_add(E_EVENT_DESK_AFTER_SHOW, eeev,
348 _e_desk_event_desk_after_show_free, NULL);
350 e_zone_edge_flip_eval(desk->zone);
354 e_desk_deskshow(E_Zone *zone)
359 E_Event_Desk_Show *ev;
361 E_OBJECT_CHECK(zone);
362 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
364 desk = e_desk_current_get(zone);
365 bl = e_container_border_list_first(zone->container);
366 ecore_x_window_shadow_tree_flush();
367 while ((bd = e_container_border_list_next(bl)))
369 if (bd->desk == desk)
371 if (desk->deskshow_toggle)
373 if (bd->deskshow) e_border_uniconify(bd);
378 if (bd->iconic) continue;
379 if (bd->client.netwm.state.skip_taskbar) continue;
380 if (bd->user_skip_winlist) continue;
381 e_border_iconify(bd);
386 desk->deskshow_toggle = desk->deskshow_toggle ? 0 : 1;
387 e_container_border_list_free(bl);
388 ev = E_NEW(E_Event_Desk_Show, 1);
390 e_object_ref(E_OBJECT(desk));
391 ecore_event_add(E_EVENT_DESK_DESKSHOW, ev,
392 _e_desk_event_desk_deskshow_free, NULL);
396 e_desk_last_focused_focus(E_Desk *desk)
401 EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
403 if ((!bd->iconic) && (bd->visible) &&
404 ((bd->desk == desk) || ((bd->zone == desk->zone) && bd->sticky)) &&
405 (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) &&
406 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
407 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
408 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
409 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
410 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
412 /* this was the window last focused in this desktop */
413 if (!bd->lock_focus_out)
415 e_border_focus_set(bd, 1, 1);
423 e_desk_row_add(E_Zone *zone)
425 e_zone_desk_count_set(zone, zone->desk_x_count, zone->desk_y_count + 1);
429 e_desk_row_remove(E_Zone *zone)
431 e_zone_desk_count_set(zone, zone->desk_x_count, zone->desk_y_count - 1);
435 e_desk_col_add(E_Zone *zone)
437 e_zone_desk_count_set(zone, zone->desk_x_count + 1, zone->desk_y_count);
441 e_desk_col_remove(E_Zone *zone)
443 e_zone_desk_count_set(zone, zone->desk_x_count - 1, zone->desk_y_count);
447 e_desk_current_get(E_Zone *zone)
449 E_OBJECT_CHECK_RETURN(zone, NULL);
450 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
452 return e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current);
456 e_desk_at_xy_get(E_Zone *zone, int x, int y)
458 E_OBJECT_CHECK_RETURN(zone, NULL);
459 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
461 if ((x >= zone->desk_x_count) || (y >= zone->desk_y_count))
463 else if ((x < 0) || (y < 0))
466 return zone->desks[x + (y * zone->desk_x_count)];
470 e_desk_at_pos_get(E_Zone *zone, int pos)
474 E_OBJECT_CHECK_RETURN(zone, NULL);
475 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
477 y = pos / zone->desk_x_count;
478 x = pos - (y * zone->desk_x_count);
480 if ((x >= zone->desk_x_count) || (y >= zone->desk_y_count))
483 return zone->desks[x + (y * zone->desk_x_count)];
487 e_desk_xy_get(E_Desk *desk, int *x, int *y)
489 E_OBJECT_CHECK(desk);
490 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
497 e_desk_next(E_Zone *zone)
501 E_OBJECT_CHECK(zone);
502 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
504 if ((zone->desk_x_count < 2) && (zone->desk_y_count < 2))
507 x = zone->desk_x_current;
508 y = zone->desk_y_current;
511 if (x >= zone->desk_x_count)
515 if (y >= zone->desk_y_count) y = 0;
518 e_desk_show(e_desk_at_xy_get(zone, x, y));
522 e_desk_prev(E_Zone *zone)
526 E_OBJECT_CHECK(zone);
527 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
529 if ((zone->desk_x_count < 2) && (zone->desk_y_count < 2))
532 x = zone->desk_x_current;
533 y = zone->desk_y_current;
538 x = zone->desk_x_count - 1;
540 if (y < 0) y = zone->desk_y_count - 1;
542 e_desk_show(e_desk_at_xy_get(zone, x, y));
546 e_desk_window_profile_set(E_Desk *desk,
549 E_Event_Desk_Window_Profile_Change *ev;
551 E_OBJECT_CHECK(desk);
552 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
554 eina_stringshare_replace(&desk->window_profile, profile);
556 ev = E_NEW(E_Event_Desk_Window_Profile_Change, 1);
558 e_object_ref(E_OBJECT(desk));
559 ecore_event_add(E_EVENT_DESK_WINDOW_PROFILE_CHANGE, ev,
560 _e_desk_event_desk_window_profile_change_free, NULL);
564 e_desk_window_profile_add(int container,
570 E_Config_Desktop_Window_Profile *cfprof;
572 e_desk_window_profile_del(container, zone, desk_x, desk_y);
574 cfprof = E_NEW(E_Config_Desktop_Window_Profile, 1);
575 cfprof->container = container;
577 cfprof->desk_x = desk_x;
578 cfprof->desk_y = desk_y;
579 if (profile) cfprof->profile = eina_stringshare_add(profile);
580 else cfprof->profile = NULL;
581 e_config->desktop_window_profiles = eina_list_append(e_config->desktop_window_profiles, cfprof);
585 e_desk_window_profile_del(int container,
591 E_Config_Desktop_Window_Profile *cfprof = NULL;
593 EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
595 if (!((cfprof->container == container) &&
596 (cfprof->zone == zone) &&
597 (cfprof->desk_x == desk_x) &&
598 (cfprof->desk_y == desk_y)))
601 e_config->desktop_window_profiles =
602 eina_list_remove_list(e_config->desktop_window_profiles, l);
603 if (cfprof->profile) eina_stringshare_del(cfprof->profile);
610 e_desk_window_profile_update(void)
612 Eina_List *m, *c, *z, *l;
617 E_Config_Desktop_Window_Profile *cfprof;
620 EINA_LIST_FOREACH(e_manager_list(), m, man)
622 EINA_LIST_FOREACH(man->containers, c, con)
624 EINA_LIST_FOREACH(con->zones, z, zone)
626 for (d_x = 0; d_x < zone->desk_x_count; d_x++)
628 for (d_y = 0; d_y < zone->desk_y_count; d_y++)
630 desk = zone->desks[d_x + zone->desk_x_count * d_y];
633 EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
635 if ((cfprof->container >= 0) &&
636 ((int)con->num != cfprof->container)) continue;
637 if ((cfprof->zone >= 0) &&
638 ((int)zone->num != cfprof->zone)) continue;
639 if ((cfprof->desk_x != d_x) ||
640 (cfprof->desk_y != d_y)) continue;
641 e_desk_window_profile_set(desk, cfprof->profile);
648 e_desk_window_profile_set
649 (desk, e_config->desktop_default_window_profile);
659 _e_desk_free(E_Desk *desk)
661 if (desk->name) eina_stringshare_del(desk->name);
663 if (desk->animator) ecore_animator_del(desk->animator);
664 desk->animator = NULL;
669 _e_desk_event_desk_show_free(void *data __UNUSED__, void *event)
671 E_Event_Desk_Show *ev;
674 e_object_unref(E_OBJECT(ev->desk));
679 _e_desk_event_desk_before_show_free(void *data __UNUSED__, void *event)
681 E_Event_Desk_Before_Show *ev;
684 e_object_unref(E_OBJECT(ev->desk));
689 _e_desk_event_desk_after_show_free(void *data __UNUSED__, void *event)
691 E_Event_Desk_After_Show *ev;
694 e_object_unref(E_OBJECT(ev->desk));
699 _e_desk_event_desk_deskshow_free(void *data __UNUSED__, void *event)
701 E_Event_Desk_Show *ev;
704 e_object_unref(E_OBJECT(ev->desk));
709 _e_desk_event_desk_name_change_free(void *data __UNUSED__, void *event)
711 E_Event_Desk_Name_Change *ev;
714 e_object_unref(E_OBJECT(ev->desk));
719 _e_desk_event_desk_window_profile_change_free(void *data __UNUSED__,
722 E_Event_Desk_Window_Profile_Change *ev;
724 e_object_unref(E_OBJECT(ev->desk));
729 _e_desk_show_begin(E_Desk *desk, int mode, int dx, int dy)
740 t = ecore_loop_time_get();
741 bl = e_container_border_list_first(desk->zone->container);
742 while ((bd = e_container_border_list_next(bl)))
744 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
751 e_border_desk_set(bd, desk);
754 else if ((bd->desk == desk) && (!bd->sticky))
756 e_border_tmp_input_hidden_push(bd);
760 bd->fx.start.x = bd->zone->w * (dx * 1.5);
761 bd->fx.start.y = bd->zone->h * (dy * 1.5);
766 double fx, fy, ang, rad, len, lmax;
768 mx = bd->zone->x + (bd->zone->w / 2);
769 my = bd->zone->y + (bd->zone->h / 2);
771 bx = bd->x + (bd->w / 2) - mx;
772 by = bd->y + (bd->h / 2) - my;
775 fx = (double)bx / (double)(bd->zone->w / 2);
776 fy = (double)by / (double)(bd->zone->h / 2);
780 len = sqrt((bx * bx) + (by * by));
781 lmax = sqrt(((bd->zone->w / 2) * (bd->zone->w / 2)) +
782 ((bd->zone->h / 2) * (bd->zone->h / 2)));
783 rad = sqrt((bd->w * bd->w) + (bd->h * bd->h)) / 2.0;
784 bx = cos(ang) * (lmax - len + rad);
785 by = sin(ang) * (lmax - len + rad);
789 if (bd->fx.start.x < 0)
790 bd->fx.start.x -= bd->zone->x;
792 bd->fx.start.x += bd->zone->container->w - (bd->zone->x + bd->zone->w);
793 if (bd->fx.start.y < 0)
794 bd->fx.start.y -= bd->zone->y;
796 bd->fx.start.y += bd->zone->container->h - (bd->zone->y + bd->zone->h);
797 e_border_fx_offset(bd, bd->fx.start.x, bd->fx.start.y);
798 e_border_comp_hidden_set(bd, EINA_TRUE);
802 e_container_border_list_free(bl);
803 if (desk->animator) ecore_animator_del(desk->animator);
804 desk->animator = ecore_animator_add(_e_desk_show_animator, desk);
805 desk->animating = EINA_TRUE;
809 _e_desk_show_end(E_Desk *desk)
811 E_Event_Desk_After_Show *ev;
815 bl = e_container_border_list_first(desk->zone->container);
816 while ((bd = e_container_border_list_next(bl)))
818 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
821 e_border_fx_offset(bd, 0, 0);
822 else if ((bd->desk == desk) && (!bd->sticky))
824 e_border_fx_offset(bd, 0, 0);
825 e_border_comp_hidden_set(bd, EINA_FALSE);
830 e_border_tmp_input_hidden_pop(bd);
834 if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
835 (e_config->focus_policy == E_FOCUS_SLOPPY))
837 if (e_config->focus_last_focused_per_desktop)
839 if (!e_border_under_pointer_get(desk, NULL))
840 e_desk_last_focused_focus(desk);
845 if (e_config->focus_last_focused_per_desktop)
846 e_desk_last_focused_focus(desk);
849 e_container_border_list_free(bl);
850 ecore_x_window_shadow_tree_flush();
851 ev = E_NEW(E_Event_Desk_After_Show, 1);
852 ev->desk = e_desk_current_get(desk->zone);
853 e_object_ref(E_OBJECT(ev->desk));
854 ecore_event_add(E_EVENT_DESK_AFTER_SHOW, ev,
855 _e_desk_event_desk_after_show_free, NULL);
859 _e_desk_show_animator(void *data)
868 if (!desk->animating)
870 _e_desk_show_end(desk);
871 desk->animator = NULL;
872 return ECORE_CALLBACK_CANCEL;
875 t = ecore_loop_time_get();
877 spd = e_config->desk_flip_animate_time;
878 bl = e_container_border_list_first(desk->zone->container);
879 while ((bd = e_container_border_list_next(bl)))
881 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
886 else if ((bd->desk == desk) && (!bd->sticky))
891 dt = (t - bd->fx.start.t) / spd;
892 if (dt > 1.0) dt = 1.0;
894 dt *= dt; /* decelerate - could be a better hack */
895 e_border_fx_offset(bd,
896 ((double)bd->fx.start.x * dt),
897 ((double)bd->fx.start.y * dt));
901 e_container_border_list_free(bl);
903 desk->animating = EINA_FALSE;
905 return ECORE_CALLBACK_RENEW;
909 _e_desk_hide_begin(E_Desk *desk, int mode, int dx, int dy)
920 t = ecore_loop_time_get();
921 bl = e_container_border_list_first(desk->zone->container);
922 while ((bd = e_container_border_list_next(bl)))
924 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
932 else if ((bd->desk == desk) && (!bd->sticky))
937 bd->fx.start.x = bd->zone->w * (-dx * 1.5);
938 bd->fx.start.y = bd->zone->h * (-dy * 1.5);
943 double fx, fy, ang, rad, len, lmax;
945 mx = bd->zone->x + (bd->zone->w / 2);
946 my = bd->zone->y + (bd->zone->h / 2);
948 bx = bd->x + (bd->w / 2) - mx;
949 by = bd->y + (bd->h / 2) - my;
952 fx = (double)bx / (double)(bd->zone->w / 2);
953 fy = (double)by / (double)(bd->zone->h / 2);
957 len = sqrt((bx * bx) + (by * by));
958 lmax = sqrt(((bd->zone->w / 2) * (bd->zone->w / 2)) +
959 ((bd->zone->h / 2) * (bd->zone->h / 2)));
960 rad = sqrt((bd->w * bd->w) + (bd->h * bd->h)) / 2.0;
961 bx = cos(ang) * (lmax - len + rad);
962 by = sin(ang) * (lmax - len + rad);
966 if (bd->fx.start.x < 0)
967 bd->fx.start.x -= bd->zone->x;
969 bd->fx.start.x += bd->zone->container->w - (bd->zone->x + bd->zone->w);
970 if (bd->fx.start.y < 0)
971 bd->fx.start.y -= bd->zone->y;
973 bd->fx.start.y += bd->zone->container->h - (bd->zone->y + bd->zone->h);
974 e_border_fx_offset(bd, 0, 0);
975 e_border_comp_hidden_set(bd, EINA_TRUE);
979 e_container_border_list_free(bl);
980 if (desk->animator) ecore_animator_del(desk->animator);
981 desk->animator = ecore_animator_add(_e_desk_hide_animator, desk);
982 desk->animating = EINA_TRUE;
986 _e_desk_hide_end(E_Desk *desk)
991 bl = e_container_border_list_first(desk->zone->container);
992 while ((bd = e_container_border_list_next(bl)))
994 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
997 e_border_fx_offset(bd, 0, 0);
998 else if ((bd->desk == desk) && (!bd->sticky))
1000 e_border_fx_offset(bd, 0, 0);
1001 e_border_comp_hidden_set(bd, EINA_FALSE);
1002 e_border_hide(bd, 2);
1006 e_container_border_list_free(bl);
1007 ecore_x_window_shadow_tree_flush();
1011 _e_desk_hide_animator(void *data)
1020 if (!desk->animating)
1022 _e_desk_hide_end(desk);
1023 desk->animator = NULL;
1024 return ECORE_CALLBACK_CANCEL;
1027 t = ecore_loop_time_get();
1029 spd = e_config->desk_flip_animate_time;
1030 bl = e_container_border_list_first(desk->zone->container);
1031 while ((bd = e_container_border_list_next(bl)))
1033 if ((bd->desk->zone == desk->zone) && (!bd->iconic))
1038 else if ((bd->desk == desk) && (!bd->sticky))
1040 dt = (t - bd->fx.start.t) / spd;
1041 if (dt > 1.0) dt = 1.0;
1042 dt *= dt; /* decelerate - could be a better hack */
1043 e_border_fx_offset(bd,
1044 ((double)bd->fx.start.x * dt),
1045 ((double)bd->fx.start.y * dt));
1049 e_container_border_list_free(bl);
1051 if ((dt < 0.0) || (dt >= 1.0))
1052 desk->animating = EINA_FALSE;
1054 return ECORE_CALLBACK_RENEW;