1 #include "e_mod_comp_shared_types.h"
2 #include "e_mod_comp.h"
3 #include "e_mod_comp_atoms.h"
4 #include "e_mod_comp_debug.h"
8 #include "effect_image_launch.h"
9 #include "effect_win_rotation.h"
11 static Eina_List *effect_jobs = NULL;
13 /* local subsystem functions */
14 static E_Comp_Effect_Style _effect_style_get(Ecore_X_Atom a);
15 static Eina_Bool _state_send(E_Comp_Win *cw, Eina_Bool state);
16 static Eina_Bool _effect_signal_del_intern(E_Comp_Win *cw, Evas_Object *obj, const char *name, Eina_Bool clean_all);
17 static E_Border *_effect_policy_border_transient_for_border_top_get(E_Border *bd);
18 static void _effect_policy_border_transient_for_group_make(E_Border *bd, Eina_List **list);
20 static void _effect_win_set(E_Comp_Win *cw, const char *emission, Eina_Bool send_ev, Eina_Bool show, Eina_Bool recreate);
21 static void _effect_win_lower(E_Comp_Win *cw, const char *emission, Eina_Bool recreate);
22 static void _effect_below_wins_set(E_Comp_Win *cw, Eina_Bool recreate);
23 static void _effect_below_floating_wins_set(E_Comp_Win *cw, Eina_Bool show, Eina_Bool recreate);
24 static void _effect_home_active_below_wins_set(E_Comp_Win *cw, Eina_Bool show, Eina_Bool recreate);
26 static void _effect_above_wins_set(E_Comp_Win *cw, Eina_Bool show, Eina_Bool recreate);
28 static E_Comp_Effect_Object * _effect_object_control_layer_new(E_Comp_Layer *ly, E_Comp_Win *cw);
29 static void _effect_control_layer_set(E_Comp_Win *cw);
31 static Eina_Bool _effect_show(E_Comp_Win *cw, Eina_Bool send_ev);
32 static Eina_Bool _effect_hide(E_Comp_Win *cw, Eina_Bool send_ev);
33 static Eina_Bool _effect_obj_win_set(E_Comp_Effect_Object *o, E_Comp_Win *cw);
34 static void _effect_obj_win_shape_rectangles_apply(E_Comp_Effect_Object *o, E_Comp_Win *cw);
35 static void _effect_obj_effect_done(void *data, Evas_Object *obj, const char *emission, const char *source);
36 static E_Comp_Effect_Object *_effect_obj_find(E_Comp_Win *cw);
37 static Eina_Bool _effect_obj_win_shaped_check(int w, int h, const Ecore_X_Rectangle *rects, int num);
38 static void _effect_role_handle(E_Comp_Effect_Object *o);
39 static Eina_Bool _effect_active_except_bd_check(E_Border *bd);
40 static void _effect_home_active_unset(E_Comp_Win *cw);
43 e_mod_comp_effect_mod_init(E_Comp *c)
47 c->effect_funcs.type_new = _effect_mod_type_new;
48 c->effect_funcs.type_free = _effect_mod_type_free;
49 c->effect_funcs.type_setup = _effect_mod_type_setup;
50 c->effect_funcs.state_setup = _effect_mod_state_setup;
51 c->effect_funcs.state_get = _effect_mod_state_get;
52 c->effect_funcs.state_set = _effect_mod_state_set;
53 c->effect_funcs.style_setup = _effect_mod_style_setup;
54 c->effect_funcs.style_get = _effect_mod_style_get;
55 c->effect_funcs.win_show = _effect_mod_win_show;
56 c->effect_funcs.win_hide = _effect_mod_win_hide;
57 c->effect_funcs.win_restack = _effect_mod_win_restack;
58 c->effect_funcs.signal_add = _effect_mod_signal_add;
59 c->effect_funcs.signal_del = _effect_mod_signal_del;
60 c->effect_funcs.jobs_clean = _effect_mod_jobs_clean;
61 c->effect_funcs.signal_flush = _effect_mod_signal_flush;
62 c->effect_funcs.animating_set = _effect_mod_animating_set;
63 c->effect_funcs.object_new = _effect_mod_object_new;
64 c->effect_funcs.object_free = _effect_mod_object_free;
65 c->effect_funcs.object_win_set = _effect_mod_object_win_set;
66 c->effect_funcs.above_wins_set = _effect_mod_above_wins_set;
68 c->effect_funcs.image_launch_new = _effect_mod_image_launch_new;
69 c->effect_funcs.image_launch_free = _effect_mod_image_launch_free;
70 c->effect_funcs.image_launch_handler_message = _effect_mod_image_launch_handler_message;
71 c->effect_funcs.image_launch_show = _effect_mod_image_launch_show;
72 c->effect_funcs.image_launch_hide = _effect_mod_image_launch_hide;
73 c->effect_funcs.image_launch_window_check = _effect_mod_image_launch_window_check;
74 c->effect_funcs.image_launch_running_check = _effect_mod_image_launch_running_check;
75 c->effect_funcs.image_launch_fake_show_done_check = _effect_mod_image_launch_fake_show_done_check;
76 c->effect_funcs.image_launch_window_set = _effect_mod_image_launch_window_set;
77 c->effect_funcs.image_launch_disable = _effect_mod_image_launch_disable;
79 c->effect_funcs.win_angle_get = _effect_mod_win_angle_get;
80 c->effect_funcs.zone_rotation_new = _effect_mod_zone_rotation_new;
81 c->effect_funcs.zone_rotation_free = _effect_mod_zone_rotation_free;
82 c->effect_funcs.zone_rotation_begin = _effect_mod_zone_rotation_begin;
83 c->effect_funcs.zone_rotation_end = _effect_mod_zone_rotation_end;
84 c->effect_funcs.zone_rotation_cancel = _effect_mod_zone_rotation_cancel;
85 c->effect_funcs.zone_rotation_do = _effect_mod_zone_rotation_do;
86 c->effect_funcs.zone_rotation_clear = _effect_mod_zone_rotation_clear;
92 e_mod_comp_effect_mod_shutdown(E_Comp *c)
96 c->effect_funcs.type_new = NULL;
97 c->effect_funcs.type_free = NULL;
98 c->effect_funcs.type_setup = NULL;
99 c->effect_funcs.state_setup = NULL;
100 c->effect_funcs.state_get = NULL;
101 c->effect_funcs.state_set = NULL;
102 c->effect_funcs.style_setup = NULL;
103 c->effect_funcs.style_get = NULL;
104 c->effect_funcs.win_show = NULL;
105 c->effect_funcs.win_hide = NULL;
106 c->effect_funcs.win_restack = NULL;
107 c->effect_funcs.signal_add = NULL;
108 c->effect_funcs.signal_del = NULL;
109 c->effect_funcs.jobs_clean = NULL;
110 c->effect_funcs.signal_flush = NULL;
111 c->effect_funcs.animating_set = NULL;
112 c->effect_funcs.object_new = NULL;
113 c->effect_funcs.object_free = NULL;
114 c->effect_funcs.object_win_set = NULL;
115 c->effect_funcs.above_wins_set = NULL;
117 c->effect_funcs.image_launch_new = NULL;
118 c->effect_funcs.image_launch_free = NULL;
119 c->effect_funcs.image_launch_handler_message = NULL;
120 c->effect_funcs.image_launch_show = NULL;
121 c->effect_funcs.image_launch_hide = NULL;
122 c->effect_funcs.image_launch_window_check = NULL;
123 c->effect_funcs.image_launch_running_check = NULL;
124 c->effect_funcs.image_launch_fake_show_done_check = NULL;
125 c->effect_funcs.image_launch_window_set = NULL;
126 c->effect_funcs.image_launch_disable = NULL;
128 c->effect_funcs.win_angle_get = NULL;
129 c->effect_funcs.zone_rotation_new = NULL;
130 c->effect_funcs.zone_rotation_free = NULL;
131 c->effect_funcs.zone_rotation_begin = NULL;
132 c->effect_funcs.zone_rotation_end = NULL;
133 c->effect_funcs.zone_rotation_cancel = NULL;
134 c->effect_funcs.zone_rotation_do = NULL;
135 c->effect_funcs.zone_rotation_clear = NULL;
138 /* externally accessible functions */
139 E_Comp_Effect_Object *
140 _effect_mod_object_new(E_Comp_Layer *ly,
144 E_Comp_Effect_Object *o = NULL, *o2 = NULL;
146 E_CHECK_RETURN(ly, NULL);
147 E_CHECK_RETURN(cw, NULL);
148 traceBegin(TTRACE_TAG_WINDOW_MANAGER,"WM:COMP:EFFECT OBJECT NEW");
150 o2 = _effect_obj_find(cw);
151 if ((o2) && (recreate))
153 e_layout_unpack(o2->edje);
156 /* TODO: clean up previous effect job */
157 E_CHECK_RETURN(!o2, NULL);
159 o = E_NEW(E_Comp_Effect_Object, 1);
160 E_CHECK_RETURN(o, NULL);
162 o->edje = edje_object_add(ly->canvas->evas);
163 E_CHECK_GOTO(o->edje, fail);
165 e_mod_comp_layer_populate(ly, o->edje);
167 evas_object_data_set(o->edje, "comp.effect_obj.ly", ly);
168 evas_object_data_set(o->edje, "comp.effect_obj.cwin",
169 (void *)e_mod_comp_util_client_xid_get(cw));
171 res = _effect_obj_win_set(o, cw);
172 E_CHECK_GOTO(res, fail);
174 ly->objs = eina_list_append(ly->objs, o);
176 ELBF(ELBT_COMP, 0, o->cwin,
177 "%15.15s| OBJ_NEW %p", "EFFECT", o->edje);
179 traceEnd(TTRACE_TAG_WINDOW_MANAGER);
183 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
184 "%15.15s| OBJ_NEW Failed", "EFFECT");
189 e_layout_unpack(o->edje);
190 evas_object_del(o->edje);
194 traceEnd(TTRACE_TAG_WINDOW_MANAGER);
199 _effect_mod_object_free(E_Comp_Effect_Object *o)
203 #if SEND_LAUNCHING_DONE
204 if ((o->cwin) && (o->send_launching_done))
206 ecore_x_client_message32_send (o->cwin, ATOM_WINDOW_LAUNCHING_EFFECT_DONE,
207 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 0, 0, 0, 0, 0);
208 e_msg_send("comp.message", "launching.done", o->cwin, NULL, NULL, NULL, NULL);
212 if ((o->cwin) && (o->ev_vis))
213 e_comp_event_src_visibility_send(o->cwin, o->show);
215 if ((o->edje) && (o->img))
216 edje_object_part_unswallow(o->edje, o->img);
220 /* TODO: consider when using an xim */
221 evas_object_image_native_surface_set(o->img, NULL);
222 evas_object_image_size_set(o->img, 1, 1);
223 evas_object_image_data_set(o->img, NULL);
224 evas_object_hide(o->img);
225 evas_object_del(o->img);
228 if(o->edje && o->transp.rect)
230 edje_object_part_unswallow(o->edje,o->transp.rect);
233 if(o->edje && o->transp.offset)
235 edje_object_part_unswallow(o->edje,o->transp.offset);
240 evas_object_del(o->transp.offset);
241 o->transp.offset=NULL;
246 evas_object_del(o->transp.rect);
251 ecore_x_pixmap_free(o->pixmap);
255 evas_object_data_del(o->edje, "comp.effect_obj.ly");
256 evas_object_data_del(o->edje, "comp.effect_obj.cwin");
257 evas_object_hide(o->edje);
258 evas_object_del(o->edje);
261 ELBF(ELBT_COMP, 0, o->cwin,
262 "%15.15s| OBJ_FREE", "EFFECT");
264 memset(o, 0, sizeof(E_Comp_Effect_Object));
270 _effect_mod_object_win_set(E_Comp_Win *cw, const char *emission)
272 _effect_win_set(cw, emission, EINA_FALSE, EINA_FALSE, EINA_FALSE);
276 _effect_mod_above_wins_set(E_Comp_Win *cw, Eina_Bool show)
278 _effect_above_wins_set(cw, show, EINA_FALSE);
282 _effect_mod_signal_del(E_Comp_Win *cw,
286 return _effect_signal_del_intern(cw, obj, name, EINA_FALSE);
290 _effect_mod_jobs_clean(E_Comp_Win *cw,
294 return _effect_signal_del_intern(cw, obj, name, EINA_TRUE);
298 _effect_mod_signal_flush(void)
300 E_Comp_Effect_Job *job;
304 traceBegin(TTRACE_TAG_WINDOW_MANAGER,"WM:COMP:EFFECT SIGNAL FLUSH");
306 EINA_LIST_FOREACH(effect_jobs, l, job)
309 if (job->emitted) continue;
311 if ((job->win) && (job->canvas))
313 if ((cw = e_mod_comp_win_find(job->win)))
317 ELBF(ELBT_COMP, 0, job->cwin,
318 "%15.15s| SIG_PEND:%s", "EFFECT",
324 _effect_mod_animating_set(cw->c, cw, EINA_TRUE);
325 job->emitted = EINA_TRUE;
327 edje_object_signal_emit(job->o, job->emission, job->src);
329 ELBF(ELBT_COMP, 0, job->cwin,
330 "%15.15s| SIG_EMIT>%s", "EFFECT",
336 ELBF(ELBT_COMP, 0, job->cwin,
337 "%15.15s| SIG_DEL :%s", "EFFECT",
340 /* remove this job if cw was already removed */
341 effect_jobs = eina_list_remove(effect_jobs, job);
347 edje_object_signal_emit(job->o, job->emission, job->src);
349 ELBF(ELBT_COMP, 0, job->cwin,
350 "%15.15s| OBJ SIG_EMIT>%s", "EFFECT",
353 ly = evas_object_data_get(job->o, "comp.effect_obj.ly");
354 if (ly) e_mod_comp_layer_effect_set(ly, EINA_TRUE);
356 effect_jobs = eina_list_remove(effect_jobs, job);
361 traceEnd(TTRACE_TAG_WINDOW_MANAGER);
366 _effect_mod_type_new(void)
368 E_Comp_Effect_Type *t;
369 t = E_NEW(E_Comp_Effect_Type, 1);
370 E_CHECK_RETURN(t, 0);
371 t->animatable = EINA_TRUE;
376 _effect_mod_type_free(E_Comp_Effect_Type *type)
383 _effect_mod_type_setup(E_Comp_Effect_Type *type,
386 E_CHECK_RETURN(type, 0);
387 E_CHECK_RETURN(win, 0);
389 _effect_mod_state_setup(type, win);
390 _effect_mod_style_setup(type, win);
396 _effect_mod_state_setup(E_Comp_Effect_Type *type,
400 int ret, size_ret = 0;
401 unsigned long num_ret = 0, bytes = 0;
402 unsigned char *prop_ret = NULL;
403 Ecore_X_Display *dpy;
406 E_CHECK_RETURN(type, 0);
407 E_CHECK_RETURN(win, 0);
409 dpy = ecore_x_display_get();
410 ret = XGetWindowProperty(dpy, win, ATOM_WINDOW_EFFECT_ENABLE, 0, LONG_MAX,
411 False, ECORE_X_ATOM_CARDINAL, &type_ret, &size_ret,
412 &num_ret, &bytes, &prop_ret);
413 if (ret == 0) // success
415 if (prop_ret && num_ret)
417 type->animatable = prop_ret[0];
428 if (prop_ret) XFree(prop_ret);
433 _effect_mod_state_get(E_Comp_Effect_Type *type)
435 E_CHECK_RETURN(type, 0);
436 return type->animatable;
440 _effect_mod_state_set(E_Comp_Effect_Type *type, Eina_Bool state)
443 type->animatable = state;
448 _effect_mod_style_setup(E_Comp_Effect_Type *type,
451 Ecore_X_Atom *atoms = NULL;
452 Eina_Bool res = EINA_FALSE;
455 E_CHECK_RETURN(type, 0);
456 E_CHECK_RETURN(win, 0);
458 num = ecore_x_window_prop_atom_list_get
459 (win, ATOM_WINDOW_EFFECT_TYPE, &atoms);
460 E_CHECK_GOTO((num == 6), cleanup);
461 E_CHECK_GOTO(atoms, cleanup);
463 type->show = _effect_style_get(atoms[0]);
464 type->hide = _effect_style_get(atoms[1]);
465 type->restack = _effect_style_get(atoms[2]);
466 type->rotation = _effect_style_get(atoms[3]);
467 type->focusin = _effect_style_get(atoms[4]);
468 type->focusout = _effect_style_get(atoms[5]);
473 if (atoms) E_FREE(atoms);
478 _effect_mod_style_get(E_Comp_Effect_Type *type,
479 E_Comp_Effect_Kind kind)
481 E_Comp_Effect_Style res;
482 E_CHECK_RETURN(type, E_COMP_EFFECT_STYLE_NONE);
485 case E_COMP_EFFECT_KIND_SHOW: res = type->show; break;
486 case E_COMP_EFFECT_KIND_HIDE: res = type->hide; break;
487 case E_COMP_EFFECT_KIND_RESTACK: res = type->restack; break;
488 case E_COMP_EFFECT_KIND_ROTATION: res = type->rotation; break;
489 case E_COMP_EFFECT_KIND_FOCUSIN: res = type->focusin; break;
490 case E_COMP_EFFECT_KIND_FOCUSOUT: res = type->focusout; break;
491 default: res = E_COMP_EFFECT_STYLE_NONE; break;
496 #define _MAKE_EMISSION(f, x...) do { snprintf(emission, sizeof(emission), f, ##x); } while(0)
499 _effect_mod_win_restack(E_Comp_Win *cw,
503 Eina_Bool animatable = _effect_mod_state_get(cw->eff_type);
504 if (!((cw->c->animatable) && (animatable))) return;
505 if ((v1) == (v2)) return;
508 _effect_show(cw, EINA_FALSE);
510 _effect_hide(cw, EINA_FALSE);
512 _effect_home_active_unset(cw);
516 _effect_mod_win_show(E_Comp_Win *cw)
518 Eina_Bool animatable = _effect_mod_state_get(cw->eff_type);
519 Eina_Bool res = EINA_FALSE;
521 if (cw->c->fake_image_launch)
523 if ((_effect_mod_image_launch_window_check(cw->c->eff_img, cw)) &&
524 (_effect_mod_image_launch_running_check(cw->c->eff_img)))
526 if (_effect_mod_image_launch_fake_show_done_check(cw->c->eff_img))
528 #if SEND_LAUNCHING_DONE
529 _effect_mod_image_launch_window_set(cw->c->eff_img, cw->win);
531 _effect_mod_image_launch_disable(cw->c->eff_img);
536 _effect_mod_image_launch_window_set(cw->c->eff_img, cw->win);
542 if ((cw->c->animatable) && (animatable))
544 res = _effect_show(cw, EINA_TRUE);
548 /* for the composite window */
549 _effect_mod_signal_add(cw, NULL, "e,state,visible,on,noeffect", "e");
550 e_mod_comp_comp_event_src_visibility_send(cw);
553 e_comp_event_src_visibility_send
554 (e_mod_comp_util_client_xid_get(cw), EINA_TRUE);
557 _effect_home_active_unset(cw);
561 _effect_mod_win_hide(E_Comp_Win *cw)
563 Eina_Bool animatable, vis;
564 Eina_Bool res = EINA_FALSE;
566 animatable = _effect_mod_state_get(cw->eff_type);
567 vis = e_mod_comp_util_win_visible_get(cw, EINA_TRUE);
569 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
570 "%15.15s| CHECK visible:%d cw->visible:%d a:%d", "EFFECT",
571 vis, cw->visible, animatable);
573 if ((cw->c->animatable) && (animatable) && (vis))
575 res = _effect_hide(cw, EINA_TRUE);
578 /* for the composite window */
579 _effect_mod_signal_add(cw, NULL, "e,state,visible,off,noeffect", "e");
580 e_mod_comp_comp_event_src_visibility_send(cw);
583 e_comp_event_src_visibility_send
584 (e_mod_comp_util_client_xid_get(cw), EINA_TRUE);
587 _effect_home_active_unset(cw);
591 _effect_mod_signal_add(E_Comp_Win *cw,
593 const char *emission,
600 E_Comp_Effect_Job *job = NULL;
603 E_CHECK_RETURN((cw || o), 0);
604 E_CHECK_RETURN(emission, 0);
605 E_CHECK_RETURN(src, 0);
611 EINA_LIST_FOREACH(cw->objs, l, co)
614 if (!co->shadow) continue;
616 job = E_NEW(E_Comp_Effect_Job, 1);
621 job->cwin = e_mod_comp_util_client_xid_get(cw);
622 job->canvas = co->canvas;
624 len = sizeof(job->emission);
625 strncpy(job->emission, emission, len);
626 job->emission[len-1] = '\0';
628 len = sizeof(job->src);
629 strncpy(job->src, src, len);
630 job->src[len-1] = '\0';
632 effect_jobs = eina_list_append(effect_jobs, job);
634 e_mod_comp_hw_ov_win_msg_show
635 (E_COMP_LOG_TYPE_EFFECT,
637 job->cwin, emission);
642 job = E_NEW(E_Comp_Effect_Job, 1);
645 job->effect_obj = EINA_TRUE;
648 job->cwin = (Ecore_X_Window)evas_object_data_get(o, "comp.effect_obj.cwin");
650 len = sizeof(job->emission);
651 strncpy(job->emission, emission, len);
652 job->emission[len-1] = '\0';
654 len = sizeof(job->src);
655 strncpy(job->src, src, len);
656 job->src[len-1] = '\0';
658 effect_jobs = eina_list_append(effect_jobs, job);
664 ELBF(ELBT_COMP, 0, job->cwin,
665 "%15.15s| %s SIG_ADD:%s", "EFFECT",
666 job->effect_obj ? "OBJ" : " ",
674 _effect_mod_animating_set(E_Comp *c,
679 E_CHECK_RETURN(c, 0);
680 E_CHECK_GOTO(cw, postjob);
687 _state_send(cw, EINA_FALSE);
696 cw->animating = state;
697 _state_send(cw, state);
700 if (set) c->animating++;
705 /* local subsystem functions */
706 static E_Comp_Effect_Style
707 _effect_style_get(Ecore_X_Atom a)
709 E_CHECK_RETURN(a, E_COMP_EFFECT_STYLE_NONE);
711 if (a == ATOM_EFFECT_DEFAULT) return E_COMP_EFFECT_STYLE_DEFAULT;
712 else if (a == ATOM_EFFECT_NONE ) return E_COMP_EFFECT_STYLE_NONE;
713 else if (a == ATOM_EFFECT_CUSTOM0) return E_COMP_EFFECT_STYLE_CUSTOM0;
714 else if (a == ATOM_EFFECT_CUSTOM1) return E_COMP_EFFECT_STYLE_CUSTOM1;
715 else if (a == ATOM_EFFECT_CUSTOM2) return E_COMP_EFFECT_STYLE_CUSTOM2;
716 else if (a == ATOM_EFFECT_CUSTOM3) return E_COMP_EFFECT_STYLE_CUSTOM3;
717 else if (a == ATOM_EFFECT_CUSTOM4) return E_COMP_EFFECT_STYLE_CUSTOM4;
718 else if (a == ATOM_EFFECT_CUSTOM5) return E_COMP_EFFECT_STYLE_CUSTOM5;
719 else if (a == ATOM_EFFECT_CUSTOM6) return E_COMP_EFFECT_STYLE_CUSTOM6;
720 else if (a == ATOM_EFFECT_CUSTOM7) return E_COMP_EFFECT_STYLE_CUSTOM7;
721 else if (a == ATOM_EFFECT_CUSTOM8) return E_COMP_EFFECT_STYLE_CUSTOM8;
722 else if (a == ATOM_EFFECT_CUSTOM9) return E_COMP_EFFECT_STYLE_CUSTOM9;
724 return E_COMP_EFFECT_STYLE_NONE;
728 _state_send(E_Comp_Win *cw,
731 long d[5] = {0L, 0L, 0L, 0L, 0L};
733 E_CHECK_RETURN(cw, 0);
735 win = e_mod_comp_util_client_xid_get(cw);
736 E_CHECK_RETURN(win, 0);
738 if (state) d[0] = 1L;
741 ecore_x_client_message32_send
742 (win, ATOM_WINDOW_EFFECT_CLIENT_STATE,
743 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
744 d[0], d[1], d[2], d[3], d[4]);
750 _effect_signal_del_intern(E_Comp_Win *cw,
755 E_Comp_Effect_Job *job;
757 EINA_LIST_FOREACH(effect_jobs, l, job)
760 if (!job->emitted) continue;
761 if (!job->win) continue;
762 if (!job->canvas) continue;
764 Ecore_X_Window win = cw ? cw->win : 0;
767 ELBF(ELBT_COMP, 0, job->cwin,
768 "%15.15s| SIG_DEL :%s", "EFFECT",
771 e_mod_comp_hw_ov_win_msg_show
772 (E_COMP_LOG_TYPE_EFFECT,
774 job->win, job->emission);
776 effect_jobs = eina_list_remove(effect_jobs, job);
780 if (!clean_all) break;
787 _effect_win_transparent_rect( E_Comp_Win *cw,
788 E_Comp_Effect_Object *o,
791 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
792 "%15.15s| TRANSP_RECT_UPDATE[%d, %d %d %d %d]", "EFFECT",
793 cw->transp_rect.use, cw->transp_rect.x, cw->transp_rect.y,
794 cw->transp_rect.w, cw->transp_rect.h);
796 if (cw->transp_rect.use)
799 if (!o->transp.offset)
800 o->transp.offset = evas_object_rectangle_add(ly->canvas->evas);
802 o->transp.rect = evas_object_rectangle_add(ly->canvas->evas);
804 if ((o->transp.offset) && (o->transp.rect))
806 #ifdef _F_USE_BORDER_TRANSFORM_
807 if ((cw->bd) && (e_border_transform_enable_get(cw->bd)))
811 if (cw->bd->w != 0 && cw->bd->h != 0)
814 e_border_transform_get(cw->bd, 0, 0, &tw, &th, 0);
816 dw = (float)tw / (float)cw->bd->w;
817 dh = (float)th / (float)cw->bd->h;
819 if (o->transp.offset)
821 evas_object_size_hint_min_set(o->transp.offset,
822 (int)((float)cw->transp_rect.x * dw),
823 (int)((float)cw->transp_rect.y * dh));
827 evas_object_size_hint_min_set(o->transp.rect,
828 (int)((float)cw->transp_rect.w * dw),
829 (int)((float)cw->transp_rect.h * dh));
836 evas_object_size_hint_min_set(o->transp.offset,
839 evas_object_size_hint_min_set(o->transp.rect,
844 evas_object_color_set(o->transp.offset, 0,0,0,0);
845 evas_object_color_set(o->transp.rect, 0,0,0,0);
846 evas_object_render_op_set(o->transp.rect, EVAS_RENDER_COPY);
850 if (edje_object_part_exists(o->edje, "e.swallow.transp.offset"))
852 edje_object_part_swallow(o->edje,"e.swallow.transp.offset",o->transp.offset);
854 if (edje_object_part_exists(o->edje, "e.swallow.transp.rect"))
856 edje_object_part_swallow(o->edje,"e.swallow.transp.rect",o->transp.rect);
863 if (o->transp.offset)
867 if (edje_object_part_exists(o->edje, "e.swallow.transp.offset"))
869 edje_object_part_unswallow(o->edje, o->transp.offset);
872 evas_object_size_hint_min_set(o->transp.offset, 0, 0);
873 evas_object_color_set(o->transp.offset, 0, 0, 0, 0);
874 evas_object_del(o->transp.offset);
875 o->transp.offset = NULL;
881 if (edje_object_part_exists(o->edje, "e.swallow.transp.rect"))
883 edje_object_part_unswallow(o->edje, o->transp.rect);
886 evas_object_size_hint_min_set(o->transp.rect, 0, 0);
887 evas_object_color_set(o->transp.rect, 0, 0, 0, 0);
888 evas_object_render_op_set(o->transp.rect, EVAS_RENDER_BLEND);
889 evas_object_del(o->transp.rect);
890 o->transp.rect = NULL;
896 _effect_role_handle(E_Comp_Effect_Object *o)
905 hints = ecore_x_window_prop_string_get(o->cwin, ECORE_X_ATOM_WM_WINDOW_ROLE);
908 token = strtok(hints, " ,");
909 while (token != NULL)
911 if (!strncmp(token, "no-dim", strlen("no-dim")))
913 const char *file = NULL, *group = NULL;
914 edje_object_file_get(o->edje, &file, &group);
915 E_CHECK_GOTO(group, cleanup);
917 if (!strcmp(group, "dialog"))
918 edje_object_signal_emit(o->edje, "e,state,dim,off", "e");
920 token = strtok (NULL, " ,");
924 if (hints) free(hints);
928 _effect_obj_win_set(E_Comp_Effect_Object *o,
931 E_Comp_Object *co = NULL;
932 E_Comp_Layer *ly = NULL;
933 const char *file = NULL, *group = NULL;
934 int ok = 0, pw = 0, ph = 0;
937 ly = evas_object_data_get(o->edje, "comp.effect_obj.ly");
938 E_CHECK_RETURN(ly, EINA_FALSE);
939 E_CHECK_RETURN(ly->canvas, EINA_FALSE);
941 if(!cw->sync_info.version)
943 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
944 "%15.15s| Not Drawn", "EFFECT");
948 co = eina_list_nth(cw->objs, 0);
949 E_CHECK_RETURN(co, EINA_FALSE);
951 edje_object_file_get(co->shadow, &file, &group);
952 E_CHECK_RETURN(file, EINA_FALSE);
953 E_CHECK_RETURN(group, EINA_FALSE);
955 ok = edje_object_file_set(o->edje, file, group);
956 E_CHECK_RETURN(ok, EINA_FALSE);
958 o->img = evas_object_image_filled_add(ly->canvas->evas);
959 E_CHECK_RETURN(o->img, EINA_FALSE);
965 E_CHECK_GOTO((pw > 0), fail);
966 E_CHECK_GOTO((ph > 0), fail);
969 xim = ecore_x_image_new(pw, ph, cw->vis, cw->depth);
970 E_CHECK_GOTO(xim, fail);
971 pix = ecore_x_image_data_get(xim, NULL, NULL, NULL);
972 evas_object_image_size_set(o->img, pw, ph);
973 evas_object_image_data_set(o->img, pix);
974 evas_object_image_data_update_add(o->img, 0, 0, pw, ph);
975 if (ecore_x_image_get(xim, cw->win, 0, 0, 0, 0, pw, ph))
977 pix = ecore_x_image_data_get(xim, NULL, NULL, NULL);
978 evas_object_image_data_set(o->img, pix);
979 evas_object_image_data_update_add(o->img, 0, 0, pw, ph);
981 _effect_obj_win_shape_rectangles_apply(o, cw);
982 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
983 "%15.15s| SHAPED OBJ_NEW pix:0x%p %dx%d", "EFFECT",
988 evas_object_image_colorspace_set(o->img, EVAS_COLORSPACE_ARGB8888);
989 evas_object_image_smooth_scale_set(o->img, _comp_mod->conf->smooth_windows);
990 if (cw->argb) evas_object_image_alpha_set(o->img, 1);
991 else evas_object_image_alpha_set(o->img, 0);
993 /* set nocomp mode before getting named pixmap */
994 E_Comp_Win *nocomp_cw = e_mod_comp_util_win_nocomp_get(cw->c, ly->canvas->zone);
996 e_mod_comp_canvas_nocomp_end(ly->canvas);
998 o->pixmap = ecore_x_composite_name_window_pixmap_get(cw->win);
999 else if (cw->needpix)
1000 o->pixmap = e_mod_comp_util_copied_pixmap_get(cw);
1001 E_CHECK_GOTO(o->pixmap, fail);
1003 ecore_x_pixmap_geometry_get(o->pixmap, NULL, NULL, &pw, &ph);
1004 E_CHECK_GOTO((pw > 0), fail);
1005 E_CHECK_GOTO((ph > 0), fail);
1007 Evas_Native_Surface ns;
1008 ns.version = EVAS_NATIVE_SURFACE_VERSION;
1009 ns.type = EVAS_NATIVE_SURFACE_X11;
1010 ns.data.x11.visual = cw->vis;
1011 ns.data.x11.pixmap = o->pixmap;
1013 evas_object_image_size_set(o->img, pw, ph);
1014 evas_object_image_native_surface_set(o->img, &ns);
1015 evas_object_image_data_update_add(o->img, 0, 0, pw, ph);
1017 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1018 "%15.15s| OBJ_NEW pix:0x%x %dx%d", "EFFECT",
1022 _effect_win_transparent_rect(cw, o, ly);
1023 edje_object_part_swallow(o->edje, "e.swallow.content", o->img);
1024 #ifdef _F_USE_BORDER_TRANSFORM_
1025 if ((cw->bd) && (e_border_transform_enable_get(cw->bd)))
1028 e_border_transform_get(cw->bd, &x, &y, &w, &h, 0);
1029 e_layout_child_move(o->edje, x, y);
1030 e_layout_child_resize(o->edje, w, h);
1033 #endif /* end of _F_USE_BORDER_TRANSFORM_ */
1035 if (cw->dmg_updates)
1036 e_layout_child_move(o->edje, cw->x, cw->y);
1037 else if (cw->needpix)
1038 e_layout_child_move(o->edje, cw->resizing.x, cw->resizing.y);
1039 e_layout_child_resize(o->edje, pw, ph);
1042 edje_object_signal_callback_add(o->edje, "e,action,show,done", "e", _effect_obj_effect_done, o);
1043 edje_object_signal_callback_add(o->edje, "e,action,hide,done", "e", _effect_obj_effect_done, o);
1046 o->cwin = e_mod_comp_util_client_xid_get(cw);
1048 _effect_role_handle(o);
1055 evas_object_del(o->img);
1060 ecore_x_pixmap_free(o->pixmap);
1067 _effect_obj_win_shaped_check(int w,
1069 const Ecore_X_Rectangle *rects,
1072 if ((!rects) || (num < 1)) return EINA_FALSE;
1073 if (num > 1) return EINA_TRUE;
1074 if ((rects[0].x == 0) && (rects[0].y == 0) &&
1075 ((int)rects[0].width == w) && ((int)rects[0].height == h))
1081 _effect_obj_win_shape_rectangles_apply(E_Comp_Effect_Object *o,
1085 Ecore_X_Rectangle *rects = ecore_x_window_shape_rectangles_get(cw->win, &(num));
1086 int w, h, i, px, py;
1087 unsigned int *pix, *p;
1088 unsigned char *spix, *sp;
1092 for (i = 0; i < cw->rects_num; i++)
1094 E_RECTS_CLIP_TO_RECT(rects[i].x,
1098 0, 0, cw->pw, cw->ph);
1102 if (!_effect_obj_win_shaped_check(cw->pw, cw->ph, rects, num))
1111 evas_object_image_size_get(o->img, &w, &h);
1112 evas_object_image_alpha_set(o->img, 1);
1113 pix = evas_object_image_data_get(o->img, 1);
1117 spix = calloc(w * h, sizeof(unsigned char));
1120 for (i = 0; i < num; i++)
1124 rx = rects[i].x; ry = rects[i].y;
1125 rw = rects[i].width; rh = rects[i].height;
1126 E_RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, w, h);
1127 sp = spix + (w * ry) + rx;
1128 for (py = 0; py < rh; py++)
1130 for (px = 0; px < rw; px++)
1139 for (py = 0; py < h; py++)
1141 for (px = 0; px < w; px++)
1143 unsigned int mask, imask;
1144 mask = ((unsigned int)(*sp)) << 24;
1146 imask |= imask >> 8;
1147 imask |= imask >> 8;
1148 *p = mask | (*p & imask);
1155 evas_object_image_data_set(o->img, pix);
1156 evas_object_image_data_update_add(o->img, 0, 0, w, h);
1164 evas_object_image_size_get(o->img, &w, &h);
1166 evas_object_image_size_set(o->img, w, h);
1167 evas_object_image_alpha_set(o->img, 0);
1168 pix = evas_object_image_data_get(o->img, 1);
1173 for (py = 0; py < h; py++)
1175 for (px = 0; px < w; px++)
1179 evas_object_image_data_set(o->img, pix);
1180 evas_object_image_data_update_add(o->img, 0, 0, w, h);
1186 _effect_obj_effect_done(void *data,
1188 const char *emission __UNUSED__,
1189 const char *source __UNUSED__)
1191 E_Comp_Effect_Object *o = data;
1196 ly = evas_object_data_get(obj, "comp.effect_obj.ly");
1199 /* decrease effect count and hide effect layer if it is 0 */
1200 e_mod_comp_layer_effect_set(ly, EINA_FALSE);
1204 _effect_policy_border_transient_for_group_make(E_Border *bd,
1213 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1215 if (e_config->transient.raise)
1217 EINA_LIST_FOREACH(bd->transients, l, child)
1219 if (!child) continue;
1222 *list = eina_list_prepend(*list, child);
1223 _effect_policy_border_transient_for_group_make(child, list);
1230 _effect_policy_border_transient_for_border_top_get(E_Border *bd)
1232 E_Border *top_border = NULL;
1233 Eina_List *transient_list = NULL;
1235 _effect_policy_border_transient_for_group_make(bd, &transient_list);
1239 Eina_List *l = NULL;
1244 bl = e_container_border_list_last(bd->zone->container);
1247 while ((temp_bd = e_container_border_list_prev(bl)))
1249 if (top_border) break;
1250 if (temp_bd == bd) break;
1252 EINA_LIST_FOREACH(transient_list, l, temp_bd2)
1254 if (temp_bd == temp_bd2)
1256 top_border = temp_bd2;
1261 e_container_border_list_free(bl);
1265 eina_list_free(transient_list);
1271 _effect_win_set(E_Comp_Win *cw,
1272 const char *emission,
1277 E_Comp_Canvas *canvas;
1279 E_Comp_Effect_Object *o;
1280 E_Comp_Effect_Object *o2 = NULL;
1281 E_Comp_Effect_Object *o3 = NULL;
1283 canvas = eina_list_nth(cw->c->canvases, 0);
1284 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1287 o = _effect_mod_object_new(ly, cw, recreate);
1290 /* adjust the stack position of the given border to the above of
1291 * parent if border belongs to parent using 'transient_for'
1293 if ((cw->bd) && (cw->bd->parent))
1295 E_Comp_Win *cw2 = e_mod_comp_win_find(cw->bd->parent->win);
1298 E_Border *top_border = NULL;
1299 top_border = _effect_policy_border_transient_for_border_top_get(cw2->bd);
1302 E_Comp_Win *cw3 = e_mod_comp_border_client_find(top_border->client.win);
1304 o3 = _effect_obj_find(cw3);
1306 o2 = _effect_obj_find(cw2);
1309 e_layout_child_raise_above(o->edje, o3->edje);
1311 e_layout_child_raise_above(o->edje, o2->edje);
1315 evas_object_show(o->img);
1316 evas_object_show(o->edje);
1317 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1318 #if SEND_LAUNCHING_DONE
1319 if ( strncmp(emission,"e,state,visible,on,",strlen("e,state,visible,on,")) == 0 )
1320 o->send_launching_done = 0;
1321 else if ( strncmp(emission,"e,state,visible,on",strlen("e,state,visible,on")) == 0 )
1322 o->send_launching_done = 1;
1324 o->send_launching_done = 0;
1328 /* add shadow on floating mode window while doing effect */
1329 if (STATE_INSET_CHECK(cw))
1330 edje_object_signal_emit(o->edje, "e,state,shadow,on", "e");
1335 o->ev_vis = send_ev;
1343 _effect_win_lower(E_Comp_Win *cw,
1344 const char *emission,
1347 E_Comp_Canvas *canvas;
1349 E_Comp_Effect_Object *o;
1351 canvas = eina_list_nth(cw->c->canvases, 0);
1352 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1356 o = _effect_mod_object_new(ly, cw, recreate);
1359 evas_object_show(o->img);
1360 evas_object_show(o->edje);
1361 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1363 e_layout_child_lower(o->edje);
1364 e_mod_comp_layer_bg_adjust(ly);
1370 _effect_below_wins_set(E_Comp_Win *cw,
1373 E_Comp_Canvas *canvas;
1375 E_Comp_Effect_Object *o;
1377 E_Comp_Win *_cw = cw, *nocomp_cw = NULL;
1380 Eina_Bool bg_noeffect = EINA_FALSE;
1382 _MAKE_EMISSION("e,state,visible,on,noeffect");
1383 if (TYPE_KEYBOARD_CHECK(cw) ||
1384 STATE_INSET_CHECK(cw) ||
1386 bg_noeffect = EINA_TRUE;
1388 canvas = eina_list_nth(cw->c->canvases, 0);
1389 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1392 zone = canvas->zone;
1395 nocomp_cw = e_mod_comp_util_win_nocomp_get(cw->c, zone);
1396 #if USE_NOCOMP_DISPOSE
1397 E_Comp_Win *nocomp_end_cw = e_mod_comp_util_win_nocomp_end_get(cw->c, zone);
1400 /* create effect objects until finding a non-alpha full-screen window */
1401 while ((l = EINA_INLIST_GET(_cw)->prev))
1403 _cw = _EINA_INLIST_CONTAINER(_cw, l);
1405 if (TYPE_HOME_CHECK(_cw) && !bg_noeffect)
1406 _MAKE_EMISSION("e,state,background,visible,on");
1408 if (!(_cw->visible)) continue;
1409 if (_cw->invalid) continue;
1410 if (_cw->input_only) continue;
1411 if (!E_INTERSECTS_EFFECT(_cw, zone->x, zone->y, zone->w, zone->h))
1414 /* if nocomp exist, change mode to the composite mode */
1415 if ((nocomp_cw) && (nocomp_cw == _cw))
1417 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(_cw),
1418 "%15.15s| END EFFECT_OBJ_NEW", "NOCOMP");
1419 e_mod_comp_canvas_nocomp_end(canvas);
1421 #if USE_NOCOMP_DISPOSE
1422 else if ((nocomp_end_cw) && (nocomp_end_cw == _cw))
1424 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(_cw),
1425 "%15.15s| ENDED EFFECT_OBJ_NEW", "NOCOMP");
1428 else if (!((_cw->pixmap) &&
1429 (_cw->pw > 0) && (_cw->ph > 0)))
1434 o = _effect_mod_object_new(ly, _cw, recreate);
1437 evas_object_show(o->img);
1438 evas_object_show(o->edje);
1439 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1442 /* add shadow on floating mode window while doing effect */
1443 if (STATE_INSET_CHECK(_cw))
1444 edje_object_signal_emit(o->edje, "e,state,shadow,on", "e");
1447 /* change the stack position of the object to the bottom
1448 * of layer and also background object too
1450 e_layout_child_lower(o->edje);
1451 e_mod_comp_layer_bg_adjust(ly);
1454 /* found a non-alpha full-screen window */
1455 if ((REGION_EQUAL_TO_ZONE(_cw, zone)) && !(_cw->argb))
1461 _effect_below_floating_wins_set(E_Comp_Win *cw,
1465 E_Comp_Canvas *canvas;
1467 E_Comp_Effect_Object *o;
1469 E_Comp_Win *_cw = cw;
1473 canvas = eina_list_nth(cw->c->canvases, 0);
1474 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1477 zone = canvas->zone;
1480 while ((l = EINA_INLIST_GET(_cw)->prev))
1482 _cw = _EINA_INLIST_CONTAINER(_cw, l);
1484 if (!(_cw->visible)) continue;
1485 if ((REGION_EQUAL_TO_ZONE(_cw, zone)) && !(_cw->argb) && (!TYPE_VIDEO_CALL_CHECK(_cw))) break;
1487 _MAKE_EMISSION("e,state,visible,on,noeffect");
1489 o = _effect_mod_object_new(ly, _cw, recreate);
1492 evas_object_show(o->img);
1493 evas_object_show(o->edje);
1494 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1496 edje_object_signal_emit(o->edje, "e,state,shadow,on", "e");
1499 /* change the stack position of the object to the bottom
1500 * of layer and also background object too
1502 e_layout_child_lower(o->edje);
1503 e_mod_comp_layer_bg_adjust(ly);
1510 _effect_home_active_below_wins_set(E_Comp_Win *cw,
1514 E_Comp_Canvas *canvas;
1516 E_Comp_Effect_Object *o;
1518 E_Comp_Win *_cw = cw;
1522 canvas = eina_list_nth(cw->c->canvases, 0);
1523 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1526 zone = canvas->zone;
1529 while ((l = EINA_INLIST_GET(_cw)->prev))
1531 _cw = _EINA_INLIST_CONTAINER(_cw, l);
1533 if (!(_cw->visible)) continue;
1534 if (TYPE_HOME_CHECK(_cw)) break;
1536 if (STATE_INSET_CHECK(_cw))
1537 _MAKE_EMISSION("e,state,visible,on,noeffect");
1539 _MAKE_EMISSION("e,state,visible,off");
1541 if (TYPE_VIDEO_CALL_CHECK(cw) && TYPE_VIDEO_CALL_CHECK(_cw))
1543 if (REGION_EQUAL_TO_ZONE(_cw, zone))
1544 _MAKE_EMISSION("e,state,visible,off");
1549 o = _effect_mod_object_new(ly, _cw, recreate);
1552 evas_object_show(o->img);
1553 evas_object_show(o->edje);
1554 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1556 edje_object_signal_emit(o->edje, "e,state,shadow,on", "e");
1559 /* change the stack position of the object to the bottom
1560 * of layer and also background object too
1562 e_layout_child_lower(o->edje);
1563 e_mod_comp_layer_bg_adjust(ly);
1566 if ((REGION_EQUAL_TO_ZONE(_cw, zone)) && !(_cw->argb) && (!TYPE_VIDEO_CALL_CHECK(_cw))) break;
1571 _effect_above_wins_set(E_Comp_Win *cw,
1575 E_Comp_Canvas *canvas;
1577 E_Comp_Effect_Object *o;
1579 E_Comp_Win *_cw = cw;
1582 E_Comp_Win *parent_cw = NULL;
1584 canvas = eina_list_nth(cw->c->canvases, 0);
1585 ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1588 zone = canvas->zone;
1591 while ((l = EINA_INLIST_GET(_cw)->next))
1593 _cw = _EINA_INLIST_CONTAINER(_cw, l);
1594 if (!(_cw->visible)) continue;
1595 if (_cw->invalid) continue;
1596 if (_cw->input_only) continue;
1597 if (!E_INTERSECTS_EFFECT(_cw, zone->x, zone->y, zone->w, zone->h))
1599 if (!((_cw->pixmap) &&
1600 (_cw->pw > 0) && (_cw->ph > 0)))
1603 if ((TYPE_KEYBOARD_SUB_CHECK(_cw)) && (!show)) continue;
1605 if ((REGION_EQUAL_TO_ZONE(_cw, zone)) && (!_cw->argb)) continue;
1607 if ((_cw->bd) && (_cw->bd->parent))
1609 parent_cw = e_mod_comp_win_find(_cw->bd->parent->win);
1612 if ((parent_cw) && (parent_cw == cw) && (!show))
1613 _MAKE_EMISSION("e,state,visible,off");
1615 _MAKE_EMISSION("e,state,visible,on,noeffect");
1617 if ((TYPE_KEYBOARD_CHECK(_cw)) && (!show))
1619 if (cw->c->keyboard_effect && (!PARENT_FLOAT_CHECK(_cw)))
1621 if (_effect_mod_win_angle_get(_cw))
1622 _MAKE_EMISSION("e,state,visible,off,angle,%d", _cw->angle);
1624 _MAKE_EMISSION("e,state,visible,off,angle,0");
1626 else if (!cw->c->keyboard_effect)
1630 o = _effect_mod_object_new(ly, _cw, recreate);
1633 evas_object_show(o->img);
1634 evas_object_show(o->edje);
1635 _effect_mod_signal_add(NULL, o->edje, emission, "e");
1638 /* add shadow on floating mode window while doing effect */
1639 if (STATE_INSET_CHECK(_cw))
1640 edje_object_signal_emit(o->edje, "e,state,shadow,on", "e");
1646 static E_Comp_Effect_Object *
1647 _effect_object_control_layer_new(E_Comp_Layer *ly, E_Comp_Win *cw)
1649 E_Comp_Effect_Object *o = NULL;
1652 E_CHECK_RETURN(ly, NULL);
1653 E_CHECK_RETURN(ly->canvas, NULL);
1654 E_CHECK_RETURN(cw, NULL);
1656 E_Comp_Layer *effect_ly = e_mod_comp_canvas_layer_get(ly->canvas, "effect");
1657 E_CHECK_GOTO(effect_ly, fail);
1659 o = E_NEW(E_Comp_Effect_Object, 1);
1660 E_CHECK_GOTO(o, fail);
1662 o->edje = edje_object_add(ly->canvas->evas);
1663 E_CHECK_GOTO(o->edje, fail);
1665 e_mod_comp_layer_populate(effect_ly, o->edje);
1667 evas_object_data_set(o->edje, "comp.effect_obj.ly", effect_ly);
1669 E_Comp_Object *co = NULL;
1670 const char *file = NULL, *group = NULL;
1672 co = eina_list_nth(cw->objs, 0);
1673 E_CHECK_GOTO(co, fail);
1675 edje_object_file_get(co->shadow, &file, &group);
1676 E_CHECK_GOTO(file, fail);
1677 E_CHECK_GOTO(group, fail);
1679 ok = edje_object_file_set(o->edje, file, "no-effect");
1680 E_CHECK_GOTO(ok, fail);
1682 o->img = evas_object_image_filled_add(ly->canvas->evas);
1683 E_CHECK_GOTO(o->img, fail);
1685 evas_object_image_source_set(o->img, ly->layout);
1686 edje_object_part_swallow(o->edje, "e.swallow.content", o->img);
1688 e_layout_child_move(o->edje, ly->x, ly->y);
1689 e_layout_child_resize(o->edje, ly->w, ly->h);
1691 evas_object_show(o->img);
1692 evas_object_show(o->edje);
1694 edje_object_signal_callback_add(o->edje, "e,action,show,done", "e", _effect_obj_effect_done, o);
1695 edje_object_signal_callback_add(o->edje, "e,action,hide,done", "e", _effect_obj_effect_done, o);
1700 effect_ly->objs = eina_list_append(effect_ly->objs, o);
1707 if (o->img) evas_object_del(o->img);
1711 e_layout_unpack(o->edje);
1712 evas_object_del(o->edje);
1723 _effect_control_layer_set(E_Comp_Win *cw)
1725 E_Comp_Canvas *canvas = NULL;
1726 E_Comp_Layer *ctrl_ly = NULL;
1727 E_Comp_Layer *comp_ly = NULL;
1728 Eina_Bool ctrl_visible;
1729 Eina_List *lm = NULL;
1731 Evas_Object *member = NULL;
1732 Evas_Object *active_shadow = NULL;
1733 Eina_Bool find_ctrl_ly = EINA_FALSE;
1735 E_Comp_Win *active_window = NULL;
1739 canvas = eina_list_nth(cw->c->canvases, 0);
1740 ctrl_ly = e_mod_comp_canvas_layer_get(canvas, "ly-ctrl");
1743 ctrl_visible = evas_object_visible_get(ctrl_ly->layout);
1744 E_CHECK(ctrl_visible);
1746 comp_ly = e_mod_comp_canvas_layer_get(canvas, "comp");
1749 lm = evas_object_smart_members_get(comp_ly->layout);
1752 EINA_LIST_REVERSE_FOREACH(lm, ll, member)
1754 if (member == ctrl_ly->layout)
1756 find_ctrl_ly = EINA_TRUE;
1759 if ((find_ctrl_ly) && (evas_object_visible_get(member)))
1761 active_shadow = member;
1766 E_CHECK(active_shadow);
1768 EINA_INLIST_REVERSE_FOREACH(cw->c->wins, _cw)
1770 EINA_LIST_FOREACH(_cw->objs, l, co)
1773 if (co->shadow == active_shadow)
1775 active_window = _cw;
1780 E_CHECK(active_window);
1782 E_Comp_Effect_Object *active_window_object = _effect_obj_find(active_window);
1783 E_CHECK(active_window_object);
1785 E_Comp_Effect_Object *control_layer_object = _effect_object_control_layer_new(ctrl_ly, active_window);
1786 E_CHECK(control_layer_object);
1788 _MAKE_EMISSION("e,state,visible,on,noeffect");
1789 _effect_mod_signal_add(NULL, control_layer_object->edje, emission, "e");
1791 e_layout_child_raise_above(control_layer_object->edje, active_window_object->edje);
1794 static E_Comp_Effect_Object *
1795 _effect_obj_find(E_Comp_Win *cw)
1797 E_Comp_Canvas *canvas = eina_list_nth(cw->c->canvases, 0);
1798 E_CHECK_RETURN(canvas, NULL);
1800 E_Comp_Layer *ly = e_mod_comp_canvas_layer_get(canvas, "effect");
1801 E_CHECK_RETURN(ly, NULL);
1804 E_Comp_Effect_Object *o;
1805 EINA_LIST_FOREACH(ly->objs, l, o)
1808 if (o->win == cw->win)
1810 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1811 "%15.15s| OBJ already exists!", "EFFECT");
1819 /* send_ev: indicates that comp sends the E_EVENT_COMP_SOURCE_VISIBILITY event
1820 * when effect is done. show and hide effects will set this to true, but restack
1821 * effect sets false.
1824 _effect_show(E_Comp_Win *cw,
1827 E_Comp_Effect_Style st;
1829 E_Comp_Win *cw2 = NULL, *cw_below = NULL, *home_cw = NULL;
1830 E_Comp_Effect_Object *o = NULL;
1831 Eina_Bool launch, vis, res = EINA_FALSE;
1832 Eina_Bool recreate = EINA_FALSE;
1834 E_CHECK_RETURN(cw, EINA_FALSE);
1836 o = _effect_obj_find(cw);
1837 E_CHECK_RETURN(!o, EINA_FALSE);
1839 /* check effect condition and make emission string */
1840 st = _effect_mod_style_get(cw->eff_type, E_COMP_EFFECT_KIND_SHOW);
1841 vis = e_mod_comp_util_win_visible_get(cw, EINA_TRUE);
1843 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1844 "%15.15s|SHOW", "EFFECT");
1846 if (E_COMP_EFFECT_STYLE_DEFAULT == st)
1848 launch = e_mod_comp_policy_app_launch_check(cw);
1851 home_cw = e_mod_comp_util_win_home_get(NULL);
1853 if ((cw->depth == 32) && (home_cw) && (_effect_obj_find(home_cw)))
1855 cw2 = e_mod_comp_util_win_normal_get(NULL, EINA_TRUE);
1856 if ((cw2) && (cw2 == cw))
1858 /* when 32bit window(Transient for) is resumed*/
1859 _effect_below_wins_set(cw, recreate);
1860 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1861 "%15.15s|>FG", "EFFECT");
1862 _MAKE_EMISSION("e,state,visible,on");
1863 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1864 _effect_above_wins_set(cw, EINA_TRUE, recreate);
1865 _effect_control_layer_set(cw);
1868 else if ((cw2) && (cw2 != cw))
1870 /* when a stack of window lowered above 32bit window. */
1871 recreate = EINA_TRUE;
1872 _MAKE_EMISSION("e,state,visible,on,noeffect");
1873 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1875 _MAKE_EMISSION("e,state,visible,off");
1876 _effect_win_set(cw2, emission, send_ev, EINA_TRUE, recreate);
1878 _effect_above_wins_set(cw, EINA_TRUE, recreate);
1879 _effect_control_layer_set(cw);
1885 _effect_below_wins_set(cw, recreate);
1887 int full_child_count = 0;
1888 E_Comp_Win *full_child_cw = NULL;
1890 if ((cw->bd) && (cw->bd->transients))
1892 E_Border *child_border = NULL;
1893 E_Zone *zone = cw->bd->zone;
1896 EINA_LIST_FOREACH(cw->bd->transients, l, child_border)
1898 E_Comp_Win *child_cw = e_mod_comp_border_client_find(child_border->client.win);
1899 if ((child_cw) && (zone))
1901 if ((zone) && (REGION_EQUAL_TO_ZONE(child_cw, zone)))
1903 full_child_cw = child_cw;
1910 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1911 "%15.15s|>FG(Child : 0x%08x) A : %d", "EFFECT",
1912 full_child_cw ? e_mod_comp_util_client_xid_get(full_child_cw): 0,
1913 full_child_cw ? full_child_cw->argb : 0);
1914 _MAKE_EMISSION("e,state,visible,on");
1915 if ((full_child_count == 1) && full_child_cw)
1917 if (full_child_cw->argb)
1919 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1920 _effect_win_set(full_child_cw, emission, send_ev, EINA_TRUE, recreate);
1923 _effect_win_set(full_child_cw, emission, send_ev, EINA_TRUE, recreate);
1926 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1927 _effect_above_wins_set(cw, EINA_TRUE, recreate);
1928 _effect_control_layer_set(cw);
1932 else if ((TYPE_KEYBOARD_CHECK(cw)) && (vis))
1934 if (cw->c->keyboard_effect)
1936 _effect_below_wins_set(cw, recreate);
1938 E_Zone *zone = NULL;
1939 if ((cw->bd) && (cw->bd->zone))
1940 zone = cw->bd->zone;
1942 if ((zone) && (zone->rot.block_count))
1943 _MAKE_EMISSION("e,state,visible,on,noeffect");
1944 else if (_effect_mod_win_angle_get(cw))
1945 _MAKE_EMISSION("e,state,window,angle,%d", cw->angle);
1947 _MAKE_EMISSION("e,state,window,angle,0");
1949 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1950 _effect_above_wins_set(cw, EINA_TRUE, recreate);
1951 _effect_control_layer_set(cw);
1955 else if ((STATE_INSET_CHECK(cw)) && (vis))
1957 cw2 = e_mod_comp_util_win_normal_get(NULL, EINA_TRUE);
1958 if ((cw2) && (cw2->depth == 32) && (_effect_obj_find(cw2)))
1960 recreate = EINA_TRUE;
1961 _MAKE_EMISSION("e,state,visible,on,noeffect");
1962 _effect_win_set(cw2, emission, EINA_FALSE, EINA_TRUE, EINA_TRUE);
1965 _effect_below_wins_set(cw, recreate);
1967 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
1968 "%15.15s|>FG", "EFFECT");
1970 _MAKE_EMISSION("e,state,visible,on");
1971 _effect_win_set(cw, emission, send_ev, EINA_TRUE, recreate);
1972 _effect_above_wins_set(cw, EINA_TRUE, recreate);
1973 _effect_control_layer_set(cw);
1976 /* in most cases, border show events of home window are generated
1977 * by pressing the h/w home button. at that moment, home window
1978 * is invisible thus the wm doesn't need to check visibility for
1979 * home window. just make app closing effect except lock and
1980 * setup wizard window.
1982 else if (TYPE_HOME_CHECK(cw) && (cw->activate))
1984 Eina_Bool animatable = EINA_FALSE;
1985 /* app window hide effect by pressing the h/w home button */
1986 cw2 = e_mod_comp_util_win_normal_get(NULL, EINA_FALSE);
1989 animatable = _effect_mod_state_get(cw2->eff_type);
1994 /* in case after hide effect proccessed already */
1995 if ((cw2) && (_effect_obj_find(cw2)))
1998 if ((cw2) && (cw2->bd) && (_effect_active_except_bd_check(cw2->bd)))
2000 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw2),
2001 "%15.15s|>BG HOME 0x%08x FG 0x%08x except_bd SKIP", "EFFECT",
2002 e_mod_comp_util_client_xid_get(cw),
2003 e_mod_comp_util_client_xid_get(cw2));
2007 /* In case of that Notification window show*/
2009 (cw2->win_type == E_COMP_WIN_TYPE_NOTIFICATION))
2011 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw2),
2012 "%15.15s|>BG HOME 0x%08x FG 0x%08x Notification SKIP", "EFFECT",
2013 e_mod_comp_util_client_xid_get(cw),
2014 e_mod_comp_util_client_xid_get(cw2));
2018 /* In case of that quickpanel window show*/
2020 (cw2->win_type == E_COMP_WIN_TYPE_QUICKPANEL))
2022 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw2),
2023 "%15.15s|>BG HOME 0x%08x FG 0x%08x quickpanel SKIP", "EFFECT",
2024 e_mod_comp_util_client_xid_get(cw),
2025 e_mod_comp_util_client_xid_get(cw2));
2029 /* In case of that no-effect 32bit windows show */
2031 (cw2->win_type == E_COMP_WIN_TYPE_UTILITY))
2033 if (cw2->depth == 32)
2037 cw_below = e_mod_comp_util_win_below_get(cw2, EINA_FALSE, EINA_FALSE);
2038 if ((cw_below) && (cw_below->depth == 32))
2043 /* In case of minimizing. */
2044 if ((cw2) && STATE_INSET_CHECK(cw2))
2046 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw2),
2047 "%15.15s|>BG HOME 0x%08x FG 0x%08x Minimize SKIP", "EFFECT",
2048 e_mod_comp_util_client_xid_get(cw),
2049 e_mod_comp_util_client_xid_get(cw2));
2053 /* In case of pressing home button when top normal window transients for floating window. */
2054 if ((cw2) && (PARENT_FLOAT_CHECK(cw2)))
2059 /* When top app window is stacked lower already.
2060 * it is observed in case of a top window is 32bit windows.
2062 if ((cw2) && (cw2 == cw))
2064 cw_below = e_mod_comp_util_win_below_get(cw, EINA_FALSE, EINA_FALSE);
2065 if ((cw_below) && (cw_below->depth == 32))
2072 /* do nothing, if cw2 is such exceptional windows as lock
2073 * and setup wizard window. this case usually happens when
2074 * system is booting. (first show of the home window)
2076 res = e_mod_comp_policy_home_app_win_check(cw2);
2078 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2079 "%15.15s|>BG HOME 0x%08x FG 0x%08x SKIP:%d", "EFFECT",
2080 e_mod_comp_util_client_xid_get(cw),
2081 e_mod_comp_util_client_xid_get(cw2),
2084 E_CHECK_RETURN(res, EINA_FALSE);
2085 /* not enough to add effect to above wins.
2086 * because it can be possible to stack cw2 above floating wins.
2087 * typically, the case of that cw transients for any floating windows.
2089 _effect_home_active_below_wins_set(cw2, EINA_FALSE, recreate);
2091 _MAKE_EMISSION("e,state,visible,on,noeffect");
2092 _effect_win_lower(cw, emission, recreate);
2094 _MAKE_EMISSION("e,state,visible,off");
2095 _effect_win_set(cw2, emission, EINA_FALSE, EINA_FALSE, recreate);
2097 /* in order to show 'keyboard hide effect with 'app window hide effect',
2098 * 'show' argument should be passed to false
2100 _effect_above_wins_set(cw2, EINA_FALSE, recreate);
2101 _effect_control_layer_set(cw);
2110 _effect_hide(E_Comp_Win *cw,
2113 E_Comp_Effect_Style st;
2115 E_Comp_Win *cw2 = NULL, *home_cw = NULL;
2116 E_Comp_Effect_Object *o = NULL;
2117 Eina_Bool close, res = EINA_FALSE;
2118 Eina_Bool recreate = EINA_FALSE;
2120 o = _effect_obj_find(cw);
2122 /* check effect condition and make emission string */
2123 st = _effect_mod_style_get(cw->eff_type, E_COMP_EFFECT_KIND_HIDE);
2125 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2126 "%15.15s|HIDE", "EFFECT");
2128 if (E_COMP_EFFECT_STYLE_DEFAULT == st)
2130 close = e_mod_comp_policy_app_close_check(cw);
2132 if ((!close) && (o))
2137 /* not enough to add effect to above wins.
2138 * because it can be possible to stack cw above floating wins.
2139 * typically, the case of that cw transients for any floating windows.
2140 * when hide effect runs on a normal window, change to show only below floating windows not all below windows.
2142 _effect_below_floating_wins_set(cw, EINA_TRUE, recreate);
2144 /* background window */
2145 cw2 = e_mod_comp_util_win_normal_get(cw, EINA_TRUE);
2147 /* when 32bit window hides effect doesn't work,
2148 * because there are effect object of the window already (home show effect).
2149 * so it need to be handled exceptionally.
2151 if ((cw2) && (cw2->depth == 32) && (o))
2153 home_cw = e_mod_comp_util_win_home_get(cw);
2154 if ((home_cw) && (_effect_obj_find(home_cw)))
2156 recreate = EINA_TRUE;
2157 _MAKE_EMISSION("e,state,visible,on,noeffect");
2158 _effect_win_set(cw2, emission, send_ev, EINA_FALSE, EINA_TRUE);
2169 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2170 "%15.15s|>BG 0x%08x", "EFFECT",
2171 e_mod_comp_util_client_xid_get(cw2));
2174 _MAKE_EMISSION("e,state,visible,on,noeffect");
2176 _MAKE_EMISSION("e,state,background,visible,off");
2178 _effect_win_lower(cw2, emission, recreate);
2181 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2182 "%15.15s|>FG", "EFFECT");
2184 _MAKE_EMISSION("e,state,visible,off");
2185 _effect_win_set(cw, emission, send_ev, EINA_FALSE, recreate);
2186 _effect_above_wins_set(cw, EINA_FALSE, recreate);
2187 _effect_control_layer_set(cw);
2191 else if (TYPE_KEYBOARD_CHECK(cw))
2193 if (cw->c->keyboard_effect)
2195 _effect_below_wins_set(cw, recreate);
2197 E_Zone *zone = NULL;
2198 if ((cw->bd) && (cw->bd->zone))
2199 zone = cw->bd->zone;
2201 if ((zone) && (zone->rot.block_count))
2202 _MAKE_EMISSION("e,state,visible,off,noeffect");
2203 else if (_effect_mod_win_angle_get(cw))
2204 _MAKE_EMISSION("e,state,visible,off,angle,%d", cw->angle);
2206 _MAKE_EMISSION("e,state,visible,off,angle,0");
2208 _effect_win_set(cw, emission, send_ev, EINA_FALSE, recreate);
2209 _effect_above_wins_set(cw, EINA_FALSE, recreate);
2210 _effect_control_layer_set(cw);
2215 else if (STATE_INSET_CHECK(cw))
2217 _effect_below_wins_set(cw, recreate);
2219 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2220 "%15.15s|>FG", "EFFECT");
2222 _MAKE_EMISSION("e,state,visible,off");
2223 _effect_win_set(cw, emission, send_ev, EINA_FALSE, recreate);
2224 _effect_above_wins_set(cw, EINA_FALSE, recreate);
2225 _effect_control_layer_set(cw);
2233 _effect_active_except_bd_check(E_Border *bd)
2235 const char *name = NULL;
2236 const char *clas = NULL;
2238 if (!bd) return EINA_FALSE;
2240 name = bd->client.icccm.name;
2241 clas = bd->client.icccm.class;
2243 if (!clas) return EINA_FALSE;
2244 if (!name) return EINA_FALSE;
2245 if (strncmp(clas,"setting_encrypting_menu", strlen("setting_encrypting_menu")) == 0) return EINA_TRUE;
2246 if (strncmp(name,"com.samsung.setting.encrypting", strlen("com.samsung.setting.encrypting")) == 0) return EINA_TRUE;
2252 _effect_home_active_unset(E_Comp_Win *cw)
2255 E_CHECK(TYPE_HOME_CHECK(cw));
2256 E_CHECK(cw->c->animatable);
2257 E_CHECK(cw->activate);
2259 ELBF(ELBT_COMP, 0, e_mod_comp_util_client_xid_get(cw),
2260 "%s", "HOME ACTIVE Unset");