1 #include "e_mod_comp_shared_types.h"
2 #include "e_mod_comp.h"
3 #include "e_mod_comp_debug.h"
4 #include "e_mod_comp_policy.h"
6 /* local subsystem functions */
7 static E_Comp_Win *_transient_parent_find(E_Comp_Win *cw);
9 /* local subsystem globals */
10 static Eina_Hash *shadow_hash = NULL;
12 /* externally accessible functions */
14 e_mod_comp_policy_init(void)
16 if (!shadow_hash) shadow_hash = eina_hash_string_superfast_new(NULL);
18 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_UNKNOWN), "shadow" );
19 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DESKTOP), "no-effect" );
20 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DOCK), "shadow_fade" );
21 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_TOOLBAR), "no-effect" );
22 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_MENU), "no-effect" );
23 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_UTILITY), "no-effect" );
24 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_SPLASH), "no-effect" );
25 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DIALOG), "dialog" );
26 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_NORMAL), "shadow_fade" );
27 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DROPDOWN_MENU), "no-effect" );
28 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_POPUP_MENU), "shadow" );
29 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_TOOLTIP), "shadow" );
30 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_NOTIFICATION), "dialog" );
31 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_COMBO), "no-effect" );
32 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DND), "no-effect" );
33 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_MENUSCREEN), "home_screen" );
34 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_QUICKPANEL_BASE),"quickpanel" );
35 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_QUICKPANEL), "quickpanel" );
36 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_TASKMANAGER), "taskmgr" );
37 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_LIVEMAGAZINE), "home_screen" );
38 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_LOCKSCREEN), "lockscreen" );
39 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_INDICATOR), "indicator" );
40 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_TICKERNOTI), "dialog_without_dim");
41 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_DEBUGGING_INFO), "no-effect" );
42 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_APPTRAY), "app_tray" );
43 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_MINI_APPTRAY), "app_tray" );
44 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_VOLUME), "dialog_without_dim");
45 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_BACKGROUND), "no-effect" );
46 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_ISF_KEYBOARD), "keyboard" );
47 eina_hash_add(shadow_hash, e_util_winid_str_get(E_COMP_WIN_TYPE_ISF_SUB), "no-effect" );
53 e_mod_comp_policy_shutdown(void)
55 if (shadow_hash) eina_hash_free(shadow_hash);
61 e_mod_comp_policy_app_launch_check(E_Comp_Win *cw)
63 E_CHECK_RETURN(cw, 0);
64 E_CHECK_RETURN(cw->bd, 0);
65 E_CHECK_RETURN(cw->bd->zone, 0);
66 if (TYPE_NORMAL_CHECK(cw) && REGION_EQUAL_TO_ZONE(cw, cw->bd->zone))
72 e_mod_comp_policy_app_close_check(E_Comp_Win *cw)
74 E_CHECK_RETURN(cw, 0);
75 E_CHECK_RETURN(cw->bd, 0);
76 E_CHECK_RETURN(cw->bd->zone, 0);
77 if (TYPE_NORMAL_CHECK(cw) && REGION_EQUAL_TO_ZONE(cw, cw->bd->zone))
83 e_mod_comp_policy_win_restack_check(E_Comp_Win *cw,
86 E_Comp_Effect_Style st;
91 E_CHECK_RETURN(cw, 0);
92 E_CHECK_RETURN(cw2, 0);
93 E_CHECK_RETURN(cw->c, 0);
95 type = e_mod_comp_win_type_get(cw);
96 animatable = e_mod_comp_effect_state_get(cw->eff_type);
97 st = e_mod_comp_effect_style_get
99 E_COMP_EFFECT_KIND_RESTACK);
101 if ((!cw->c->animatable) ||
104 (st == E_COMP_EFFECT_STYLE_NONE) ||
105 (!REGION_EQUAL_TO_ROOT(cw)))
110 tp = _transient_parent_find(cw);
111 tp2 = _transient_parent_find(cw2);
112 if ((tp) && (tp2) && (tp->win == tp2->win))
117 if ((type == E_COMP_WIN_TYPE_NORMAL) ||
118 (type == E_COMP_WIN_TYPE_MENUSCREEN) ||
119 (type == E_COMP_WIN_TYPE_TASKMANAGER) ||
120 (type == E_COMP_WIN_TYPE_LIVEMAGAZINE))
129 e_mod_comp_policy_win_lower_check(E_Comp_Win *cw,
132 E_Comp_Effect_Style st1, st2;
133 Eina_Bool animatable1, animatable2;
134 E_Comp_Win *tp, *tp2;
136 E_CHECK_RETURN(cw, 0);
137 E_CHECK_RETURN(cw2, 0);
138 E_CHECK_RETURN(cw->c, 0);
139 E_CHECK_RETURN(cw->c->animatable, 0);
140 E_CHECK_RETURN(cw->visible, 0);
141 E_CHECK_RETURN(cw2->visible, 0);
142 if (!REGION_EQUAL_TO_ROOT(cw)) return EINA_FALSE;
143 if (!REGION_EQUAL_TO_ROOT(cw2)) return EINA_FALSE;
145 animatable1 = e_mod_comp_effect_state_get(cw->eff_type);
146 animatable2 = e_mod_comp_effect_state_get(cw2->eff_type);
147 E_CHECK_RETURN(animatable1, 0);
148 E_CHECK_RETURN(animatable2, 0);
150 if ((!TYPE_NORMAL_CHECK(cw)) &&
151 (!TYPE_NORMAL_CHECK(cw2)))
156 if ((!TYPE_NORMAL_CHECK(cw)) &&
157 (!TYPE_HOME_CHECK(cw2)))
162 st1 = e_mod_comp_effect_style_get
163 (cw->eff_type, E_COMP_EFFECT_KIND_RESTACK);
164 st2 = e_mod_comp_effect_style_get
165 (cw2->eff_type, E_COMP_EFFECT_KIND_RESTACK);
166 E_CHECK_RETURN((st1 != E_COMP_EFFECT_STYLE_NONE), 0);
167 E_CHECK_RETURN((st2 != E_COMP_EFFECT_STYLE_NONE), 0);
169 tp = _transient_parent_find(cw);
170 tp2 = _transient_parent_find(cw2);
171 if ((tp) && (tp2) && (tp->win == tp2->win))
180 e_mod_comp_policy_win_rotation_effect_check(E_Comp_Win *cw)
182 E_Comp_Effect_Style st;
183 Eina_Bool animatable;
184 const char *file, *group;
187 E_CHECK_RETURN(cw, 0);
188 E_CHECK_RETURN(cw->c, 0);
189 E_CHECK_RETURN(cw->c->animatable, 0);
190 E_CHECK_RETURN(cw->visible, 0);
191 E_CHECK_RETURN(cw->bd, 0);
192 E_CHECK_RETURN(cw->objs, 0);
194 animatable = e_mod_comp_effect_state_get(cw->eff_type);
195 E_CHECK_RETURN(animatable, 0);
197 co = eina_list_data_get(cw->objs);
198 E_CHECK_RETURN(co, 0);
200 edje_object_file_get(co->shadow, &file, &group);
201 if ((strcmp(group, "shadow_fade") != 0) &&
202 (strcmp(group, "shadow_twist") !=0))
207 st = e_mod_comp_effect_style_get
209 E_COMP_EFFECT_KIND_ROTATION);
210 if (st == E_COMP_EFFECT_STYLE_NONE)
213 if ((e_mod_comp_util_win_visible_get(cw)) &&
214 (evas_object_visible_get(co->shadow)) &&
215 TYPE_NORMAL_CHECK(cw))
223 e_mod_comp_policy_win_shadow_group_get(E_Comp_Win *cw)
225 E_Comp_Win_Type type;
226 E_CHECK_RETURN(cw, 0);
227 type = e_mod_comp_win_type_get(cw);
228 return eina_hash_find(shadow_hash, e_util_winid_str_get(type));
231 /* local subsystem functions */
233 _transient_parent_find(E_Comp_Win *cw)
235 // if Border is not existed then, return itself.
236 // otherwise, return itself or parent.
237 Ecore_X_Window transient_parent;
238 E_Comp_Win *parent_cw = NULL;
244 transient_parent = bd->win;
248 parent_cw = e_mod_comp_win_find(transient_parent);