1 #include "e_illume_private.h"
2 #include "policy_util.h"
5 #if 1 // for visibility
12 #define LOG_TAG "E17_EXTRA_MODULES"
15 /* NB: DIALOG_USES_PIXEL_BORDER is an experiment in setting dialog windows
16 * to use the 'pixel' type border. This is done because some dialogs,
17 * when shown, blend into other windows too much. Pixel border adds a
18 * little distinction between the dialog window and an app window.
19 * Disable if this is not wanted */
20 //#define DIALOG_USES_PIXEL_BORDER 1
23 #define ILLUME2_DEBUG 0
25 #define ILLUME2_TRACE printf
27 #define ILLUME2_TRACE(...)
30 typedef struct _E_Illume_Print_Info
34 } E_Illume_Print_Info;
37 #define COMP_MODULE_CONTROL
38 #define BACKKEY_MODULE_CONTROL
39 #define DEVMODE_MODULE_CONTROL
42 /*****************************/
43 /* local function prototypes */
44 /*****************************/
45 static void _policy_border_set_focus(E_Border *bd);
46 static void _policy_border_move(E_Border *bd, int x, int y);
47 static void _policy_border_resize(E_Border *bd, int w, int h);
48 static void _policy_border_show_below(E_Border *bd);
49 static void _policy_zone_layout_update(E_Zone *zone);
50 static void _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz);
51 static void _policy_zone_layout_quickpanel(E_Border *bd);
52 static void _policy_zone_layout_quickpanel_popup(E_Border *bd);
53 static void _policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz);
54 static void _policy_zone_layout_fullscreen(E_Border *bd);
55 static void _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz);
56 static void _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz);
57 static void _policy_zone_layout_clipboard(E_Border *bd, E_Illume_Config_Zone *cz);
58 static void _policy_zone_layout_apptray(E_Border *bd);
60 static int _policy_window_rotation_angle_get(Ecore_X_Window win);
61 static Ecore_X_Window _policy_active_window_get(Ecore_X_Window root);
62 static int _policy_border_indicator_state_get(E_Border *bd);
64 static void _policy_layout_quickpanel_rotate (E_Illume_Quickpanel* qp, int angle);
66 static E_Illume_Border_Info* _policy_get_border_info (E_Border* bd);
67 static E_Illume_Border_Info* _policy_add_border_info_list (E_Border* bd);
68 static void _policy_delete_border_info_list (E_Border* bd);
69 static int _policy_compare_cb_border (E_Illume_Border_Info* data1, E_Illume_Border_Info* data2);
71 static void _policy_zone_layout_app_single_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone* cz);
72 static void _policy_zone_layout_app_dual_top_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone* cz);
73 static void _policy_zone_layout_app_dual_left_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone* cz);
74 static void _policy_zone_layout_app_dual_custom_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone* cz);
76 static int _policy_border_get_notification_level (Ecore_X_Window win);
77 static int _policy_notification_level_map(int level);
79 static void _policy_change_quickpanel_layer (E_Illume_Quickpanel* qp, E_Border* indi_bd, int layer, int level);
80 static void _policy_change_indicator_layer(E_Border *indi_bd, E_Border *bd, int layer, int level);
82 /* for property change */
83 static void _policy_property_window_state_change (Ecore_X_Event_Window_Property *event);
84 static void _policy_property_indicator_geometry_change (Ecore_X_Event_Window_Property *event);
85 static void _policy_property_clipboard_geometry_change (Ecore_X_Event_Window_Property *event);
86 static void _policy_property_clipboard_state_change (Ecore_X_Event_Window_Property *event);
87 static void _policy_property_indicator_geometry_change (Ecore_X_Event_Window_Property *event);
88 static void _policy_property_enlightenment_scale_change (Ecore_X_Event_Window_Property *event);
89 static void _policy_property_rotate_win_angle_change (Ecore_X_Event_Window_Property *event);
90 static void _policy_property_indicator_state_change (Ecore_X_Event_Window_Property *event);
91 static void _policy_property_indicator_opacity_change(Ecore_X_Event_Window_Property *event);
92 static void _policy_property_active_win_change (Ecore_X_Event_Window_Property *event);
93 static void _policy_property_win_type_change (Ecore_X_Event_Window_Property *event);
94 static void _policy_property_rotate_root_angle_change (Ecore_X_Event_Window_Property *event);
95 static void _policy_property_notification_level_change (Ecore_X_Event_Window_Property *event);
96 static void _policy_property_overlay_win_change (Ecore_X_Event_Window_Property *event);
97 static void _policy_property_window_opaque_change (Ecore_X_Event_Window_Property *event);
98 static void _policy_property_illume_window_state_change(Ecore_X_Event_Window_Property *event);
99 static void _policy_property_indicator_cmd_win_change(Ecore_X_Event_Window_Property *event);
100 static void _policy_property_active_indicator_win_change(Ecore_X_Event_Window_Property *event);
102 static void _policy_border_illume_window_state_change(E_Border *bd, unsigned int state);
104 static Eina_Bool _policy_border_cb_mouse_down(void *data, int type __UNUSED__, void *event);
105 static Eina_Bool _policy_border_cb_mouse_up(void *data, int type __UNUSED__, void *event);
106 static Eina_Bool _policy_border_cb_mouse_move(void *data, int type __UNUSED__, void *event);
108 static int _policy_property_window_opaque_get (Ecore_X_Window win);
110 static void _policy_border_focus_top_stack_set(E_Border *bd);
113 void _policy_border_list_print (Ecore_X_Window win);
115 #ifdef COMP_MODULE_CONTROL
116 static void _policy_property_composite_module_change (Ecore_X_Event_Window_Property *ev);
118 #ifdef BACKKEY_MODULE_CONTROL
119 static void _policy_property_backkey_module_change (Ecore_X_Event_Window_Property *ev);
121 #ifdef DEVMODE_MODULE_CONTROL
122 static void _policy_property_devmode_module_change (Ecore_X_Event_Window_Property *ev);
125 #if 1 // for visibility
126 static void _policy_manage_xwins (E_Manager* man);
127 static E_Illume_XWin_Info* _policy_xwin_info_find (Ecore_X_Window win);
128 static Eina_Bool _policy_xwin_info_add (Ecore_X_Window win);
129 static Eina_Bool _policy_xwin_info_delete (Ecore_X_Window win);
131 static void _policy_send_visibility_notify (Ecore_X_Window win, int visibility);
132 static void _policy_calculate_visibility (void);
135 static Eina_Bool _policy_root_angle_set(E_Border *bd);
136 static void _policy_change_root_angle_by_border_angle (E_Border* bd);
137 static void _policy_indicator_angle_change (E_Border* indi_bd, int angle);
139 static void _policy_border_transient_for_group_make(E_Border *bd, Eina_List** list);
140 static E_Border* _policy_border_transient_for_border_top_get(E_Border *bd);
141 static void _policy_border_transient_for_layer_set(E_Border *bd, E_Border *parent_bd, int layer);
143 /* for desktop mode */
144 static void _policy_zone_layout_app_single_monitor(E_Illume_Border_Info *bd_info, E_Illume_Config_Zone *cz);
146 /* for controling indicator */
147 static void _policy_border_indicator_control(E_Border *indi_bd);
148 static Eina_Bool _policy_border_indicator_state_change(E_Border *indi_bd, E_Border *bd);
149 static Ecore_X_Window _policy_indicator_cmd_win_get(Ecore_X_Window win);
150 static Ecore_X_Window _policy_active_indicator_win_get(Ecore_X_Window win);
152 static void _policy_resize_start(E_Illume_Border_Info *bd_info);
153 static void _policy_resize_end(E_Illume_Border_Info *bd_info);
154 static void _policy_border_illume_handlers_add(E_Illume_Border_Info *bd_info);
155 static void _policy_border_illume_handlers_remove(E_Illume_Border_Info *bd_info);
157 static void _policy_border_root_angle_control(E_Zone *zone);
158 static int _policy_border_layer_map(int layer);
161 static void _policy_msg_handler(void *data, const char *name, const char *info, int val, E_Object *obj, void *msgdata);
164 static void _policy_border_force_iconify(E_Border *bd);
165 static void _policy_border_force_uniconify(E_Border *bd);
166 static void _policy_border_iconify_by_illume(E_Illume_XWin_Info *xwin_info);
167 static void _policy_border_uniconify_below_borders_by_illume(E_Illume_XWin_Info *xwin_info);
168 static E_Border* _policy_border_find_below(E_Border *bd);
169 static void _policy_border_uniconify_below_borders(E_Border *bd);
170 static void _policy_border_uniconify_top_border(E_Border *bd);
172 /* for supporting rotation */
173 static void _policy_border_dependent_rotation(E_Border *bd);
174 static Eina_Bool _policy_dependent_rotation_check(E_Border *bd, int rotation);
175 static int _prev_angle_get(Ecore_X_Window win);
178 /*******************/
179 /* local variables */
180 /*******************/
182 /* for active/deactive message */
183 static Ecore_X_Window g_active_win = 0;
184 static Ecore_X_Window g_active_pid = 0;
187 int g_root_angle = 0;
188 Ecore_X_Window g_rotated_win = 0;
190 /* for focus stack */
191 static Eina_List *_pol_focus_stack;
193 /* for border information */
194 static Eina_List* e_border_info_list = NULL;
196 /* for notification level */
197 static Ecore_X_Atom E_ILLUME_ATOM_NOTIFICATION_LEVEL;
199 /* for active/deactive message */
200 static Ecore_X_Atom E_ILLUME_ATOM_ACTIVATE_WINDOW;
201 static Ecore_X_Atom E_ILLUME_ATOM_DEACTIVATE_WINDOW;
204 static Ecore_X_Atom E_ILLUME_ATOM_OVERAY_WINDOW;
205 static Ecore_X_Atom E_ILLUME_ATOM_WINDOW_OPAQUE;
208 static Ecore_X_Atom E_ILLUME_ATOM_STACK_DISPLAY;
209 static Ecore_X_Atom E_ILLUME_ATOM_STACK_DISPLAY_DONE;
212 static Ecore_X_Window g_indi_control_win;
214 #ifdef COMP_MODULE_CONTROL
215 static Ecore_X_Atom E_ILLUME_ATOM_COMP_MODULE_ENABLED;
217 #ifdef BACKKEY_MODULE_CONTROL
218 static Ecore_X_Atom E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED;
220 #ifdef DEVMODE_MODULE_CONTROL
221 static Ecore_X_Atom E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED;
224 /* for supporting rotation */
225 static Ecore_X_Atom E_INDICATOR_CMD_WIN;
226 static Ecore_X_Atom E_ACTIVE_INDICATOR_WIN;
228 #if 1 // for visibility
229 static Eina_Hash* _e_illume_xwin_info_hash = NULL;
230 static Eina_Inlist* _e_illume_xwin_info_list = NULL;
231 static Ecore_X_Window _e_overlay_win = 0;
232 static int _g_root_width;
233 static int _g_root_height;
237 static E_Msg_Handler *_e_illume_msg_handler = NULL;
238 static Eina_Bool _e_use_comp = EINA_FALSE;
239 static Eina_Bool _g_visibility_changed = EINA_FALSE;
241 /* for supporing rotation */
242 typedef struct _E_Policy_Rotation_Dependent E_Policy_Rotation_Dependent;
244 struct _E_Policy_Rotation_Dependent
251 Ecore_X_Window cmd_win;
252 Ecore_X_Window active_win;
258 static E_Policy_Rotation_Dependent dep_rot =
266 typedef struct _E_Resizable_Area_Info
274 } E_Resizable_Area_Info;
276 /* local functions */
278 _policy_border_set_focus(E_Border *bd)
282 /* if focus is locked out then get out */
283 if (bd->lock_focus_out) return;
285 /* make sure the border can accept or take focus */
286 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
288 /* check E's focus settings */
289 if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
291 ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
292 ((bd->parent->focused) &&
293 (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))))
295 /* if the border was hidden due to layout, we need to unhide */
296 if (!bd->visible) e_illume_border_show(bd);
298 /* if the border is iconified then uniconify */
301 /* if the user is allowed to uniconify, then do it */
302 if (!bd->lock_user_iconify) e_border_uniconify(bd);
305 /* if we can raise the border do it */
306 if (!bd->lock_user_stacking) e_border_raise(bd);
308 /* focus the border */
309 e_border_focus_set(bd, 1, 1);
311 /* NB: since we skip needless border evals when container layout
312 * is called (to save cpu cycles), we need to
313 * signal this border that it's focused so that the edj gets
316 * This is potentially useless as THIS policy
317 * makes all windows borderless anyway, but it's in here for
319 e_border_focus_latest_set(bd);
321 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
323 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
324 e_focus_event_focus_in(bd);
331 _policy_border_move(E_Border *bd, int x, int y)
335 /* NB: Qt uses a weird window type called 'VCLSalFrame' that needs to
336 * have bd->placed set else it doesn't position correctly...
337 * this could be a result of E honoring the icccm request position,
340 e_border_move (bd, x, y);
344 _policy_border_resize(E_Border *bd, int w, int h)
348 e_border_resize (bd, w, h);
352 _policy_border_show_below(E_Border *bd)
358 // printf("Show Borders Below: %s %d %d\n",
359 // bd->client.icccm.class, bd->x, bd->y);
363 if (bd->client.icccm.transient_for)
365 if ((prev = e_border_find_by_client_window(bd->client.icccm.transient_for)))
367 _policy_border_set_focus(prev);
372 /* determine layering position */
373 pos = _policy_border_layer_map(bd->layer);
375 /* Find the windows below this one */
376 for (i = pos; i >= 2; i--)
380 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
384 /* skip if it's the same border */
385 if (b == bd) continue;
387 /* skip if it's not on this zone */
388 if (b->zone != bd->zone) continue;
390 /* skip special borders */
391 if (e_illume_border_is_indicator(b)) continue;
392 if (e_illume_border_is_keyboard(b)) continue;
393 if (e_illume_border_is_keyboard_sub(b)) continue;
394 if (e_illume_border_is_quickpanel(b)) continue;
395 if (e_illume_border_is_quickpanel_popup(b)) continue;
396 if (e_illume_border_is_clipboard(b)) continue;
398 if ((bd->fullscreen) || (bd->need_fullscreen))
400 _policy_border_set_focus(b);
405 /* need to check x/y position */
406 if (E_CONTAINS(bd->x, bd->y, bd->w, bd->h,
407 b->x, b->y, b->w, b->h))
409 _policy_border_set_focus(b);
416 /* if we reach here, then there is a problem with showing a window below
417 * this one, so show previous window in stack */
418 EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, prev)
421 if (prev->zone != bd->zone) continue;
422 _policy_border_set_focus(prev);
428 _policy_zone_layout_update(E_Zone *zone)
435 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
439 /* skip borders not on this zone */
440 if (bd->zone != zone) continue;
442 /* skip special windows */
443 if (e_illume_border_is_keyboard(bd)) continue;
444 if (e_illume_border_is_keyboard_sub(bd)) continue;
445 if (e_illume_border_is_quickpanel(bd)) continue;
446 if (e_illume_border_is_quickpanel_popup(bd)) continue;
448 /* signal a changed pos here so layout gets updated */
455 _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz)
457 ILLUME2_TRACE ("[ILLUME2] %s (%d) win = 0x%07x\n", __func__, __LINE__, bd->client.win);
459 if ((!bd) || (!cz)) return;
461 /* grab minimum indicator size */
462 //e_illume_border_min_get(bd, NULL, &cz->indicator.size);
464 /* no point in doing anything here if indicator is hidden */
465 if ((!bd->new_client) && (!bd->visible)) return;
467 /* if we are dragging, then skip it for now */
468 if (bd->client.illume.drag.drag)
470 /* when dragging indicator, we need to trigger a layout update */
471 _policy_zone_layout_update(bd->zone);
475 /* lock indicator window from dragging if we need to */
476 if ((cz->mode.dual == 1) && (cz->mode.side == 0))
477 ecore_x_e_illume_drag_locked_set(bd->client.win, 0);
479 ecore_x_e_illume_drag_locked_set(bd->client.win, 1);
481 /* make sure it's the required width & height */
482 int rotation = _policy_window_rotation_angle_get(bd->client.win);
483 if(rotation == -1) return;
485 ILLUME2_TRACE ("ILLUME2] INDICATOR'S ANGLE = %d\n", rotation);
487 // check indicator's rotation info and then set it's geometry
488 if (rotation == 0 || rotation == 180)
490 ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, bd->x, bd->y, bd->w, bd->h);
491 ecore_x_e_illume_indicator_geometry_set(bd->zone->container->manager->root, bd->x, bd->y, bd->w, bd->h);
495 ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, bd->zone->x, bd->zone->y, bd->h, bd->w);
496 ecore_x_e_illume_indicator_geometry_set(bd->zone->container->manager->root, bd->zone->x, bd->zone->y, bd->h, bd->w);
501 _policy_zone_layout_quickpanel(E_Border *bd)
505 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
507 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
508 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
513 rotation = _policy_window_rotation_angle_get (bd->client.win);
514 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] _policy_zone_layout_quickpanel..(%d) rotation angle = %d\n", __LINE__, rotation);
516 if (rotation == 0 || rotation == 180)
518 if ((bd->w != bd->zone->w))
520 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] CHANGE QUICK-PANEL SIZE to Portrait..(%d) old (%d, %d) new (%d, %d)\n", __LINE__, bd->w, bd->h, bd->zone->w, bd->h);
521 _policy_border_resize(bd, bd->zone->w, bd->h);
526 if ((bd->h != bd->zone->h))
528 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] CHANGE QUICK-PANEL SIZE to Landscape..(%d) old (%d, %d) new (%d, %d)\n", __LINE__, bd->w, bd->h, bd->w, bd->zone->h);
529 _policy_border_resize(bd, bd->w, bd->zone->h);
535 static void _policy_zone_layout_quickpanel_popup(E_Border *bd)
543 _policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz)
545 if ((!bd) || (!cz)) return;
547 /* no point in adjusting size or position if it's not visible */
548 if (!bd->visible) return;
550 /* set layer if needed */
551 if (bd->client.icccm.transient_for == 0)
553 if (bd->layer != POL_KEYBOARD_LAYER)
554 e_border_layer_set(bd, POL_KEYBOARD_LAYER);
560 _policy_zone_layout_fullscreen(E_Border *bd)
562 // printf("\tLayout Fullscreen: %s\n", bd->client.icccm.name);
566 /* make sure it's the required width & height */
567 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
568 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
570 /* set layer if needed */
571 if (bd->layer != POL_FULLSCREEN_LAYER)
572 e_border_layer_set(bd, POL_FULLSCREEN_LAYER);
576 _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz)
580 Eina_Bool resize = EINA_FALSE;
581 Eina_Bool move = EINA_FALSE;
583 // printf("\tLayout Dialog: %s\n", bd->client.icccm.name);
585 /* NB: This policy ignores any ICCCM requested positions and centers the
586 * dialog on it's parent (if it exists) or on the zone */
588 if ((!bd) || (!cz)) return;
590 /* no point in adjusting size or position if it's not visible */
591 if (!bd->visible) return;
593 /* grab minimum size */
594 e_illume_border_min_get(bd, &mw, &mh);
596 /* make sure it fits in this zone */
597 if (mw > bd->zone->w) mw = bd->zone->w;
598 if (mh > bd->zone->h) mh = bd->zone->h;
600 if (mw < bd->w) mw = bd->w;
601 if (mh < bd->h) mh = bd->h;
603 /* try to get this dialog's parent if it exists */
604 parent = e_illume_border_parent_get(bd);
606 /* if we have no parent, or we are in dual mode, then center on zone */
607 /* NB: we check dual mode because if we are in dual mode, dialogs tend to
608 * be too small to be useful when positioned on the parent, so center
609 * on zone. We could check their size first here tho */
610 if ((!parent) || (cz->mode.dual == 1))
612 /* no parent or dual mode, center on screen */
613 nx = (bd->zone->x + ((bd->zone->w - mw) / 2));
614 ny = (bd->zone->y + ((bd->zone->h - mh) / 2));
618 /* NB: there is an assumption here that the parent has already been
619 * layed out on screen. This could be bad. Needs Testing */
621 /* make sure we are not larger than the parent window */
622 if (mw > parent->w) mw = parent->w;
623 if (mh > parent->h) mh = parent->h;
625 /* center on parent */
626 nx = (parent->x + ((parent->w - mw) / 2));
627 ny = (parent->y + ((parent->h - mh) / 2));
630 /* make sure it's the required width & height */
631 if ((bd->w != mw) || (bd->h != mh))
634 /* make sure it's in the correct position */
635 if ((bd->x != nx) || (bd->y != ny))
639 e_border_move_resize(bd, nx, ny, mw, mh);
641 _policy_border_resize(bd, mw, mh);
643 _policy_border_move(bd, nx, ny);
645 /* set layer if needed */
646 if (bd->layer != POL_DIALOG_LAYER) e_border_layer_set(bd, POL_DIALOG_LAYER);
650 _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz)
653 Eina_Bool resize = EINA_FALSE;
654 Eina_Bool move = EINA_FALSE;
656 if ((!bd) || (!cz)) return;
658 /* no point in adjusting size or position if it's not visible */
659 if ((!bd->new_client) && (!bd->visible)) return;
661 /* grab minimum size */
662 e_illume_border_min_get(bd, &mw, &mh);
664 /* make sure it fits in this zone */
665 if (mw > bd->zone->w) mw = bd->zone->w;
666 if (mh > bd->zone->h) mh = bd->zone->h;
668 if (mw < bd->w) mw = bd->w;
669 if (mh < bd->h) mh = bd->h;
671 nx = (bd->zone->x + ((bd->zone->w - mw) / 2));
672 ny = (bd->zone->y + ((bd->zone->h - mh) / 2));
674 if ((bd->w != mw) || (bd->h != mh))
677 if ((bd->x != nx) || (bd->y != ny))
681 e_border_move_resize(bd, nx, ny, mw, mh);
683 _policy_border_resize(bd, mw, mh);
685 _policy_border_move(bd, nx, ny);
689 _policy_zone_layout_clipboard(E_Border *bd, E_Illume_Config_Zone *cz)
691 /* no point in adjusting size or position if it's not visible */
692 if (!bd->visible) return;
694 /* set layer if needed */
695 if (bd->layer != POL_CLIPBOARD_LAYER)
696 e_border_layer_set(bd, POL_CLIPBOARD_LAYER);
700 _policy_zone_layout_apptray(E_Border *bd)
704 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
706 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
707 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
710 /* set layer if needed */
711 if (bd->layer != POL_APPTRAY_LAYER)
712 e_border_layer_set(bd, POL_APPTRAY_LAYER);
716 _policy_zone_layout_miniapptray(E_Border *bd)
720 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
722 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
723 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
726 /* set layer if needed */
727 if (bd->layer != POL_APPTRAY_LAYER)
728 e_border_layer_set(bd, POL_APPTRAY_LAYER);
731 /* policy functions */
733 _policy_border_add(E_Border *bd)
735 // printf("Border added: %s\n", bd->client.icccm.class);
739 /* NB: this call sets an atom on the window that specifices the zone.
740 * the logic here is that any new windows created can access the zone
741 * window by a 'get' call. This is useful for elementary apps as they
742 * normally would not have access to the zone window. Typical use case
743 * is for indicator & softkey windows so that they can send messages
744 * that apply to their respective zone only. Example: softkey sends close
745 * messages (or back messages to cycle focus) that should pertain just
746 * to it's current zone */
747 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
749 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = 0x%07x\n", __func__, __LINE__, bd->client.win);
751 /* ignore stolen borders. These are typically quickpanel or keyboards */
754 if (e_illume_border_is_quickpanel(bd) ||
755 e_illume_border_is_quickpanel_popup(bd))
758 E_Illume_Border_Info* bd_info = NULL;
759 E_Illume_Border_Info* indi_bd_info = NULL;
761 /* try to get the Indicator on this zone */
762 if ((indi_bd = e_illume_border_indicator_get(bd->zone)))
764 if ((indi_bd_info = _policy_get_border_info(indi_bd)))
766 if ((bd_info = _policy_get_border_info(bd)))
767 bd_info->level = indi_bd_info->level;
774 /* Add this border to our focus stack if it can accept or take focus */
775 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
776 _pol_focus_stack = eina_list_append(_pol_focus_stack, bd);
778 if (e_illume_border_is_indicator(bd))
779 _policy_zone_layout_update(bd->zone);
782 /* set focus on new border if we can */
783 _policy_border_set_focus(bd);
786 if (e_illume_border_is_indicator (bd))
788 E_Illume_Config_Zone *cz;
789 cz = e_illume_zone_config_get(bd->zone->id);
792 ILLUME2_TRACE ("[ILLUME2] ADD INDICATOR WINDOW... win = 0x%07x, Save indicator's size = %d!!!\n", bd->client.win, bd->h);
793 cz->indicator.size = bd->h;
796 if (_e_illume_cfg->use_indicator_widget)
798 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
799 _policy_border_root_angle_control(bd->zone);
803 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
804 _policy_border_indicator_control(bd);
810 _policy_border_del(E_Border *bd)
812 // printf("Border deleted: %s\n", bd->client.icccm.class);
813 E_Illume_XWin_Info* xwin_info;
814 Eina_Bool is_rotated_win = EINA_FALSE;
818 /* if this is a fullscreen window, than we need to show indicator window */
819 /* NB: we could use the e_illume_border_is_fullscreen function here
820 * but we save ourselves a function call this way */
821 if ((bd->fullscreen) || (bd->need_fullscreen))
825 /* try to get the Indicator on this zone */
826 if ((indi_bd = e_illume_border_indicator_get(bd->zone)))
828 /* we have the indicator, show it if needed */
829 if (!indi_bd->visible)
831 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
832 e_illume_border_show(indi_bd);
837 if (e_illume_border_is_clipboard(bd))
839 ecore_x_e_illume_clipboard_state_set(bd->zone->black_win, ECORE_X_ILLUME_CLIPBOARD_STATE_OFF);
842 /* remove from our focus stack */
843 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
844 _pol_focus_stack = eina_list_remove(_pol_focus_stack, bd);
846 if (g_rotated_win == bd->client.win)
848 is_rotated_win = EINA_TRUE;
852 xwin_info = _policy_xwin_info_find (bd->win);
855 if (_e_illume_cfg->use_force_iconify)
857 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... DELETE win:0x%07x\n", __func__, __LINE__, bd->client.win);
858 if (!(e_illume_border_is_indicator(bd) ||
859 e_illume_border_is_keyboard(bd) ||
860 e_illume_border_is_keyboard_sub(bd) ||
861 e_illume_border_is_quickpanel(bd) ||
862 e_illume_border_is_quickpanel_popup(bd) ||
863 e_illume_border_is_clipboard(bd) ||
864 e_illume_border_is_app_tray(bd) ||
865 e_illume_border_is_miniapp_tray(bd)))
867 _policy_border_uniconify_below_borders_by_illume(xwin_info);
871 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
873 if (_e_illume_cfg->use_indicator_widget)
875 if ((bd->w == bd->zone->w) && (bd->h == bd->zone->h))
877 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Deleted win:0x%07x. Control Root Angle.\n", __func__, __LINE__, bd->client.win);
878 _policy_border_root_angle_control(bd->zone);
884 indi_bd = e_illume_border_indicator_get(bd->zone);
887 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
888 _policy_border_indicator_control(indi_bd);
892 xwin_info->bd_info = NULL;
893 xwin_info->attr.visible = 0;
894 xwin_info->viewable = EINA_FALSE;
895 xwin_info->is_drawed = EINA_FALSE;
898 E_Illume_Border_Info* bd_info = _policy_get_border_info(bd);
901 if (bd_info->resize_req.mouse.down)
903 e_grabinput_release(bd->event_win, bd->event_win);
905 if (bd_info->resize_req.mouse.resize)
907 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
908 if (o) evas_object_del(o);
911 /* set property on zone window that a drag is finished */
912 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
914 _policy_border_illume_handlers_remove(bd_info);
918 _policy_delete_border_info_list (bd);
920 if (e_illume_border_is_indicator(bd))
922 E_Illume_Config_Zone *cz;
924 /* get the config for this zone */
925 cz = e_illume_zone_config_get(bd->zone->id);
926 if (cz) cz->indicator.size = 0;
927 _policy_zone_layout_update(bd->zone);
931 /* show the border below this one */
932 _policy_border_show_below(bd);
935 if (e_illume_border_is_lock_screen(bd))
937 if (_e_illume_cfg->use_mem_trim)
939 /* heap and stack trim */
940 e_illume_util_mem_trim();
944 // for supporting rotation such as quickpanel
945 if (e_illume_border_is_quickpanel(bd) ||
946 e_illume_border_is_miniapp_tray(bd) ||
947 (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) ||
948 e_illume_border_is_syspopup(bd))
949 dep_rot.list = eina_list_remove(dep_rot.list, bd);
953 _policy_border_focus_in(E_Border *bd __UNUSED__)
955 // printf("Border focus in: %s\n", bd->client.icccm.name);
959 _policy_border_focus_out(E_Border *bd)
961 // printf("Border focus out: %s\n", bd->client.icccm.name);
965 /* NB: if we got this focus_out event on a deleted border, we check if
966 * it is a transient (child) of another window. If it is, then we
967 * transfer focus back to the parent window */
968 if (e_object_is_del(E_OBJECT(bd)))
970 if (e_illume_border_is_dialog(bd))
974 if ((parent = e_illume_border_parent_get(bd)))
975 _policy_border_set_focus(parent);
981 _policy_border_activate(E_Border *bd)
983 // printf("Border Activate: %s\n", bd->client.icccm.name);
986 /* NB: stolen borders may or may not need focus call...have to test */
987 if (bd->stolen) return;
989 /* NB: We cannot use our set_focus function here because it does,
990 * occasionally fall through wrt E's focus policy, so cherry pick the good
991 * parts and use here :) */
993 /* if the border is iconified then uniconify if allowed */
994 if ((bd->iconic) && (!bd->lock_user_iconify))
995 e_border_uniconify(bd);
997 ILLUME2_TRACE ("[ILLUME2] _policy_border_activate.. (%d) ACTIVE WIN = 0x%07x\n", __LINE__, bd->client.win);
999 /* NB: since we skip needless border evals when container layout
1000 * is called (to save cpu cycles), we need to
1001 * signal this border that it's focused so that the edj gets
1004 * This is potentially useless as THIS policy
1005 * makes all windows borderless anyway, but it's in here for
1007 e_border_focus_latest_set(bd);
1009 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
1010 if (bd->icon_object)
1011 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
1012 e_focus_event_focus_in(bd);
1017 _policy_border_post_fetch(E_Border *bd)
1019 // printf("Border post fetch\n");
1023 /* NB: for this policy we disable all remembers set on a border */
1024 if (bd->remember) e_remember_del(bd->remember);
1025 bd->remember = NULL;
1027 /* set this border to borderless */
1028 #ifdef DIALOG_USES_PIXEL_BORDER
1029 if ((e_illume_border_is_dialog(bd)) && (e_illume_border_parent_get(bd)))
1030 eina_stringshare_replace(&bd->bordername, "pixel");
1034 /* for desktop mode */
1035 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1037 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1039 if (!bd->client.illume.win_state.state)
1046 // for supporting rotation such as quickpanel
1047 if (e_illume_border_is_quickpanel(bd) ||
1048 e_illume_border_is_miniapp_tray(bd) ||
1049 (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) ||
1050 e_illume_border_is_syspopup(bd))
1052 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
1053 if (!eina_list_data_find(dep_rot.list, bd))
1057 dep_rot.list = eina_list_append(dep_rot.list, bd);
1059 if (_prev_angle_get(bd->client.win) != -1)
1060 bd->client.e.state.rot.curr = prev_ang;
1062 if (dep_rot.ang != bd->client.e.state.rot.curr)
1063 e_border_rotation_set(bd, dep_rot.ang);
1067 /* tell E the border has changed */
1068 bd->client.border.changed = 1;
1073 _policy_border_post_new_border(E_Border *bd)
1076 E_Illume_Border_Info* bd_info = NULL;
1080 bd_info = _policy_get_border_info(bd);
1081 if (!bd_info) return;
1083 bd_info->win_type = bd->client.netwm.type;
1085 if (e_illume_border_is_notification(bd))
1087 bd_info->level = _policy_border_get_notification_level(bd->client.win);
1088 layer = _policy_notification_level_map(bd_info->level);
1089 e_border_layer_set(bd, layer);
1090 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
1091 __func__, __LINE__, bd->client.win, bd_info->level);
1097 _check_parent_in_transient_for_tree(E_Border *bd, E_Border *parent_bd)
1101 if (!bd || !parent_bd) return EINA_FALSE;
1103 ancestor = parent_bd;
1104 while (ancestor->parent)
1106 if (ancestor->parent == bd)
1108 // This is very bad. bd and parent_bd are transient_for each other
1110 SECURE_SLOGD("[WM] Transient_for Error!!! Win:0x%07x and Parent:0x%07x are transient_for each other.", bd->client.win, parent_bd->client.win);
1112 ELBF(ELBT_ILLUME, 0, bd->client.win, "BAD. Transient_for Error. Parent:0x%07x is descendant", parent_bd->client.win);
1115 ancestor = ancestor->parent;
1122 _policy_border_pre_fetch(E_Border *bd)
1124 #ifdef _F_DEICONIFY_APPROVE_
1125 Eina_Bool change_parent = EINA_TRUE;
1133 state = ecore_x_e_illume_window_state_get(bd->client.win);
1134 _policy_border_illume_window_state_change(bd, state);
1137 /* Below code are same to _e_border_eval0 in e_border.c.
1138 But we added code to handle notification window */
1139 if (bd->client.icccm.fetch.transient_for)
1141 /* TODO: What do to if the transient for isn't mapped yet? */
1142 E_Border *bd_parent = NULL;
1143 E_Illume_XWin_Info *xwin_info = NULL;
1144 Eina_Bool transient_each_other;
1145 Ecore_X_Window transient_for_win;
1147 if (_e_illume_cfg->use_force_iconify)
1148 xwin_info = _policy_xwin_info_find(bd->win);
1150 transient_for_win = ecore_x_icccm_transient_for_get(bd->client.win);
1151 if (bd->client.icccm.transient_for == transient_for_win)
1153 ELBF(ELBT_ILLUME, 0, bd->client.win, "Same transient_for:0x%07x. SKIP...", transient_for_win);
1154 goto transient_fetch_done;
1157 bd->client.icccm.transient_for = transient_for_win;
1158 if (bd->client.icccm.transient_for)
1160 bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
1163 /* If we already have a parent, remove it */
1166 #ifdef _F_DEICONIFY_APPROVE_
1167 if (bd_parent == bd->parent) change_parent = EINA_FALSE;
1169 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
1170 if (bd->parent->modal == bd) bd->parent->modal = NULL;
1174 L(LT_TRANSIENT_FOR, "[ILLUME2][TRANSIENT_FOR] %s(%d)... win:0x%07x, parent:0x%07x\n", __func__, __LINE__, bd->client.win, bd->client.icccm.transient_for);
1177 transient_each_other = _check_parent_in_transient_for_tree(bd, bd_parent);
1178 if (!transient_each_other)
1180 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. win:0x%07x(iconic:%d, by_wm:%d), parent:0x%07x(iconic:%d)\n", __func__, __LINE__, bd->client.win, bd->iconic, xwin_info ? xwin_info->iconify_by_wm : -100, bd_parent->client.win, bd_parent->iconic);
1181 if (_e_illume_cfg->use_force_iconify)
1183 if (!bd_parent->iconic)
1185 if (xwin_info && xwin_info->iconify_by_wm)
1189 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, bd->client.win);
1190 _policy_border_force_uniconify(bd);
1196 if (bd_parent != bd)
1198 bd->parent = bd_parent;
1199 _policy_border_transient_for_layer_set(bd, bd->parent, bd->parent->layer);
1200 bd_parent->transients = eina_list_append(bd_parent->transients, bd);
1202 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
1203 bd->parent->modal = bd;
1205 if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
1206 (bd->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
1212 #ifdef _F_DEICONIFY_APPROVE_
1215 E_Border *ancestor_bd;
1216 bd->client.e.state.deiconify_approve.render_done = 0;
1218 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
1219 if ((ancestor_bd) &&
1220 (!e_object_is_del(E_OBJECT(ancestor_bd))))
1222 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
1223 bd->client.e.state.deiconify_approve.ancestor = NULL;
1225 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
1226 (ancestor_bd->client.e.state.deiconify_approve.render_done))
1228 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
1230 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
1231 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
1232 e_border_uniconify(ancestor_bd);
1239 transient_fetch_done:
1240 bd->client.icccm.fetch.transient_for = 0;
1245 _policy_border_new_border(E_Border *bd)
1250 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
1252 _policy_add_border_info_list(bd);
1255 #ifdef _F_BORDER_HOOK_PATCH_
1257 _policy_border_del_border(E_Border *bd)
1263 _policy_border_del(bd);
1269 _policy_border_post_assign(E_Border *bd)
1271 // printf("Border post assign\n");
1274 if (!bd->new_client) return;
1276 bd->internal_no_remember = 1;
1278 /* do not allow client to change these properties */
1279 bd->lock_client_shade = 1;
1281 if (e_illume_border_is_utility (bd))
1283 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... win(0x%07x) is UTILITY type.. SET REQUEST_POS!!!\n", __func__, __LINE__, bd->client.win);
1284 bd->client.icccm.request_pos = 1;
1287 /* do not allow the user to change these properties */
1288 /* for desktop mode */
1289 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1291 if (bd->client.illume.win_state.state)
1293 bd->lock_user_location = 0;
1294 bd->lock_user_size = 0;
1298 bd->lock_user_location = 1;
1299 bd->lock_user_size = 1;
1301 bd->lock_user_shade = 1;
1302 if (bd->client.icccm.request_pos == 0)
1305 bd->changes.pos = 1;
1309 bd->lock_user_shade = 1;
1311 /* clear any centered states */
1312 /* NB: this is mainly needed for E's main config dialog */
1313 bd->client.e.state.centered = 0;
1315 /* lock the border type so user/client cannot change */
1316 bd->lock_border = 1;
1320 _policy_border_show(E_Border *bd)
1324 /* make sure we have a name so that we don't handle windows like E's root */
1325 if (!bd->client.icccm.name) return;
1327 // printf("Border Show: %s\n", bd->client.icccm.class);
1329 /* trap for special windows so we can ignore hides below them */
1330 if (e_illume_border_is_indicator(bd)) return;
1331 if (e_illume_border_is_quickpanel(bd)) return;
1332 if (e_illume_border_is_quickpanel_popup(bd)) return;
1334 if (e_illume_border_is_keyboard(bd))
1337 angle = _policy_window_rotation_angle_get(bd->client.win);
1340 if (angle != g_root_angle)
1342 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win = 0x%07x.. SEND client Event with angle = %d\n", __func__, __LINE__, bd->client.win, g_root_angle);
1343 ecore_x_client_message32_send(bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
1344 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, g_root_angle, g_active_win, 0, 0, 0);
1351 if (e_illume_border_is_clipboard(bd))
1353 ecore_x_e_illume_clipboard_state_set(bd->zone->black_win, ECORE_X_ILLUME_CLIPBOARD_STATE_ON);
1354 ecore_x_e_illume_clipboard_geometry_set(bd->zone->black_win, bd->x, bd->y, bd->w, bd->h);
1358 if (eina_list_data_find(dep_rot.list, bd) == bd)
1359 e_border_rotation_set(bd, dep_rot.ang);
1363 _policy_border_cb_move(E_Border *bd)
1367 if (e_illume_border_is_app_tray(bd) ||
1368 e_illume_border_is_miniapp_tray(bd))
1370 _policy_border_focus_top_stack_set(bd);
1377 _policy_zone_layout(E_Zone *zone)
1379 E_Illume_Config_Zone *cz;
1383 // printf("Zone Layout: %d\n", zone->id);
1387 /* get the config for this zone */
1388 cz = e_illume_zone_config_get(zone->id);
1391 /* loop through border list and update layout */
1392 E_Illume_Border_Info* bd_info;
1393 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
1395 if (!bd_info) continue;
1397 bd = bd_info->border;
1399 /* skip borders that are being deleted */
1400 if (e_object_is_del(E_OBJECT(bd))) continue;
1402 /* skip borders not on this zone */
1403 if (bd->zone != zone) continue;
1405 /* only update layout for this border if it really needs it */
1406 if ((!bd->new_client) && (!bd->changes.pos) && (!bd->changes.size) &&
1407 (!bd->changes.visible) && (!bd->pending_move_resize) &&
1408 (!bd->need_shape_export) && (!bd->need_shape_merge)) continue;
1410 /* are we laying out an indicator ? */
1411 if (e_illume_border_is_indicator(bd))
1412 _policy_zone_layout_indicator(bd, cz);
1414 /* are we layout out a quickpanel ? */
1415 else if (e_illume_border_is_quickpanel(bd))
1416 _policy_zone_layout_quickpanel(bd);
1418 else if (e_illume_border_is_quickpanel_popup(bd))
1419 _policy_zone_layout_quickpanel_popup(bd);
1421 /* are we laying out a keyboard ? */
1422 else if (e_illume_border_is_keyboard(bd))
1423 _policy_zone_layout_keyboard(bd, cz);
1425 else if (e_illume_border_is_keyboard_sub(bd))
1426 _policy_zone_layout_keyboard(bd, cz);
1428 /* are we laying out a fullscreen window ? */
1429 /* NB: we could use the e_illume_border_is_fullscreen function here
1430 * but we save ourselves a function call this way. */
1431 else if ((bd->fullscreen) || (bd->need_fullscreen))
1432 _policy_zone_layout_fullscreen(bd);
1434 /* are we laying out a dialog ? */
1435 else if (e_illume_border_is_dialog(bd))
1436 _policy_zone_layout_dialog(bd, cz);
1438 else if (e_illume_border_is_splash(bd))
1439 _policy_zone_layout_splash(bd, cz);
1441 else if (e_illume_border_is_clipboard(bd))
1442 _policy_zone_layout_clipboard(bd, cz);
1444 else if (e_illume_border_is_app_tray(bd))
1445 _policy_zone_layout_apptray(bd);
1447 else if (e_illume_border_is_miniapp_tray(bd))
1448 _policy_zone_layout_miniapptray(bd);
1450 /* must be an app */
1453 /* are we in single mode ? */
1456 /* for desktop mode */
1457 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1458 _policy_zone_layout_app_single_new(bd_info, cz);
1459 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1460 _policy_zone_layout_app_single_monitor(bd_info, cz);
1462 _policy_zone_layout_app_single_new(bd_info, cz);
1466 /* we are in dual-mode, check orientation */
1467 if (cz->mode.side == 0)
1471 /* grab the indicator position so we can tell if it
1472 * is in a custom position or not (user dragged it) */
1473 e_illume_border_indicator_pos_get(bd->zone, NULL, &ty);
1474 if (ty <= bd->zone->y)
1475 _policy_zone_layout_app_dual_top_new (bd_info, cz);
1477 _policy_zone_layout_app_dual_custom_new (bd_info, cz);
1480 _policy_zone_layout_app_dual_left_new (bd_info, cz);
1487 _policy_zone_move_resize(E_Zone *zone)
1492 // printf("Zone move resize\n");
1496 ecore_x_window_size_get (zone->container->manager->root, &_g_root_width, &_g_root_height);
1498 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
1501 /* skip borders not on this zone */
1502 if (bd->zone != zone) continue;
1504 /* signal a changed pos here so layout gets updated */
1505 bd->changes.pos = 1;
1511 _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode)
1513 E_Illume_Config_Zone *cz;
1516 // printf("Zone mode change: %d\n", zone->id);
1520 /* get the config for this zone */
1521 cz = e_illume_zone_config_get(zone->id);
1524 /* update config with new mode */
1525 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
1530 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
1532 else if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
1535 e_config_save_queue();
1537 /* lock indicator window from dragging if we need to */
1538 bd = e_illume_border_indicator_get(zone);
1541 /* only dual-top mode can drag */
1542 if ((cz->mode.dual == 1) && (cz->mode.side == 0))
1544 /* only set locked if we need to */
1545 if (bd->client.illume.drag.locked != 0)
1546 ecore_x_e_illume_drag_locked_set(bd->client.win, 0);
1550 /* only set locked if we need to */
1551 if (bd->client.illume.drag.locked != 1)
1552 ecore_x_e_illume_drag_locked_set(bd->client.win, 1);
1556 /* Need to trigger a layout update here */
1557 _policy_zone_layout_update(zone);
1561 _policy_zone_close(E_Zone *zone)
1565 // printf("Zone close\n");
1569 /* make sure we have a focused border */
1570 if (!(bd = e_border_focused_get())) return;
1572 /* make sure focused border is on this zone */
1573 if (bd->zone != zone) return;
1575 /* close this border */
1576 e_border_act_close_begin(bd);
1580 _policy_drag_start(E_Border *bd)
1582 // printf("Drag start\n");
1586 /* ignore stolen borders */
1587 if (bd->stolen) return;
1589 if (!bd->visible) return;
1591 /* set property on this border to say we are dragging */
1592 ecore_x_e_illume_drag_set(bd->client.win, 1);
1594 /* set property on zone window that a drag is happening */
1595 ecore_x_e_illume_drag_set(bd->zone->black_win, 1);
1599 _policy_drag_end(E_Border *bd)
1601 // printf("Drag end\n");
1605 /* ignore stolen borders */
1606 if (bd->stolen) return;
1608 /* set property on this border to say we are done dragging */
1609 ecore_x_e_illume_drag_set(bd->client.win, 0);
1611 /* set property on zone window that a drag is finished */
1612 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
1616 _policy_resize_start(E_Illume_Border_Info *bd_info)
1623 const char buf[PATH_MAX];
1625 bd = bd_info->border;
1628 if (bd->stolen) return;
1629 if (!bd->client.illume.win_state.state) return;
1630 if (!bd_info->resize_req.mouse.down) return;
1632 bd_info->resize_req.need_change = 0;
1633 bd_info->resize_req.mouse.locked = 1;
1634 bd_info->resize_req.mouse.resize = 1;
1635 int ang = _policy_window_rotation_angle_get(bd->client.win);
1636 if (ang == -1) ang = 0;
1637 bd_info->resize_req.angle = ang;
1639 m = e_manager_current_get();
1641 canvas = e_manager_comp_evas_get(m);
1642 if (!canvas) return;
1644 o = edje_object_add(canvas);
1645 snprintf(buf, sizeof(buf), "%s/e-module-illume2-tizen.edj", _e_illume_mod_dir);
1646 evas_object_image_border_center_fill_set(o, EVAS_BORDER_FILL_NONE);
1647 if(!(edje_object_file_set(o, buf, "new_shadow"))
1648 || !(bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
1650 o = evas_object_rectangle_add(canvas);
1651 evas_object_color_set(o, 100, 100, 100, 100);
1654 nx = bd->x - bd->zone->x;
1655 ny = bd->y - bd->zone->y;
1656 evas_object_move(o, nx, ny);
1657 evas_object_resize(o, bd->w, bd->h);
1658 e_object_data_set(E_OBJECT(bd), o);
1659 evas_object_show(o);
1663 _policy_resize_end(E_Illume_Border_Info *bd_info)
1666 bd = bd_info->border;
1670 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
1671 if (o) evas_object_del(o);
1673 if (bd->stolen) return;
1674 if (!bd->client.illume.win_state.state) return;
1675 if (!bd_info->resize_req.mouse.down) return;
1677 bd_info->resize_req.mouse.locked = 0;
1678 bd_info->resize_req.mouse.resize = 0;
1682 _policy_focus_back(E_Zone *zone)
1684 Eina_List *l, *fl = NULL;
1688 if (eina_list_count(_pol_focus_stack) < 1) return;
1690 // printf("Focus back\n");
1692 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1695 if (bd->zone != zone) continue;
1696 fl = eina_list_append(fl, bd);
1699 if (!(fbd = e_border_focused_get())) return;
1700 if (fbd->parent) return;
1702 EINA_LIST_REVERSE_FOREACH(fl, l, bd)
1704 if ((fbd) && (bd == fbd))
1708 if ((l->next) && (b = l->next->data))
1710 _policy_border_set_focus(b);
1715 /* we've reached the end of the list. Set focus to first */
1716 if ((b = eina_list_nth(fl, 0)))
1718 _policy_border_set_focus(b);
1728 _policy_focus_forward(E_Zone *zone)
1730 Eina_List *l, *fl = NULL;
1734 if (eina_list_count(_pol_focus_stack) < 1) return;
1736 // printf("Focus forward\n");
1738 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1741 if (bd->zone != zone) continue;
1742 fl = eina_list_append(fl, bd);
1745 if (!(fbd = e_border_focused_get())) return;
1746 if (fbd->parent) return;
1748 EINA_LIST_FOREACH(fl, l, bd)
1750 if ((fbd) && (bd == fbd))
1754 if ((l->next) && (b = l->next->data))
1756 _policy_border_set_focus(b);
1761 /* we've reached the end of the list. Set focus to first */
1762 if ((b = eina_list_nth(fl, 0)))
1764 _policy_border_set_focus(b);
1773 /* enable/disable composite module - 100320 yigl */
1774 #ifdef COMP_MODULE_CONTROL
1776 _policy_property_composite_module_change(Ecore_X_Event_Window_Property *ev)
1780 int current_enabled = 0;
1781 unsigned char* prop_data = NULL;
1782 E_Module* comp = NULL;
1784 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_COMP_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1785 if( ret && prop_data )
1787 memcpy (&enable, prop_data, sizeof (int));
1788 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1790 comp = e_module_find ("comp-tizen");
1793 current_enabled = e_module_enabled_get(comp);
1794 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1796 if( current_enabled && !enable )
1798 fprintf( stdout, "e_module_disable(comp-tizen) " );
1799 e_module_disable(comp);
1801 else if( !current_enabled && enable )
1803 fprintf( stdout, "e_module_enable(comp-tizen) " );
1804 e_module_enable(comp);
1808 fprintf( stdout, "skip... " );
1811 fprintf( stdout, "\n" );
1815 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find comp module.\n", __func__, __LINE__ );
1819 if (prop_data) free (prop_data);
1824 /* enable/disable backkey module - 130610 seongwon1.cho */
1825 #ifdef BACKKEY_MODULE_CONTROL
1827 _policy_property_backkey_module_change(Ecore_X_Event_Window_Property *ev)
1831 int current_enabled = 0;
1832 unsigned char* prop_data = NULL;
1833 E_Module* backkey = NULL;
1835 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1836 if( ret && prop_data )
1838 memcpy (&enable, prop_data, sizeof (int));
1839 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1841 backkey = e_module_find ("backkey-tizen");
1844 current_enabled = e_module_enabled_get(backkey);
1845 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1847 if( current_enabled && !enable )
1849 fprintf( stdout, "e_module_disable(backkey-tizen) " );
1850 e_module_disable(backkey);
1852 else if( !current_enabled && enable )
1854 fprintf( stdout, "e_module_enable(backkey-tizen) " );
1855 e_module_enable(backkey);
1859 fprintf( stdout, "skip... " );
1862 fprintf( stdout, "\n" );
1866 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find backkey module.\n", __func__, __LINE__ );
1867 backkey = e_module_new("backkey-tizen");
1868 if (backkey) e_module_enable(backkey);
1872 if (prop_data) free (prop_data);
1878 /* enable/disable devmode module - 130610 seongwon1.cho */
1879 #ifdef DEVMODE_MODULE_CONTROL
1881 _policy_property_devmode_module_change(Ecore_X_Event_Window_Property *ev)
1885 int current_enabled = 0;
1886 unsigned char* prop_data = NULL;
1887 E_Module* devmode = NULL;
1889 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1890 if( ret && prop_data )
1892 memcpy (&enable, prop_data, sizeof (int));
1893 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1895 devmode = e_module_find ("devmode-tizen");
1898 current_enabled = e_module_enabled_get(devmode);
1899 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1901 if( current_enabled && !enable )
1903 fprintf( stdout, "e_module_disable(devmode-tizen) " );
1904 e_module_disable(devmode);
1906 else if( !current_enabled && enable )
1908 fprintf( stdout, "e_module_enable(devmode-tizen) " );
1909 e_module_enable(devmode);
1913 fprintf( stdout, "skip... " );
1916 fprintf( stdout, "\n" );
1920 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find devmode module.\n", __func__, __LINE__ );
1921 devmode = e_module_new("devmode-tizen");
1922 if (devmode) e_module_enable(devmode);
1926 if (prop_data) free (prop_data);
1932 static void _policy_property_window_state_change (Ecore_X_Event_Window_Property *event)
1934 E_Border *bd, *indi_bd;
1936 if (!(bd = e_border_find_by_client_window(event->win))) return;
1938 /* not interested in stolen or invisible borders */
1939 if ((bd->stolen) || (!bd->visible)) return;
1941 /* make sure the border has a name or class */
1942 /* NB: this check is here because some E borders get State Changes
1943 * but do not have a name/class associated with them. Not entirely sure
1944 * which ones they are, but I would guess Managers, Containers, or Zones.
1945 * At any rate, we're not interested in those types of borders */
1946 if ((!bd->client.icccm.name) || (!bd->client.icccm.class)) return;
1948 /* NB: If we have reached this point, then it should be a fullscreen
1949 * border that has toggled fullscreen on/off */
1951 /* if the window is not active window, then it doesn't need to hande indicator */
1952 if (g_active_win != bd->client.win) return;
1954 /* try to get the Indicator on this zone */
1955 if (!(indi_bd = e_illume_border_indicator_get(bd->zone))) return;
1957 /* if we are fullscreen, hide the indicator...else we show it */
1958 /* NB: we could use the e_illume_border_is_fullscreen function here
1959 * but we save ourselves a function call this way */
1960 if ((bd->fullscreen) || (bd->need_fullscreen))
1962 if (indi_bd->visible)
1964 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
1965 e_border_hide(indi_bd, 2);
1970 int indi_show = _policy_border_indicator_state_get(bd);
1973 if (!indi_bd->visible)
1975 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
1976 e_border_show(indi_bd);
1983 static void _policy_property_indicator_geometry_change (Ecore_X_Event_Window_Property *event)
1990 /* make sure this property changed on a zone */
1991 if (!(zone = e_util_zone_window_find(event->win))) return;
1993 /* get the geometry */
1994 if (!(bd = e_illume_border_indicator_get(zone))) return;
2000 /* look for conformant borders */
2001 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2004 if (bd->zone != zone) continue;
2005 if (!e_illume_border_is_conformant(bd)) continue;
2006 /* set indicator geometry on conformant window */
2007 /* NB: This is needed so that conformant apps get told about
2008 * the indicator size/position...else they have no way of
2009 * knowing that the geometry has been updated */
2010 ecore_x_e_illume_indicator_geometry_set(bd->client.win, x, y, w, h);
2014 static void _policy_property_clipboard_geometry_change (Ecore_X_Event_Window_Property *event)
2021 /* make sure this property changed on a zone */
2022 if (!(zone = e_util_zone_window_find(event->win))) return;
2024 ecore_x_e_illume_clipboard_geometry_get(zone->black_win, &x, &y, &w, &h);
2026 /* look for conformant borders */
2027 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2030 if (bd->zone != zone) continue;
2031 if (e_illume_border_is_indicator(bd)) continue;
2032 if (e_illume_border_is_keyboard(bd)) continue;
2033 if (e_illume_border_is_keyboard_sub(bd)) continue;
2034 if (e_illume_border_is_quickpanel(bd)) continue;
2035 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2038 SECURE_SLOGD("[WM] Clipboard geometry set. win:0x%07x, geo(%d,%d,%d,%d)", bd->client.win, x, y, w, h);
2040 ecore_x_e_illume_clipboard_geometry_set(bd->client.win, x, y, w, h);
2044 static void _policy_property_clipboard_state_change (Ecore_X_Event_Window_Property *event)
2049 Ecore_X_Illume_Clipboard_State state;
2051 /* make sure this property changed on a zone */
2052 if (!(zone = e_util_zone_window_find(event->win))) return;
2054 state = ecore_x_e_illume_clipboard_state_get(zone->black_win);
2056 /* look for conformant borders */
2057 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2060 if (bd->zone != zone) continue;
2061 if (e_illume_border_is_indicator(bd)) continue;
2062 if (e_illume_border_is_keyboard(bd)) continue;
2063 if (e_illume_border_is_keyboard_sub(bd)) continue;
2064 if (e_illume_border_is_quickpanel(bd)) continue;
2065 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2068 SECURE_SLOGD("[WM] Clipboard state set. win:0x%07x, state:%d", bd->client.win, state);
2070 ecore_x_e_illume_clipboard_state_set(bd->client.win, state);
2074 static void _policy_property_enlightenment_scale_change (Ecore_X_Event_Window_Property *event)
2079 EINA_LIST_FOREACH(e_manager_list(), ml, man)
2085 if (event->win != man->root) continue;
2086 EINA_LIST_FOREACH(man->containers, cl, con)
2092 EINA_LIST_FOREACH(con->zones, zl, zone)
2093 _policy_zone_layout_update(zone);
2098 static void _policy_property_rotate_win_angle_change (Ecore_X_Event_Window_Property *event)
2101 E_Illume_XWin_Info* xwin_info;
2103 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. win:0x%07x\n", __func__, __LINE__, event->win);
2105 if (!(bd = e_border_find_by_client_window(event->win))) return;
2107 xwin_info = _policy_xwin_info_find (bd->win);
2110 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
2112 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. CALL _policy_change_root_angle_by_border_angle!!! win:0x%07x\n", __func__, __LINE__, bd->client.win);
2113 _policy_change_root_angle_by_border_angle (bd);
2117 bd->changes.pos = 1;
2121 static void _policy_property_indicator_state_change (Ecore_X_Event_Window_Property *event)
2123 E_Border *bd, *indi_bd;
2125 if (!(bd = e_border_find_by_client_window(event->win))) return;
2127 indi_bd = e_illume_border_indicator_get(bd->zone);
2128 if (!indi_bd) return;
2130 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2131 _policy_border_indicator_control(indi_bd);
2134 static void _policy_property_indicator_opacity_change(Ecore_X_Event_Window_Property *event)
2136 E_Border *bd, *indi_bd;
2137 Ecore_X_Window active_win;
2138 Ecore_X_Illume_Indicator_Opacity_Mode mode;
2140 if (!(bd = e_border_find_by_client_window(event->win))) return;
2142 indi_bd = e_illume_border_indicator_get(bd->zone);
2143 if (!indi_bd) return;
2145 active_win = _policy_active_window_get(bd->zone->container->manager->root);
2146 if (active_win == bd->client.win)
2148 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
2149 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
2153 static void _policy_active_win_change(E_Illume_XWin_Info *xwin_info, Ecore_X_Window active_win)
2155 E_Border *active_bd = NULL;
2158 if (!xwin_info) return;
2159 if (!xwin_info->comp_vis) return;
2161 active_bd = e_border_find_by_client_window(active_win);
2163 /* for active/deactive message */
2164 if (active_win != g_active_win)
2167 active_pid = active_bd->client.netwm.pid;
2171 // 1. send deactive event to g_active_win
2172 ecore_x_client_message32_send(g_active_win, E_ILLUME_ATOM_DEACTIVATE_WINDOW,
2173 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2175 // 2. send active event to active_win
2176 ecore_x_client_message32_send(active_win, E_ILLUME_ATOM_ACTIVATE_WINDOW,
2177 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2183 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2185 if ((E_ILLUME_BORDER_IS_IN_DESKTOP(active_bd)) ||
2186 (active_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
2188 e_border_raise(active_bd);
2194 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2197 g_active_win = active_win;
2198 g_active_pid = active_pid;
2203 if (_e_illume_cfg->use_indicator_widget)
2205 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
2206 _policy_border_root_angle_control(active_bd->zone);
2211 indi_bd = e_illume_border_indicator_get(active_bd->zone);
2214 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, active_bd->client.win);
2215 _policy_border_indicator_control(indi_bd);
2219 ILLUME2_TRACE ("[ILLUME2] ACTIVE WINDOW... (%d) active win = 0x%07x HIDE quickpanel\n", __LINE__, active_win);
2220 e_illume_quickpanel_hide(active_bd->zone, 0);
2224 static void _policy_property_active_win_change (Ecore_X_Event_Window_Property *event)
2226 Ecore_X_Window active_win;
2227 E_Border* active_bd;
2228 E_Illume_XWin_Info *xwin_info;
2230 active_win = _policy_active_window_get(event->win);
2231 active_bd = e_border_find_by_client_window(active_win);
2234 xwin_info = _policy_xwin_info_find(active_bd->win);
2238 xwin_info = _policy_xwin_info_find(active_win);
2241 _policy_active_win_change(xwin_info, active_win);
2244 static void _policy_property_win_type_change (Ecore_X_Event_Window_Property *event)
2248 E_Illume_Border_Info* bd_info = NULL;
2251 if (!(bd = e_border_find_by_client_window(event->win))) return;
2253 bd_info = _policy_get_border_info(bd);
2254 if (!bd_info) return;
2256 e_hints_window_type_get (bd);
2258 if (bd_info->win_type == bd->client.netwm.type) return;
2259 bd_info->win_type = bd->client.netwm.type;
2261 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2263 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NOTIFICATION!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2264 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2265 layer = _policy_notification_level_map(bd_info->level);
2266 e_border_layer_set(bd, layer);
2268 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n", __func__, __LINE__, bd->client.win, bd_info->level);
2270 indi_bd = e_illume_border_indicator_get(bd->zone);
2273 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2274 _policy_border_indicator_control(indi_bd);
2277 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2278 _policy_border_uniconify_top_border(bd);
2280 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL)
2282 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NORMAL!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2283 if (bd->layer != POL_APP_LAYER)
2285 if ( (!e_illume_border_is_quickpanel(bd)) &&
2286 (!e_illume_border_is_quickpanel_popup(bd)) &&
2287 (!e_illume_border_is_keyboard(bd)) &&
2288 (!e_illume_border_is_keyboard_sub(bd)))
2290 e_border_layer_set(bd, POL_APP_LAYER);
2294 indi_bd = e_illume_border_indicator_get(bd->zone);
2297 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2298 _policy_border_indicator_control(indi_bd);
2301 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2302 _policy_border_uniconify_top_border(bd);
2304 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY)
2306 bd->client.icccm.request_pos = 1;
2308 if (bd->layer != POL_APP_LAYER)
2309 e_border_layer_set(bd, POL_APP_LAYER);
2314 static void _policy_property_rotate_root_angle_change (Ecore_X_Event_Window_Property *event)
2321 unsigned char *prop_data = NULL;
2324 ret = ecore_x_window_prop_property_get (event->win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
2325 if( ret && prop_data )
2326 memcpy (&angle, prop_data, sizeof (int));
2328 if (prop_data) free (prop_data);
2330 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. ROOT ANGLE CHANGED... angle = %d. control_win:0x%07x\n", __func__, __LINE__, angle, g_indi_control_win);
2331 bd = e_border_find_by_client_window(g_indi_control_win);
2333 if (bd) zone = bd->zone;
2334 else zone = e_util_container_zone_number_get (0, 0);
2338 // send client message to all visible windows
2339 if (g_root_angle != angle)
2341 indi_bd = e_illume_border_indicator_get(zone);
2344 _policy_indicator_angle_change (indi_bd, angle);
2350 EINA_LIST_FOREACH(e_border_client_list(), l, bd_temp)
2352 if (!bd_temp) continue;
2353 if (!bd_temp->visible && !bd_temp->iconic)
2355 if (!e_illume_border_is_keyboard(bd_temp))
2359 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win = 0x%07x.. SEND client Event with angle = %d\n", __func__, __LINE__, bd_temp->client.win, angle);
2360 ecore_x_client_message32_send (bd_temp->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
2361 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, angle, g_indi_control_win, 0, 0, 0);
2364 if (_e_illume_cfg->use_indicator_widget)
2366 E_Illume_Quickpanel *qp;
2367 qp = e_illume_quickpanel_by_zone_get(zone);
2369 _policy_layout_quickpanel_rotate(qp, angle);
2372 e_illume_util_hdmi_rotation (event->win, angle);
2376 g_root_angle = angle;
2379 static void _policy_property_notification_level_change (Ecore_X_Event_Window_Property *event)
2382 0. Check if border is exist or not
2383 1. Check if a window is notification or not
2384 2. Get and Set level
2387 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... E_ILLUME_ATOM_NOTIFICATION_LEVEL property!!! win = 0x%07x\n", __func__, __LINE__, event->win);
2391 E_Illume_Border_Info *bd_info = NULL;
2395 if (!(bd = e_border_find_by_client_window(event->win)))
2397 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... Win (0x%07x) doesn't have border... So return..\n", __func__, __LINE__, event->win);
2401 bd_info = _policy_get_border_info(bd);
2402 if (!bd_info) return;
2405 if (!e_illume_border_is_notification (bd))
2407 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... Win (0x%07x) gets NOTIFICATION_LEVEL notifiy... But this is NOT notification window... IGNORE!!!!!\n", __func__, __LINE__, bd->client.win);
2412 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2413 layer = _policy_notification_level_map(bd_info->level);
2416 e_border_layer_set(bd, layer);
2417 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
2418 __func__, __LINE__, bd->client.win, bd_info->level);
2421 indi_bd = e_illume_border_indicator_get(bd->zone);
2424 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2425 _policy_border_indicator_control(indi_bd);
2428 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2429 _policy_border_uniconify_top_border(bd);
2432 static void _policy_property_overlay_win_change (Ecore_X_Event_Window_Property *event)
2436 unsigned char* prop_data = NULL;
2438 ret = ecore_x_window_prop_property_get (event->win, E_ILLUME_ATOM_OVERAY_WINDOW, ECORE_X_ATOM_WINDOW, 32, &prop_data, &count);
2439 if( ret && prop_data )
2440 memcpy (&_e_overlay_win, prop_data, sizeof (ECORE_X_ATOM_WINDOW));
2442 if (prop_data) free (prop_data);
2444 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d)... OVERAY_WINDOW:0x%07x\n", __func__, __LINE__, _e_overlay_win);
2445 _policy_xwin_info_delete (_e_overlay_win);
2448 static int _policy_property_window_opaque_get (Ecore_X_Window win)
2453 unsigned char* prop_data = NULL;
2455 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_WINDOW_OPAQUE, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
2456 if( ret && prop_data )
2457 memcpy (&is_opaque, prop_data, sizeof (ECORE_X_ATOM_CARDINAL));
2459 if (prop_data) free (prop_data);
2464 static void _policy_property_window_opaque_change (Ecore_X_Event_Window_Property *event)
2467 E_Illume_Border_Info* bd_info;
2469 if (!(bd = e_border_find_by_client_window(event->win))) return;
2472 bd_info = _policy_get_border_info (bd);
2473 if (!bd_info) return;
2475 // set current property
2476 bd_info->opaque = _policy_property_window_opaque_get (event->win);
2478 // visibility is changed
2479 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
2480 _g_visibility_changed = EINA_TRUE;
2484 _policy_property_illume_window_state_change(Ecore_X_Event_Window_Property *event)
2488 if (!(bd = e_border_find_by_client_window(event->win))) return;
2489 if (bd->stolen) return;
2491 unsigned int state = ecore_x_e_illume_window_state_get(event->win);
2492 _policy_border_illume_window_state_change(bd, state);
2496 _policy_border_illume_window_state_change(E_Border *bd, unsigned int state)
2501 if (bd->client.illume.win_state.state == state) return;
2503 ELBF(ELBT_ILLUME, 0, bd->client.win, "SET WIN_STATE %d->%d",
2504 bd->client.illume.win_state.state, state);
2506 bd->client.illume.win_state.state = state;
2509 case ECORE_X_ILLUME_WINDOW_STATE_FLOATING:
2510 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_ADD);
2512 if (_e_illume_cfg->use_force_iconify)
2513 _policy_border_uniconify_below_borders(bd);
2515 bd->client.icccm.request_pos = EINA_TRUE;
2516 bd->lock_user_size = 0;
2517 bd->lock_user_location = 0;
2521 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
2523 indi_bd = e_illume_border_indicator_get(bd->zone);
2526 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2527 _policy_border_indicator_control(indi_bd);
2530 if (!eina_list_data_find(dep_rot.list, bd))
2532 int prev_ang = _prev_angle_get(bd->client.win);
2534 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
2536 dep_rot.list = eina_list_append(dep_rot.list, bd);
2539 bd->client.e.state.rot.curr = prev_ang;
2541 if (dep_rot.ang != bd->client.e.state.rot.curr)
2542 e_border_rotation_set(bd, dep_rot.ang);
2546 case ECORE_X_ILLUME_WINDOW_STATE_NORMAL:
2547 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_REMOVE);
2549 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
2551 bd->lock_user_size = 1;
2552 bd->lock_user_location = 1;
2554 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
2559 bd->client.icccm.request_pos = EINA_FALSE;
2561 indi_bd = e_illume_border_indicator_get(bd->zone);
2564 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2565 _policy_border_indicator_control(indi_bd);
2568 if (eina_list_data_find(dep_rot.list, bd) == bd)
2570 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_NORMAL;
2571 dep_rot.list = eina_list_remove(dep_rot.list, bd);
2575 bd->changes.size = 1;
2576 bd->changes.pos = 1;
2581 _policy_border_illume_handlers_add(E_Illume_Border_Info *bd_info)
2583 if (!bd_info) return;
2584 if (bd_info->handlers) return;
2586 bd_info->handlers = eina_list_append(bd_info->handlers,
2587 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
2588 _policy_border_cb_mouse_up, bd_info));
2589 bd_info->handlers = eina_list_append(bd_info->handlers,
2590 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
2591 _policy_border_cb_mouse_move, bd_info));
2595 _policy_border_illume_handlers_remove(E_Illume_Border_Info *bd_info)
2597 Ecore_Event_Handler *hdl;
2599 if (!bd_info) return;
2600 if (!bd_info->handlers) return;
2602 EINA_LIST_FREE(bd_info->handlers, hdl)
2603 ecore_event_handler_del(hdl);
2607 _policy_border_cb_mouse_down(void *data,
2608 int type __UNUSED__,
2611 Ecore_Event_Mouse_Button *ev;
2612 E_Illume_Border_Info *bd_info;
2615 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2618 bd = bd_info->border;
2620 if (ev->window != bd->event_win &&
2621 ev->event_window != bd->event_win)
2622 return ECORE_CALLBACK_PASS_ON;
2624 if (bd_info->resize_req.mouse.down)
2625 return ECORE_CALLBACK_PASS_ON;
2627 bd_info->resize_req.mouse.down = 1;
2629 bd_info->resize_req.mouse.dx = bd->x - ev->root.x;
2630 bd_info->resize_req.mouse.dy = bd->y - ev->root.y;
2632 bd_info->resize_req.mouse.x = bd->x;
2633 bd_info->resize_req.mouse.y = bd->y;
2636 ecore_x_mouse_down_send(bd->client.win, ev->x, ev->y, ev->buttons);
2638 return ECORE_CALLBACK_PASS_ON;
2642 _resize_rect_geometry_get(E_Illume_Border_Info *bd_info,
2643 Evas_Coord_Rectangle *r,
2647 E_Resizable_Area_Info *area)
2650 int x = 0, y = 0, w = 0, h = 0;
2656 bd = bd_info->border;
2658 e_illume_border_min_get(bd, &mw, &mh);
2659 // min_size is workaround adjustement due to some window's wrong w h after rotation is changed.
2660 if(mw < min_size) mw = min_size;
2661 if(mh < min_size) mh = min_size;
2663 if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BR)
2665 switch (bd_info->resize_req.angle)
2668 cx = bd->x; cy = bd->y;
2669 x = bd->x; y = bd->y;
2670 w = ev_x - bd->x; h = ev_y - bd->y;
2673 cx = bd->x; cy = bd->y + bd->h;
2674 x = bd->x; y = ev_y;
2675 w = ev_x - x; h = (bd->y + bd->h) - y;
2678 cx = bd->x + bd->w; cy = bd->y + bd->h;
2680 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2683 cx = bd->x + bd->w; cy = bd->y;
2684 x = ev_x; y = bd->y;
2685 w = (bd->x + bd->w) - x; h = ev_y - y;
2691 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TL)
2693 switch (bd_info->resize_req.angle)
2696 cx = bd->x + bd->w; cy = bd->y + bd->h;
2698 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2701 cx = bd->x + bd->w; cy = bd->y;
2702 x = ev_x; y = bd->y;
2703 w = (bd->x + bd->w) - x; h = ev_y - y;
2706 cx = bd->x; cy = bd->y;
2707 x = bd->x; y = bd->y;
2708 w = ev_x - bd->x; h = ev_y - bd->y;
2711 cx = bd->x; cy = bd->y + bd->h;
2712 x = bd->x; y = ev_y;
2713 w = ev_x - x; h = (bd->y + bd->h) - y;
2719 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TR)
2721 switch (bd_info->resize_req.angle)
2724 cx = bd->x; cy = bd->y + bd->h;
2725 x = bd->x; y = ev_y;
2726 w = ev_x - x; h = (bd->y + bd->h) - y;
2729 cx = bd->x + bd->w; cy = bd->y + bd->h;
2731 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2734 cx = bd->x + bd->w; cy = bd->y;
2735 x = ev_x; y = bd->y;
2736 w = (bd->x + bd->w) - x; h = ev_y - y;
2739 cx = bd->x; cy = bd->y;
2740 x = bd->x; y = bd->y;
2741 w = ev_x - bd->x; h = ev_y - bd->y;
2747 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BL)
2749 switch (bd_info->resize_req.angle)
2752 cx = bd->x + bd->w; cy = bd->y;
2753 x = ev_x; y = bd->y;
2754 w = (bd->x + bd->w) - x; h = ev_y - y;
2757 cx = bd->x; cy = bd->y;
2758 x = bd->x; y = bd->y;
2759 w = ev_x - bd->x; h = ev_y - bd->y;
2762 cx = bd->x; cy = bd->y + bd->h;
2763 x = bd->x; y = ev_y;
2764 w = ev_x - x; h = (bd->y + bd->h) - y;
2767 cx = bd->x + bd->w; cy = bd->y + bd->h;
2769 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2775 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_R)
2777 switch (bd_info->resize_req.angle)
2780 cx = bd->x; cy = bd->y;
2781 x = bd->x; y = bd->y;
2782 w = ev_x - bd->x; h = bd->h;
2785 cx = bd->x; cy = bd->y + bd->h;
2786 x = bd->x; y = ev_y;
2787 w = bd->w; h = (bd->y + bd->h) - y;
2790 cx = bd->x + bd->w; cy = bd->y + bd->h;
2792 w = (bd->x + bd->w) - x; h = bd->h;
2795 cx = bd->x + bd->w; cy = bd->y;
2796 x = ev_x; y = bd->y;
2797 w = bd->w; h = ev_y - y;
2803 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_L)
2805 switch (bd_info->resize_req.angle)
2808 cx = bd->x + bd->w; cy = bd->y + bd->h;
2809 x = ev_x; y = bd->y;
2810 w = (bd->x + bd->w) - x; h = bd->h;
2813 cx = bd->x + bd->w; cy = bd->y;
2814 x = ev_x; y = bd->y;
2815 w = bd->w; h = ev_y - y;
2818 cx = bd->x; cy = bd->y;
2819 x = bd->x; y = bd->y;
2820 w = ev_x - bd->x; h = bd->h;
2823 cx = bd->x; cy = bd->y + bd->h;
2824 x = bd->x; y = ev_y;
2825 w = bd->w; h = (bd->y + bd->h) - y;
2831 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_T)
2833 switch (bd_info->resize_req.angle)
2836 cx = bd->x + bd->w; cy = bd->y + bd->h;
2837 x = bd->x; y = ev_y;
2838 w = bd->w; h = (bd->y + bd->h) - y;
2841 cx = bd->x + bd->w; cy = bd->y;
2842 x = ev_x; y = bd->y;
2843 w = (bd->x + bd->w) - x; h = bd->h;
2846 cx = bd->x; cy = bd->y;
2847 x = bd->x; y = bd->y;
2848 w = bd->w; h = ev_y - bd->y;
2851 cx = bd->x + bd->w; cy = bd->y;
2852 x = bd->x; y = bd->y;
2853 w = ev_x - bd->x; h = bd->h;
2859 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_B)
2861 switch (bd_info->resize_req.angle)
2864 cx = bd->x; cy = bd->y;
2865 x = bd->x; y = bd->y;
2866 w = bd->w; h = ev_y - bd->y;
2869 cx = bd->x + bd->w; cy = bd->y;
2870 x = bd->x; y = bd->y;
2871 w = ev_x - bd->x; h = bd->h;
2874 cx = bd->x + bd->w; cy = bd->y + bd->h;
2875 x = bd->x; y = ev_y;
2876 w = bd->w; h = (bd->y + bd->h) - y;
2879 cx = bd->x + bd->w; cy = bd->y;
2880 x = ev_x; y = bd->y;
2881 w = (bd->x + bd->w) - x; h = bd->h;
2890 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... ERROR... direction(%d) is not defined!!!\n", __func__, __LINE__, direction);
2894 if (bd->zone->w > bd->zone->h)
2895 max_size = bd->zone->h;
2897 max_size = bd->zone->w;
2903 area->min_width = mw;
2904 area->min_height = mh;
2905 area->max_width = max_size;
2906 area->max_height = max_size;
2911 if (w > max_size) w = max_size;
2912 if (h > max_size) h = max_size;
2914 if ((x + w) > (bd->x + w)) x = cx - w;
2915 if ((y + h) > (bd->y + h)) y = cy - h;
2917 if ((cx - x) > max_size)
2919 if ((cy - y) > max_size)
2922 x = x - bd->zone->x;
2923 y = y - bd->zone->y;
2932 _policy_border_cb_mouse_up(void *data,
2933 int type __UNUSED__,
2936 Ecore_Event_Mouse_Button *ev;
2937 E_Illume_Border_Info *bd_info;
2940 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2943 bd = bd_info->border;
2945 if (ev->window != bd->event_win &&
2946 ev->event_window != bd->event_win)
2947 return ECORE_CALLBACK_PASS_ON;
2949 if (!bd_info->resize_req.mouse.down)
2950 return ECORE_CALLBACK_PASS_ON;
2952 bd->lock_user_location = 0;
2953 e_grabinput_release(bd->event_win, bd->event_win);
2955 if (bd_info->resize_req.mouse.resize)
2957 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2958 Evas_Coord_Rectangle r;
2959 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, NULL);
2961 bd_info->resize_req.direction = ECORE_X_NETWM_DIRECTION_CANCEL;
2962 bd_info->resize_req.mouse.x = r.x + bd->zone->x;
2963 bd_info->resize_req.mouse.y = r.y + bd->zone->y;
2964 bd_info->resize_req.mouse.w = r.w;
2965 bd_info->resize_req.mouse.h = r.h;
2966 bd_info->resize_req.need_change = 1;
2967 bd->changes.pos = 1;
2968 bd->changes.size = 1;
2970 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
2974 printf("[IL2] DEL OBJ in UP\n");
2979 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2980 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
2981 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
2984 bd_info->resize_req.mouse.down = 0;
2985 bd_info->resize_req.mouse.resize = 0;
2986 bd_info->resize_req.mouse.locked = 0;
2988 /* set property on this border to say we are done dragging */
2989 ecore_x_e_illume_drag_set(bd->client.win, 0);
2991 /* set property on zone window that a drag is finished */
2992 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
2994 ecore_x_window_raise(bd->client.shell_win);
2995 _policy_border_illume_handlers_remove(bd_info);
2997 return ECORE_CALLBACK_PASS_ON;
3001 _policy_border_cb_mouse_move(void *data,
3002 int type __UNUSED__,
3005 Ecore_Event_Mouse_Move *ev;
3006 E_Illume_Border_Info *bd_info;
3010 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3013 bd = bd_info->border;
3015 if (ev->window != bd->event_win &&
3016 ev->event_window != bd->event_win)
3017 return ECORE_CALLBACK_PASS_ON;
3019 if (!bd_info->resize_req.mouse.down)
3020 return ECORE_CALLBACK_PASS_ON;
3022 if (bd_info->resize_req.mouse.resize)
3024 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... event (x:%d, y:%d, root_x:%d, root_y:%d)\n", __func__, __LINE__, ev->x, ev->y, ev->root.x, ev->root.y);
3025 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
3026 if (!o) return ECORE_CALLBACK_PASS_ON;
3028 Evas_Coord_Rectangle r;
3029 E_Resizable_Area_Info area;
3031 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, &area);
3032 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... x:%d, y:%d, w:%d, h:%d\n", __func__, __LINE__, r.x, r.y, r.w, r.h);
3034 rect = edje_object_part_object_get(o, "opacity_rect");
3036 if((r.w <= area.min_width && r.h <= area.min_height)
3037 || (r.w >= area.max_width && r.h >= area.max_height))
3039 edje_object_signal_emit(o, "resize,notavail", "illume2");
3040 evas_object_color_set(rect, 64, 64, 64, 64);
3044 edje_object_signal_emit(o, "resize,normal", "illume2");
3045 evas_object_color_set(rect, 255, 255, 255, 255);
3047 if(area.x_dist < area.min_width && area.y_dist < area.min_height)
3050 tmp = ((area.min_width-area.x_dist)>= (area.min_height-area.y_dist))? area.min_width - area.x_dist : area.min_height - area.y_dist;
3056 tmp = (int)(128*( (double)tmp/10 + 1));
3057 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3059 if (area.x_dist > area.max_width && area.y_dist > area.max_height)
3062 tmp = ((area.x_dist - area.max_width) >= (area.y_dist - area.max_height))? area.x_dist - area.max_width : area.y_dist - area.max_height;
3068 tmp = (int)(128*( (double)tmp/10 + 1));
3069 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3072 evas_object_move(o, r.x, r.y);
3073 evas_object_resize(o, r.w, r.h);
3077 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3078 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
3079 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
3080 bd->changes.pos = 1;
3081 bd->changed = EINA_TRUE;
3084 return ECORE_CALLBACK_PASS_ON;
3088 _policy_property_change(Ecore_X_Event_Window_Property *event)
3090 // printf("Property Change\n");
3092 /* we are interested in state changes here */
3093 if (event->atom == ECORE_X_ATOM_NET_WM_STATE)
3095 _policy_property_window_state_change (event);
3097 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY)
3099 _policy_property_indicator_geometry_change (event);
3101 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
3103 _policy_property_clipboard_geometry_change (event);
3105 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
3107 _policy_property_clipboard_state_change (event);
3109 else if (event->atom == ATM_ENLIGHTENMENT_SCALE)
3111 _policy_property_enlightenment_scale_change (event);
3113 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
3115 _policy_property_rotate_win_angle_change (event);
3117 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
3119 _policy_property_indicator_state_change (event);
3121 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE)
3123 _policy_property_indicator_opacity_change(event);
3125 else if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
3127 _policy_property_active_win_change (event);
3129 else if (event->atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
3131 _policy_property_win_type_change (event);
3133 else if (event->atom == E_ILLUME_ATOM_STACK_DISPLAY)
3135 _policy_border_list_print (event->win);
3137 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
3139 _policy_property_rotate_root_angle_change (event);
3141 else if (event->atom == E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3143 _policy_property_notification_level_change (event);
3145 /* for visibility */
3146 else if (event->atom == E_ILLUME_ATOM_OVERAY_WINDOW)
3148 _policy_property_overlay_win_change (event);
3150 else if (event->atom == E_ILLUME_ATOM_WINDOW_OPAQUE)
3152 _policy_property_window_opaque_change (event);
3154 else if (event->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
3156 _policy_property_illume_window_state_change(event);
3158 /* enable/disable composite module - 100320 yigl */
3159 #ifdef COMP_MODULE_CONTROL
3160 else if (event->atom == E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3162 _policy_property_composite_module_change (event);
3165 /* enable/disable backkey module - 130610 seongwon1.cho */
3166 #ifdef BACKKEY_MODULE_CONTROL
3167 else if (event->atom == E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3169 _policy_property_backkey_module_change (event);
3172 /* enable/disable devmode module - 130610 seongwon1.cho */
3173 #ifdef DEVMODE_MODULE_CONTROL
3174 else if (event->atom == E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3176 _policy_property_devmode_module_change (event);
3179 else if (event->atom == E_INDICATOR_CMD_WIN)
3181 _policy_property_indicator_cmd_win_change(event);
3183 else if (event->atom == E_ACTIVE_INDICATOR_WIN)
3185 _policy_property_active_indicator_win_change(event);
3191 _policy_border_list_print (Ecore_X_Window win)
3193 Eina_List* border_list;
3196 E_Border* temp_bd = NULL;
3198 E_Illume_Print_Info info;
3199 unsigned char* prop_data = NULL;
3203 memset (info.file_name, 0, 256);
3205 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_STACK_DISPLAY, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
3206 if( ret && prop_data )
3207 memcpy (&info, prop_data, sizeof (E_Illume_Print_Info));
3209 if (prop_data) free (prop_data);
3211 out = fopen (info.file_name, "w+");
3212 if (out == NULL) out = stderr;
3214 if ((info.type & PT_STACK) == PT_STACK)
3216 border_list = e_border_client_list();
3220 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3221 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3222 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3224 EINA_LIST_FOREACH(border_list, l, bd)
3227 if (temp_bd == NULL) temp_bd = bd;
3229 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3230 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3232 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3236 E_Illume_Border_Info* bd_info;
3237 if (e_border_info_list)
3240 fprintf (out, "--------------------------------ILLUME BORDER INFO------------------------------------------------------------------\n" );
3241 fprintf (out, " No Border ClientWin w h x y isKBD layer level desk WinName\n" );
3242 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3244 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
3249 int desk_x=0, desk_y=0;
3250 if (!bd_info) continue;
3252 bd = bd_info->border;
3255 for (x = 0; x < zone->desk_x_count; x++)
3257 for (y = 0; y < zone->desk_y_count; y++)
3259 if (bd->desk == zone->desks[x + zone->desk_x_count * y])
3267 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %3i %5i %5i (%d,%d) %-30s \n",
3268 i++, bd_info->border->win, bd_info->border->client.win, bd_info->border->w, bd_info->border->h, bd_info->border->x, bd_info->border->y,
3269 bd_info->border->client.vkbd.vkbd, bd_info->border->layer, bd_info->level, desk_x, desk_y, bd_info->border->client.netwm.name);
3271 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3275 if (temp_bd == NULL) goto finish;
3279 fprintf (out, "-------------------------------- E17 STACK INFO--------------------------------------------\n" );
3280 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3281 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3284 bl = e_container_border_list_last(temp_bd->zone->container);
3285 while ((bd = e_container_border_list_prev(bl)))
3287 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3288 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3290 e_container_border_list_free(bl);
3291 fprintf (out, "---------------------------------------------------------------------------------------------\n\n" );
3294 /* for visibility */
3295 if ((info.type & PT_VISIBILITY) == PT_VISIBILITY)
3297 Eina_Inlist* xwin_info_list;
3298 E_Illume_XWin_Info *xwin_info;
3300 xwin_info_list = _e_illume_xwin_info_list;
3304 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3305 fprintf (out, " No Win w h x y depth viewable visibility comp_vis iconify by_wm is_border(Client Win)\n" );
3306 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3308 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
3310 if (xwin_info->bd_info)
3312 if (xwin_info->bd_info->border)
3314 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i %5i %5i yes(0x%07x)\n",
3315 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3316 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->bd_info->border->iconic, xwin_info->iconify_by_wm, xwin_info->bd_info->border->client.win);
3320 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3321 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3322 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3327 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3328 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3329 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3332 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3340 fprintf (out, "--------------------------------GLOBAL INFO--------------------------------------------------\n" );
3341 fprintf (out, "g_rotated_win:0x%07x (g_root_angle:%d)\n", g_rotated_win, g_root_angle);
3342 fprintf (out, "g_active_win:0x%07x (pid:%d, angle:%d)\n", g_active_win, g_active_pid, _policy_window_rotation_angle_get(g_active_win));
3343 fprintf (out, "g_indi_control_win:0x%07x\n", g_indi_control_win);
3344 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3352 ecore_x_client_message32_send (ecore_x_window_root_first_get(), E_ILLUME_ATOM_STACK_DISPLAY_DONE,
3353 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3359 _policy_window_rotation_angle_get(Ecore_X_Window win)
3362 int ret, size_ret = 0;
3363 unsigned long num_ret = 0, bytes = 0;
3364 unsigned char *prop_ret = NULL;
3365 Ecore_X_Display *dpy;
3368 dpy = ecore_x_display_get();
3371 win = ecore_x_window_root_first_get();
3373 ret = XGetWindowProperty(dpy, win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, 0, LONG_MAX,
3374 False, ECORE_X_ATOM_CARDINAL, &type_ret, &size_ret,
3375 &num_ret, &bytes, &prop_ret);
3377 if (ret == ECORE_X_ERROR_CODE_SUCCESS)
3379 if (prop_ret && num_ret)
3381 angle = ((int *)prop_ret)[0];
3382 if (angle % 90) angle = -1;
3392 if (prop_ret) XFree(prop_ret);
3398 static Ecore_X_Window
3399 _policy_active_window_get(Ecore_X_Window root)
3404 ret = ecore_x_window_prop_xid_get(root,
3405 ECORE_X_ATOM_NET_ACTIVE_WINDOW,
3406 ECORE_X_ATOM_WINDOW,
3409 if ((ret == 1) && win)
3416 _policy_border_indicator_state_get(E_Border *bd)
3418 Ecore_X_Illume_Indicator_State state;
3421 state = ecore_x_e_illume_indicator_state_get(bd->client.win);
3422 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
3424 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
3432 static void _policy_layout_quickpanel_rotate (E_Illume_Quickpanel* qp, int angle)
3436 E_Illume_Quickpanel_Info *panel;
3442 // pass 1 - resize window
3443 // It caused abnormal size of quickpanel window and abnormal rotation state.
3444 // disable it for now.
3446 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3448 if (!panel) continue;
3449 if (panel->angle == angle) continue;
3451 if (panel->angle > angle) diff = panel->angle - angle;
3452 else diff = angle - panel->angle;
3456 if (angle == 0 || angle == 180)
3458 if (diff == 90 || diff == 270)
3461 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Portrait quick panel...(%d) quick win = 0x%07x old (%d, %d) new (%d, %d)\n", __LINE__, bd->client.win, bd->w, bd->h, bd->zone->w, temp);
3462 _policy_border_resize (bd, bd->zone->w, temp);
3465 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Portrait quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3469 if (diff == 90 || diff == 270)
3472 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Landscape quick panel...(%d) quick win = 0x%07x old (%d, %d) new (%d, %d)\n", __LINE__, bd->client.win, bd->w, bd->h, temp, bd->zone->h);
3473 _policy_border_resize (bd, temp, bd->zone->h);
3476 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Landscape quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3481 // pass 2 - send client message
3482 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3484 if (!panel) continue;
3485 if (panel->angle == angle) continue;
3487 if (panel->angle > angle) diff = panel->angle - angle;
3488 else diff = angle - panel->angle;
3492 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] SEND CLIENT MESSAGE TO QUICKPANEL!!!!(%d) win:0x%07x, angle = %d\n", __LINE__, bd->client.win, angle);
3493 ecore_x_client_message32_send (bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
3494 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3497 panel->angle = angle;
3502 _policy_window_focus_in(Ecore_X_Event_Window_Focus_In *event)
3504 ILLUME2_TRACE("[ILLUME2-FOCUS] _policy_window_focus_in... win = 0x%07x\n", event->win);
3508 if (e_config->focus_policy == E_FOCUS_CLICK) return;
3510 if (!(bd = e_border_find_by_client_window(event->win))) return;
3512 if (e_illume_border_is_indicator (bd))
3518 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3521 EINA_LIST_FOREACH(man->containers, cl, con)
3526 // send focus to top-level window.
3527 bl = e_container_border_list_last(con);
3528 while ((temp_bd = e_container_border_list_prev(bl)))
3530 if (temp_bd->client.icccm.accepts_focus && temp_bd->visible)
3532 /* focus the border */
3533 e_border_focus_set(temp_bd, 1, 1);
3534 e_container_border_list_free(bl);
3538 e_container_border_list_free(bl);
3545 void _policy_border_stack_change (E_Border* bd, E_Border* sibling, int stack_mode)
3547 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... win = 0x%07x, sibling = 0x%07x, stack mode = %d\n", __func__, __LINE__, bd->client.win, sibling->client.win, stack_mode);
3549 if (bd->layer != sibling->layer)
3551 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... Sibling layer is different!!! win = 0x%07x (layer = %d), sibling = 0x%07x (layer = %d)\n", __func__, __LINE__, bd->client.win, bd->layer, sibling->client.win, sibling->layer);
3555 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... Restack Window.. win = 0x%07x, sibling = 0x%07x, stack_mode = %d\n", __func__, __LINE__, bd->win, sibling->win, stack_mode);
3556 if (stack_mode == E_ILLUME_STACK_ABOVE)
3558 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... STACK CHANGE with ABOVE... win:0x%07x, above_win:0x%07x\n", __func__, __LINE__, bd->client.win, sibling->client.win);
3559 e_border_stack_above (bd, sibling);
3561 else if (stack_mode == E_ILLUME_STACK_BELOW)
3563 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... STACK CHANGE with BELOW... win:0x%07x, below_win:0x%07x\n", __func__, __LINE__, bd->client.win, sibling->client.win);
3564 e_border_stack_below (bd, sibling);
3569 int _policy_atom_init (void)
3571 /* Notification Level Atom */
3572 E_ILLUME_ATOM_NOTIFICATION_LEVEL = ecore_x_atom_get ("_E_ILLUME_NOTIFICATION_LEVEL");
3573 if (!E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3575 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_NOTIFICATION_LEVEL Atom...\n");
3579 /* for active/deactive message */
3580 E_ILLUME_ATOM_ACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_ACTIVATE_WINDOW");
3581 if (!E_ILLUME_ATOM_ACTIVATE_WINDOW)
3583 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_ACTIVATE_WINDOW Atom...\n");
3587 E_ILLUME_ATOM_DEACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_DEACTIVATE_WINDOW");
3588 if (!E_ILLUME_ATOM_DEACTIVATE_WINDOW)
3590 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_DEACTIVATE_WINDOW Atom...\n");
3594 /* for visibility */
3595 E_ILLUME_ATOM_OVERAY_WINDOW = ecore_x_atom_get ("_E_COMP_OVERAY_WINDOW");
3596 if (!E_ILLUME_ATOM_OVERAY_WINDOW)
3598 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_OVERAY_WINDOW Atom...\n");
3602 E_ILLUME_ATOM_STACK_DISPLAY = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK");
3603 if (!E_ILLUME_ATOM_STACK_DISPLAY)
3605 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK Atom...\n");
3609 E_ILLUME_ATOM_STACK_DISPLAY_DONE = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK_DONE");
3610 if (!E_ILLUME_ATOM_STACK_DISPLAY_DONE)
3612 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK_DONE Atom...\n");
3616 E_ILLUME_ATOM_WINDOW_OPAQUE = ecore_x_atom_get ("_E_ILLUME_WINDOW_REGION_OPAQUE");
3617 if (!E_ILLUME_ATOM_WINDOW_OPAQUE)
3619 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_WINDOW_REGION_OPAQUE Atom...\n");
3623 #ifdef COMP_MODULE_CONTROL
3624 E_ILLUME_ATOM_COMP_MODULE_ENABLED = ecore_x_atom_get ("_E_COMP_ENABLE");
3625 if(!E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3627 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_ENABLE Atom...\n");
3632 #ifdef BACKKEY_MODULE_CONTROL
3633 E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED = ecore_x_atom_get ("_E_BACKKEY_ENABLE");
3634 if(!E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3636 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_BACKKEY_ENABLE Atom...\n");
3641 #ifdef DEVMODE_MODULE_CONTROL
3642 E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED = ecore_x_atom_get ("_E_DEVMODE_ENABLE");
3643 if(!E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3645 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_DEVMODE_ENABLE Atom...\n");
3650 E_INDICATOR_CMD_WIN = ecore_x_atom_get("_E_INDICATOR_CMD_WIN");
3651 if (!E_INDICATOR_CMD_WIN)
3653 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_INDICATOR_CMD_WIN Atom...\n");
3657 E_ACTIVE_INDICATOR_WIN = ecore_x_atom_get("_E_ACTIVE_INDICATOR_WIN");
3658 if (!E_ACTIVE_INDICATOR_WIN)
3660 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ACTIVE_INDICATOR_WIN Atom...\n");
3668 int _policy_init (void)
3673 /* for visibility */
3674 _e_illume_xwin_info_hash = eina_hash_string_superfast_new(NULL);
3675 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3677 _policy_manage_xwins (man);
3679 dep_rot.root = man->root;
3680 dep_rot.refer.cmd_win = _policy_indicator_cmd_win_get(dep_rot.root);
3681 if (dep_rot.refer.cmd_win)
3682 dep_rot.refer.active_win = _policy_active_indicator_win_get(dep_rot.refer.cmd_win);
3686 if (!_policy_atom_init())
3688 eina_hash_free (_e_illume_xwin_info_hash);
3692 /* for visibility */
3693 _e_illume_msg_handler = e_msg_handler_add(_policy_msg_handler, NULL);
3699 void _policy_fin (void)
3701 /* for visibility */
3702 if (_e_illume_msg_handler) e_msg_handler_del(_e_illume_msg_handler);
3703 eina_hash_free (_e_illume_xwin_info_hash);
3707 _policy_compare_cb_border (E_Illume_Border_Info* data1, E_Illume_Border_Info* data2)
3711 if (data1->border == data2->border)
3719 static E_Illume_Border_Info*
3720 _policy_get_border_info (E_Border* bd)
3722 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3723 E_Illume_Border_Info tmp_win;
3724 tmp_win.border = bd;
3725 return (E_Illume_Border_Info*) eina_list_search_unsorted (
3726 e_border_info_list, EINA_COMPARE_CB(_policy_compare_cb_border), &tmp_win);
3730 static E_Illume_Border_Info* _policy_add_border_info_list (E_Border* bd)
3732 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3734 if (e_object_is_del(E_OBJECT(bd))) return NULL;
3736 E_Illume_Border_Info* bd_info = (E_Illume_Border_Info*) calloc (1, sizeof (E_Illume_Border_Info));
3739 fprintf (stderr, "[ILLUME2] Critical Error... Fail to create memory... (%s:%d)\n", __func__, __LINE__);
3742 bd_info->pid = bd->client.netwm.pid;
3743 bd_info->border = bd;
3745 bd_info->level = 50;
3747 bd_info->opaque = _policy_property_window_opaque_get(bd->client.win);
3749 // could find bd_info of ev->stack.. there is no bd_info yet...
3750 Eina_List *l = NULL;
3751 E_Illume_Border_Info *temp_bd_info = NULL;
3753 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
3755 if (!temp_bd_info) continue;
3756 if (bd_info->border->layer >= temp_bd_info->border->layer)
3762 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
3763 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> other(win:0x%07x) ]\n", __func__, __LINE__, bd->client.win, temp_bd_info->border->client.win);
3767 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
3768 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, bd->client.win);
3775 static void _policy_delete_border_info_list (E_Border* bd)
3777 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3778 E_Illume_Border_Info* bd_info = _policy_get_border_info (bd);
3780 if (bd_info == NULL)
3782 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... There is no border in the list... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3786 _policy_border_illume_handlers_remove(bd_info);
3788 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
3789 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... remove bd(win:0x%07x)\n", __func__, __LINE__, bd->client.win);
3795 _policy_zone_layout_app_layer_check (E_Border* bd)
3797 Ecore_X_Window_Type *types = NULL;
3798 E_Illume_Border_Info *bd_info;
3801 if (!bd) return POL_APP_LAYER;
3803 bd_info = _policy_get_border_info(bd);
3804 if (!bd_info) return POL_APP_LAYER;
3806 layer = POL_APP_LAYER;
3808 num = ecore_x_netwm_window_types_get(bd->client.win, &types);
3812 for (i=0; i< num; i++)
3814 if (types[i] == ECORE_X_WINDOW_TYPE_NOTIFICATION)
3815 layer = _policy_notification_level_map(bd_info->level);
3821 if (bd->client.netwm.state.stacking == E_STACKING_BELOW)
3823 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is BELOW state.. Change layer to 50\n", __func__, __LINE__, bd->client.win);
3824 layer = POL_STATE_BELOW_LAYER;
3826 else if (bd->client.netwm.state.stacking == E_STACKING_ABOVE)
3828 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is ABOVE state.. Change layer to 150\n", __func__, __LINE__, bd->client.win);
3829 layer = POL_STATE_ABOVE_LAYER;
3837 _policy_zone_layout_app_layer_set (E_Border* bd, int new_layer)
3841 /* if a window sets transient_for property, it sets same layer to parent window */
3842 if (bd->client.icccm.transient_for != 0)
3844 E_Border *bd_parent = NULL;
3845 bd_parent = e_border_find_by_client_window (bd->client.icccm.transient_for);
3848 if (bd->layer != bd_parent->layer)
3849 e_border_layer_set (bd, bd_parent->layer);
3854 if (bd->layer != new_layer)
3855 e_border_layer_set(bd, new_layer);
3860 _policy_zone_layout_app_single_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
3864 Eina_Bool resize = EINA_FALSE;
3865 Eina_Bool move = EINA_FALSE;
3867 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... LAYOUT_SINGLE... bd_info's border = %x, client win = 0x%07x\n", __func__, __LINE__, bd_info->border, bd_info->border->client.win);
3869 bd = bd_info->border;
3872 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
3876 if (bd->moving && !bd->client.illume.win_state.state)
3878 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... Cancel moving... win:0x%07x, bd->moving:%d\n", __func__, __LINE__, bd->client.win, bd->moving);
3879 e_border_move_cancel();
3882 if ((!bd->new_client) && (!bd->visible)) return;
3884 layer = _policy_zone_layout_app_layer_check (bd);
3886 /* check if user defined position */
3887 if (bd->client.icccm.request_pos)
3889 if (bd->client.illume.win_state.state)
3891 if (bd_info->resize_req.need_change)
3893 if ((bd->x != bd_info->resize_req.mouse.x) ||
3894 (bd->y != bd_info->resize_req.mouse.y))
3897 if ((bd->w != bd_info->resize_req.mouse.w) ||
3898 (bd->h != bd_info->resize_req.mouse.h))
3903 e_border_move_resize(bd,
3904 bd_info->resize_req.mouse.x,
3905 bd_info->resize_req.mouse.y,
3906 bd_info->resize_req.mouse.w,
3907 bd_info->resize_req.mouse.h);
3911 _policy_border_move(bd,
3912 bd_info->resize_req.mouse.x,
3913 bd_info->resize_req.mouse.y);
3917 _policy_border_resize(bd,
3918 bd_info->resize_req.mouse.w,
3919 bd_info->resize_req.mouse.h);
3922 bd_info->resize_req.need_change = 0;
3923 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
3926 if (bd_info->resize_req.mouse.down &&
3927 bd_info->resize_req.mouse.locked)
3929 if ((bd->x != bd_info->resize_req.mouse.x) ||
3930 (bd->y != bd_info->resize_req.mouse.y))
3931 _policy_border_move(bd,
3932 bd_info->resize_req.mouse.x,
3933 bd_info->resize_req.mouse.y);
3934 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
3938 _policy_zone_layout_app_layer_set (bd, layer);
3942 /* resize & move if needed */
3943 if (bd->client.illume.win_state.state)
3945 if (bd_info->resize_req.need_change)
3947 if ((bd->x != bd_info->resize_req.mouse.x) ||
3948 (bd->y != bd_info->resize_req.mouse.y))
3951 if ((bd->w != bd_info->resize_req.mouse.w) ||
3952 (bd->h != bd_info->resize_req.mouse.h))
3957 e_border_move_resize(bd,
3958 bd_info->resize_req.mouse.x,
3959 bd_info->resize_req.mouse.y,
3960 bd_info->resize_req.mouse.w,
3961 bd_info->resize_req.mouse.h);
3965 _policy_border_move(bd,
3966 bd_info->resize_req.mouse.x,
3967 bd_info->resize_req.mouse.y);
3971 _policy_border_resize(bd,
3972 bd_info->resize_req.mouse.w,
3973 bd_info->resize_req.mouse.h);
3976 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
3977 bd_info->resize_req.need_change = 0;
3980 if (bd_info->resize_req.mouse.down &&
3981 bd_info->resize_req.mouse.locked)
3983 if ((bd->x != bd_info->resize_req.mouse.x) ||
3984 (bd->y != bd_info->resize_req.mouse.y))
3985 _policy_border_move(bd,
3986 bd_info->resize_req.mouse.x,
3987 bd_info->resize_req.mouse.y);
3988 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
3993 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
3996 if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y))
4000 e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
4002 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
4004 _policy_border_move(bd, bd->zone->x, bd->zone->y);
4007 /* set layer if needed */
4008 _policy_zone_layout_app_layer_set (bd, layer);
4013 _policy_zone_layout_app_dual_top_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4019 Eina_Bool resize = EINA_FALSE;
4020 Eina_Bool move = EINA_FALSE;
4022 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... LAYOUT_DUAL_TOP... bd_info's border = %x, client win = 0x%07x\n", __func__, __LINE__, bd_info->border, bd_info->border->client.win);
4024 bd = bd_info->border;
4026 if (!bd || !cz) return;
4027 if ((!bd->new_client) && (!bd->visible)) return;
4029 layer = _policy_zone_layout_app_layer_check (bd);
4031 // check if user defined position
4032 if (bd->client.icccm.request_pos)
4034 _policy_zone_layout_app_layer_set (bd, layer);
4038 /* set a default Y position */
4039 ny = (bd->zone->y + cz->indicator.size);
4040 nh = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2);
4042 /* see if there is a border already there. if so, check placement based on
4043 * virtual keyboard usage */
4044 temp_bd = e_illume_border_at_xy_get(bd->zone, bd->zone->x, ny);
4045 if ((temp_bd) && (temp_bd != bd)) ny = temp_bd->y + nh;
4047 /* resize if needed */
4048 if ((bd->w != bd->zone->w) || (bd->h != nh))
4051 /* move to correct position (relative to zone) if needed */
4052 if ((bd->x != bd->zone->x) || (bd->y != ny))
4056 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4058 _policy_border_resize(bd, bd->zone->w, nh);
4060 _policy_border_move(bd, bd->zone->x, ny);
4062 /* set layer if needed */
4063 _policy_zone_layout_app_layer_set (bd, layer);
4067 _policy_zone_layout_app_dual_left_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4073 Eina_Bool resize = EINA_FALSE;
4074 Eina_Bool move = EINA_FALSE;
4076 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... LAYOUT_DUAL_LEFT... bd_info's border = %x, client win = 0x%07x\n", __func__, __LINE__, bd_info->border, bd_info->border->client.win);
4078 bd = bd_info->border;
4080 if (!bd || !cz) return;
4081 if ((!bd->new_client) && (!bd->visible)) return;
4083 layer = _policy_zone_layout_app_layer_check (bd);
4085 // check if user defined position
4086 if (bd->client.icccm.request_pos)
4088 _policy_zone_layout_app_layer_set (bd, layer);
4092 /* set some defaults */
4094 nw = (bd->zone->w / 2);
4096 ky = bd->zone->y + cz->indicator.size;
4097 kh = bd->zone->h - cz->indicator.size - cz->softkey.size;
4099 /* see if there is a border already there. if so, place at right */
4100 temp_bd = e_illume_border_at_xy_get(bd->zone, nx, (ky + bd->zone->h / 2));
4101 if ((temp_bd) && (bd != temp_bd)) nx = temp_bd->x + nw;
4103 /* resize if needed */
4104 if ((bd->w != nw) || (bd->h != kh))
4107 /* move to correct position (relative to zone) if needed */
4108 if ((bd->x != nx) || (bd->y != ky))
4112 e_border_move_resize(bd, nx, ky, nw, kh);
4114 _policy_border_resize(bd, nw, kh);
4116 _policy_border_move(bd, nx, ky);
4118 /* set layer if needed */
4119 _policy_zone_layout_app_layer_set (bd, layer);
4124 _policy_zone_layout_app_dual_custom_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4129 Eina_Bool resize = EINA_FALSE;
4130 Eina_Bool move = EINA_FALSE;
4132 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... LAYOUT_DUAL_CUSTOM... bd_info's border = %x, client win = 0x%07x\n", __func__, __LINE__, bd_info->border, bd_info->border->client.win);
4134 bd = bd_info->border;
4137 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
4141 if ((!bd->new_client) && (!bd->visible)) return;
4143 /* grab indicator position */
4144 e_illume_border_indicator_pos_get(bd->zone, NULL, &iy);
4146 /* set a default position */
4150 app = e_illume_border_at_xy_get(bd->zone, bd->zone->x, bd->zone->y);
4155 ny = (iy + cz->indicator.size);
4156 nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size);
4160 /* make sure it's the required width & height */
4161 if ((bd->w != bd->zone->w) || (bd->h != nh))
4164 /* move to correct position (relative to zone) if needed */
4165 if ((bd->x != bd->zone->x) || (bd->y != ny))
4169 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4171 _policy_border_resize(bd, bd->zone->w, nh);
4173 _policy_border_move(bd, bd->zone->x, ny);
4175 /* set layer if needed */
4176 if (bd->layer != POL_APP_LAYER)
4177 e_border_layer_set(bd, POL_APP_LAYER);
4180 static int _policy_border_get_notification_level (Ecore_X_Window win)
4185 unsigned char* prop_data = NULL;
4187 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_NOTIFICATION_LEVEL, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &num);
4188 if( ret && prop_data )
4189 memcpy (&level, prop_data, sizeof (int));
4191 if (prop_data) free (prop_data);
4197 _policy_notification_level_map(int level)
4201 case E_ILLUME_NOTIFICATION_LEVEL_LOW: return POL_NOTIFICATION_LAYER_LOW;
4202 case E_ILLUME_NOTIFICATION_LEVEL_NORMAL: return POL_NOTIFICATION_LAYER_NORMAL;
4203 case E_ILLUME_NOTIFICATION_LEVEL_HIGH: return POL_NOTIFICATION_LAYER_HIGH;
4204 default: return POL_NOTIFICATION_LAYER_LOW;
4208 /* find new focus window */
4210 _policy_border_focus_top_stack_set (E_Border* bd)
4213 E_Border *cur_focus;
4217 root_w = bd->zone->w;
4218 root_h = bd->zone->h;
4220 cur_focus = e_border_focused_get();
4222 bl = e_container_border_list_last(bd->zone->container);
4223 while ((temp_bd = e_container_border_list_prev(bl)))
4225 if (temp_bd == cur_focus) break;
4227 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
4228 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
4229 if ((temp_bd != bd) &&
4230 (temp_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)) continue;
4232 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
4233 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
4234 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
4235 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
4236 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
4237 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
4238 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
4240 if (!temp_bd->focused)
4242 /* this border is the top of the latest stack */
4243 e_border_focus_set (temp_bd, 1, 1);
4248 e_container_border_list_free(bl);
4251 void _policy_border_stack (E_Event_Border_Stack *event)
4253 E_Event_Border_Stack* ev;
4254 E_Illume_Border_Info* bd_info;
4255 E_Illume_Border_Info* stack_bd_info;
4259 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... bd(win:0x%07x), stack(win:0x%07x), stack type: %d\n", __func__, __LINE__, ev->border->client.win, ev->stack ? (unsigned int)ev->stack->client.win:(unsigned int)NULL, ev->type);
4261 bd_info = _policy_get_border_info(ev->border);
4262 if (!bd_info) return;
4266 stack_bd_info = _policy_get_border_info(ev->stack);
4270 stack_bd_info = NULL;
4273 if (ev->type == E_STACKING_ABOVE)
4279 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4280 e_border_info_list = eina_list_prepend_relative (e_border_info_list, bd_info, stack_bd_info);
4281 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> stack(win:0x%07x) ]\n", __func__, __LINE__, ev->border->client.win, ev->stack->client.win);
4285 // could find bd_info of ev->stack.. there is no bd_info yet...
4286 Eina_List *l = NULL;
4287 E_Illume_Border_Info *temp_bd_info;
4289 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4291 if (!temp_bd_info) continue;
4292 if (bd_info->border->layer >= temp_bd_info->border->layer)
4296 if (bd_info != temp_bd_info)
4298 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4299 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4300 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> other(win:0x%07x).. No stack(win:0x%07x) info ]\n", __func__, __LINE__, ev->border->client.win, temp_bd_info ? (unsigned int)temp_bd_info->border->client.win:(unsigned int)NULL, ev->stack->client.win);
4306 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4307 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
4308 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, ev->border->client.win);
4311 else if (ev->type == E_STACKING_BELOW)
4317 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4318 e_border_info_list = eina_list_append_relative (e_border_info_list, bd_info, stack_bd_info);
4319 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ stack(win:0x%07x) -> bd(win:0x%07x) ]\n", __func__, __LINE__, ev->stack->client.win, ev->border->client.win);
4323 // could find bd_info of ev->stack.. there is no bd_info yet...
4324 Eina_List *l = NULL;
4325 E_Illume_Border_Info *temp_bd_info;
4327 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4329 if (!temp_bd_info) continue;
4330 if (bd_info->border->layer >= temp_bd_info->border->layer)
4334 if (bd_info != temp_bd_info)
4336 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4337 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4338 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> other(win:0x%07x).. No stack(win:0x%07x) info ]\n", __func__, __LINE__, ev->border->client.win, temp_bd_info ? (unsigned int)temp_bd_info->border->client.win:(unsigned int)NULL, ev->stack->client.win);
4344 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4345 e_border_info_list = eina_list_prepend (e_border_info_list, bd_info);
4346 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) ---> ]\n", __func__, __LINE__, ev->border->client.win);
4351 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... Unknown type... border (0x%07x), win (0x%07x), type = %d\n", __func__, __LINE__, ev->border, ev->border->client.win, ev->type);
4354 /* restack indicator when a active window stack is changed */
4355 if ((ev->border->client.win == g_active_win) &&
4356 (ev->border->layer == POL_NOTIFICATION_LAYER))
4359 indi_bd = e_illume_border_indicator_get(ev->border->zone);
4362 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, ev->border->client.win);
4363 _policy_border_indicator_control(indi_bd);
4367 ev->border->changes.pos = 1;
4368 ev->border->changed = 1;
4373 void _policy_border_zone_set(E_Event_Border_Zone_Set *event)
4375 E_Event_Border_Zone_Set* ev;
4383 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
4386 static void _policy_change_quickpanel_layer (E_Illume_Quickpanel* qp, E_Border* indi_bd, int layer, int level)
4389 E_Illume_Quickpanel_Info *panel;
4390 E_Illume_Border_Info* bd_info;
4396 bd_info = _policy_get_border_info(qp->popup->border);
4399 bd_info->level = level;
4400 e_border_stack_below (qp->popup->border, indi_bd);
4404 EINA_LIST_FOREACH(qp->hidden_mini_controllers, bd_list, panel)
4406 if (!panel) continue;
4407 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4409 bd_info = _policy_get_border_info(panel->bd);
4412 bd_info->level = level;
4413 e_border_stack_below (panel->bd, indi_bd);
4417 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
4419 if (!panel) continue;
4420 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4422 bd_info = _policy_get_border_info(panel->bd);
4425 bd_info->level = level;
4426 e_border_stack_below (panel->bd, indi_bd);
4431 static void _policy_change_indicator_layer(E_Border *indi_bd, E_Border *bd, int layer, int level)
4433 // the indicator's layer is changed to layer with level
4434 E_Illume_Border_Info *indi_bd_info;
4435 E_Illume_Quickpanel *qp;
4436 int new_noti_layer = 0;
4438 indi_bd_info = _policy_get_border_info(indi_bd);
4441 indi_bd_info->level = level;
4444 if (layer == POL_NOTIFICATION_LAYER)
4446 new_noti_layer = _policy_notification_level_map(level);
4448 if (indi_bd->layer != new_noti_layer)
4449 e_border_layer_set(indi_bd, new_noti_layer);
4451 else if (indi_bd->layer != layer)
4452 e_border_layer_set(indi_bd, layer);
4457 E_Illume_Border_Info *top_bd_info;
4459 // check transient_for window
4460 top_bd = _policy_border_transient_for_border_top_get(bd);
4461 if (!top_bd) top_bd = bd;
4463 top_bd_info = _policy_get_border_info(top_bd);
4466 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4468 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4473 L (LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator's below win:0x%07x\n", __func__, __LINE__, top_bd->client.win);
4474 _policy_border_stack_change(indi_bd, top_bd, E_ILLUME_STACK_ABOVE);
4476 e_border_info_list = eina_list_remove(e_border_info_list, indi_bd_info);
4477 e_border_info_list = eina_list_prepend_relative(e_border_info_list, indi_bd_info, top_bd_info);
4478 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> other(win:0x%07x) ]\n", __func__, __LINE__, indi_bd->client.win, top_bd->client.win);
4481 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4483 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4487 static Eina_Bool _policy_border_indicator_state_change(E_Border *indi_bd, E_Border *bd)
4489 E_Illume_Border_Info *bd_info;
4493 if (!indi_bd || !bd) return EINA_FALSE;
4495 indi_show = _policy_border_indicator_state_get(bd);
4498 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4499 e_border_show(indi_bd);
4501 if ((e_illume_border_is_notification(bd)) ||
4502 (bd->layer == POL_NOTIFICATION_LAYER))
4504 bd_info = _policy_get_border_info(bd);
4506 level = bd_info->level;
4510 L(LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... Notification Win:0x%07x, Update Indicator's layer to NOTIFICATION.. level = %d\n", __func__, __LINE__, bd->client.win, level);
4511 _policy_change_indicator_layer(indi_bd, bd, POL_NOTIFICATION_LAYER, level);
4515 _policy_change_indicator_layer(indi_bd, NULL, POL_NOTIFICATION_LAYER, 50);
4520 else if (indi_show == 0)
4522 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4523 e_border_hide(indi_bd, 2);
4533 _policy_border_indicator_control(E_Border *indi_bd)
4535 Eina_Inlist *xwin_info_list;
4536 E_Illume_XWin_Info *xwin_info;
4538 Ecore_X_Illume_Indicator_Opacity_Mode mode;
4540 if (!indi_bd) return;
4543 xwin_info_list = _e_illume_xwin_info_list;
4547 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4549 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4551 if (xwin_info->bd_info)
4553 bd = xwin_info->bd_info->border;
4556 if (!bd->visible) continue;
4557 if (indi_bd == bd) continue;
4558 if (indi_bd->zone != bd->zone) continue;
4559 if (e_illume_border_is_indicator(bd)) continue;
4560 if (e_illume_border_is_keyboard(bd)) continue;
4561 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
4563 if (!_policy_border_indicator_state_change(indi_bd, bd))
4566 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
4567 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
4569 _policy_root_angle_set(bd);
4571 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, bd->client.win);
4572 g_indi_control_win = bd->client.win;
4580 /* for visibility */
4582 _policy_send_visibility_notify (Ecore_X_Window win, int visibility)
4586 event.type = VisibilityNotify;
4587 event.xvisibility.display = ecore_x_display_get();
4588 event.xvisibility.send_event = EINA_TRUE;
4589 event.xvisibility.state = visibility;
4590 event.xvisibility.window = win;
4592 XSendEvent(event.xvisibility.display
4593 , event.xvisibility.window
4595 , VisibilityChangeMask, &event);
4599 _policy_check_transient_child_visible(E_Border *bd)
4601 Eina_Bool ret = EINA_FALSE;
4602 E_Illume_XWin_Info *child_xwin_info = NULL;
4604 E_Border *child = NULL;
4606 EINA_LIST_FOREACH(bd->transients, l, child)
4608 if (!child) continue;
4609 if (ret) return ret;
4611 child_xwin_info = _policy_xwin_info_find(child->win);
4612 if ((child_xwin_info) &&
4613 (child_xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED))
4618 ret = _policy_check_transient_child_visible(child);
4625 _policy_calculate_visibility(void)
4627 // 1. CALCULATES window's region and decide it's visibility.
4628 // 2. DO (UN)ICONIFY if it's needed.
4629 // 3. SEND notify about visibility.
4631 E_Zone *zone = NULL;
4632 E_Border *bd = NULL, *indi_bd = NULL;
4633 Eina_Inlist *xwin_info_list = NULL;
4634 E_Illume_XWin_Info *xwin_info = NULL;
4635 E_Illume_Border_Info *bd_info = NULL;
4636 Ecore_X_XRegion *visible_region = NULL;
4637 Ecore_X_XRegion *win_region = NULL;
4638 Ecore_X_Rectangle visible_rect, win_rect;
4639 Eina_Bool is_fully_obscured = EINA_FALSE;
4640 Eina_Bool is_opaque_win = EINA_FALSE;
4641 Eina_Bool do_not_iconify = EINA_FALSE;
4642 Eina_Bool alpha_opaque = EINA_FALSE;
4643 Eina_Bool obscured_by_alpha_opaque = EINA_FALSE;
4645 int set_root_angle = 0;
4646 int control_indi = 0;
4648 if (!_g_visibility_changed) return;
4649 _g_visibility_changed = EINA_FALSE;
4651 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. BEGIN calculate visibility ...\n", __func__, __LINE__);
4652 xwin_info_list = _e_illume_xwin_info_list;
4653 if (!xwin_info_list) return;
4655 // set the entire visible region as a root geometry
4658 visible_rect.width = _g_root_width;
4659 visible_rect.height = _g_root_height;
4661 visible_region = ecore_x_xregion_new();
4662 if (!visible_region)
4664 L (LT_VISIBILITY_DETAIL,
4665 "[ILLUME2][VISIBILITY] BAD.... Creating visible region is failed.\n");
4669 ecore_x_xregion_union_rect(visible_region, visible_region, &visible_rect);
4671 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4673 // skip "input only" window
4674 if (xwin_info->attr.input_only) continue;
4676 // skip "unmap" window
4677 if ((xwin_info->viewable == 0) &&
4678 (xwin_info->iconify_by_wm == 0)) continue;
4680 if (!xwin_info->is_drawed) continue;
4682 // initializing variable
4685 is_opaque_win = EINA_TRUE;
4686 do_not_iconify = EINA_FALSE;
4687 old_vis = xwin_info->visibility;
4689 bd_info = xwin_info->bd_info;
4690 if (bd_info) bd = bd_info->border;
4692 // 1. calculates window's region and decide it's visibility.
4693 if (is_fully_obscured == EINA_FALSE)
4695 win_rect.x = xwin_info->attr.x;
4696 win_rect.y = xwin_info->attr.y;
4697 win_rect.width = xwin_info->attr.w;
4698 win_rect.height = xwin_info->attr.h;
4700 // if it stick out or is bigger than the entire visible region,
4701 // clip it by the entire visible's geometry.
4702 E_RECTS_CLIP_TO_RECT(win_rect.x, win_rect.y,
4703 win_rect.width, win_rect.height,
4704 visible_rect.x, visible_rect.y,
4705 (int)(visible_rect.width), (int)(visible_rect.height));
4707 if (ecore_x_xregion_rect_contain(visible_region, &win_rect))
4709 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Un-OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4710 xwin_info->visibility = E_ILLUME_VISIBILITY_UNOBSCURED;
4714 if (bd->client.argb)
4716 if (bd_info && bd_info->opaque)
4718 alpha_opaque = EINA_TRUE;
4722 is_opaque_win = EINA_FALSE;
4726 if (bd->client.illume.win_state.state ==
4727 ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
4729 is_opaque_win = EINA_FALSE;
4734 if (xwin_info->argb)
4735 is_opaque_win = EINA_FALSE;
4740 win_region = ecore_x_xregion_new();
4743 ecore_x_xregion_union_rect(win_region, win_region, &win_rect);
4744 ecore_x_xregion_subtract(visible_region, visible_region, win_region);
4745 ecore_x_xregion_free(win_region);
4748 if (ecore_x_xregion_is_empty(visible_region))
4750 is_fully_obscured = EINA_TRUE;
4753 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... OBSCURED by alpha opaque win:0x%07x\n", __func__, __LINE__, xwin_info->id);
4754 obscured_by_alpha_opaque = EINA_TRUE;
4755 alpha_opaque = EINA_FALSE;
4763 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. place on OUTSIDE\n", __func__, __LINE__, xwin_info->id);
4764 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4769 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4770 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4774 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) continue;
4776 // decide if it's the border that DO NOT iconify.
4777 if (obscured_by_alpha_opaque)
4779 do_not_iconify = EINA_TRUE;
4781 // when this border has transient windows,
4782 // check out this child's visibility.
4783 // if there is any child window that is UNOBSCURED,
4784 // DO NOT iconify this border.
4785 else if (bd->transients)
4787 do_not_iconify = _policy_check_transient_child_visible(bd);
4790 // 2. DO (UN)ICONIFY and send visibility notify if it's needed.
4791 if (old_vis != xwin_info->visibility)
4794 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
4796 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] SEND VISIBILITY NOTIFY (Line:%d)... win:0x%07x (old:%d -> new:%d)\n", __LINE__, bd->client.win, old_vis, xwin_info->visibility);
4797 _policy_send_visibility_notify(bd->client.win, xwin_info->visibility);
4799 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
4801 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. CALL _policy_change_root_angle_by_border_angle!!! win:0x%07x\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4804 if (_e_illume_cfg->use_force_iconify)
4808 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Uniconify by illume.. win:0x%07x (parent:0x%07x)\n", __func__, __LINE__, xwin_info->bd_info->border->client.win, xwin_info->bd_info->border->parent ? xwin_info->bd_info->border->parent->client.win:(unsigned int)NULL);
4809 _policy_border_force_uniconify(bd);
4813 else if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4815 if (bd->client.win == g_rotated_win)
4817 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. g_rotated_win(0x%07x) is obscured.\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4821 if (_e_illume_cfg->use_force_iconify)
4823 if ((!bd->iconic) && (!do_not_iconify))
4825 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Iconify by illume.. win:0x%07x (parent:0x%07x)\n", __func__, __LINE__, xwin_info->bd_info->border->client.win, xwin_info->bd_info->border->parent ? xwin_info->bd_info->border->parent->client.win:(unsigned int)NULL);
4826 _policy_border_iconify_by_illume(xwin_info);
4832 zone = xwin_info->bd_info->border->zone;
4836 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4838 if (_e_illume_cfg->use_force_iconify)
4840 if (bd->parent && bd->parent->iconic)
4842 if ((!bd->iconic) && (!do_not_iconify))
4844 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Iconify by illume.. win:0x%07x (parent:0x%07x)\n", __func__, __LINE__, xwin_info->bd_info->border->client.win, xwin_info->bd_info->border->parent ? xwin_info->bd_info->border->parent->client.win:(unsigned int)NULL);
4845 _policy_border_iconify_by_illume(xwin_info);
4848 else if (bd->iconic && do_not_iconify)
4850 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Uniconify by illume.. win:0x%07x\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4851 _policy_border_force_uniconify(bd);
4857 // 3. check if opaque window is ocupied the screen.
4858 // then we reset the obscured_by_alpha_opaque flag
4859 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4861 if (obscured_by_alpha_opaque && is_opaque_win)
4863 if (E_CONTAINS(xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.w, xwin_info->attr.h,
4864 0, 0, _g_root_width, _g_root_height))
4866 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... unset obscured_by_alpha_opaque win:%x\n", __func__, __LINE__, xwin_info->id);
4867 obscured_by_alpha_opaque = EINA_FALSE;
4875 if (_e_illume_cfg->use_indicator_widget)
4877 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
4878 _policy_border_root_angle_control(zone);
4882 indi_bd = e_illume_border_indicator_get(zone);
4885 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Control Indicator.\n", __func__, __LINE__);
4886 _policy_border_indicator_control(indi_bd);
4891 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. END calculate visibility ...\n", __func__, __LINE__);
4893 if (visible_region) ecore_x_xregion_free(visible_region);
4896 static E_Illume_XWin_Info*
4897 _policy_xwin_info_find (Ecore_X_Window win)
4899 return eina_hash_find(_e_illume_xwin_info_hash, e_util_winid_str_get(win));
4904 _policy_manage_xwins (E_Manager* man)
4906 Ecore_X_Window *windows;
4910 windows = ecore_x_window_children_get(man->root, &wnum);
4913 for (i = 0; i < wnum; i++)
4914 _policy_xwin_info_add(windows[i]);
4919 ecore_x_window_size_get (man->root, &_g_root_width, &_g_root_height);
4924 _policy_xwin_info_add (Ecore_X_Window win)
4928 if (win == _e_overlay_win) return EINA_FALSE;
4930 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
4933 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x EXIST in the list...\n", __func__, __LINE__, win);
4937 xwin_info = (E_Illume_XWin_Info*) calloc (1, sizeof (E_Illume_XWin_Info));
4940 L (LT_XWIN, "[ILLUME2][XWIN] (%s:%d).. Critical Error... Fail to create memory... \n", __func__, __LINE__);
4944 xwin_info->id = win;
4945 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4947 if (!ecore_x_window_attributes_get(win, &xwin_info->attr))
4953 xwin_info->viewable = xwin_info->attr.viewable;
4955 bd = e_border_find_by_window (win);
4956 xwin_info->bd_info = _policy_get_border_info(bd);
4957 xwin_info->argb = ecore_x_window_argb_get (win);
4959 if (_e_use_comp) xwin_info->comp_vis = 0;
4960 else xwin_info->comp_vis = 1;
4962 eina_hash_add(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
4963 _e_illume_xwin_info_list = eina_inlist_append(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
4970 _policy_xwin_info_delete (Ecore_X_Window win)
4972 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
4973 if (xwin_info == NULL)
4975 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, win);
4979 _e_illume_xwin_info_list = eina_inlist_remove(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
4980 eina_hash_del(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
4988 void _policy_window_create (Ecore_X_Event_Window_Create *event)
4990 Ecore_X_Window parent;
4992 parent = ecore_x_window_parent_get(event->win);
4993 if (parent != ecore_x_window_root_get(event->win))
4996 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
4998 _policy_xwin_info_add (event->win);
5002 void _policy_window_destroy (Ecore_X_Event_Window_Destroy *event)
5004 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5006 _policy_xwin_info_delete (event->win);
5010 void _policy_window_reparent (Ecore_X_Event_Window_Reparent *event)
5012 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5014 if (event->parent == ecore_x_window_root_first_get())
5015 _policy_xwin_info_add (event->win);
5017 _policy_xwin_info_delete (event->win);
5021 void _policy_window_show (Ecore_X_Event_Window_Show *event)
5023 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5025 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5026 if (xwin_info == NULL)
5028 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5032 xwin_info->viewable = EINA_TRUE;
5034 if (xwin_info->comp_vis)
5036 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5037 _g_visibility_changed = EINA_TRUE;
5042 void _policy_window_hide (Ecore_X_Event_Window_Hide *event)
5044 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5046 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5047 if (xwin_info == NULL)
5049 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5053 xwin_info->viewable = EINA_FALSE;
5055 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5056 _g_visibility_changed = EINA_TRUE;
5060 void _policy_window_configure (Ecore_X_Event_Window_Configure *event)
5063 E_Illume_XWin_Info* xwin_info;
5064 E_Illume_XWin_Info* old_above_xwin_info;
5065 E_Illume_XWin_Info* new_above_xwin_info;
5066 E_Illume_XWin_Info* temp_xwin_info;
5067 E_Illume_XWin_Info* target_xwin_info;
5068 int check_visibility;
5070 Ecore_X_Window target_win;
5072 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5075 old_above_xwin_info = NULL;
5076 new_above_xwin_info = NULL;
5077 check_visibility = 0;
5079 target_win = event->win;
5081 xwin_info = _policy_xwin_info_find (event->win);
5082 if (xwin_info == NULL)
5084 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5087 target_xwin_info = xwin_info;
5089 if ((xwin_info->attr.x != event->x) ||
5090 (xwin_info->attr.y != event->y))
5092 check_visibility = 1;
5095 if ((xwin_info->attr.w != event->w) ||
5096 (xwin_info->attr.h != event->h))
5099 check_visibility = 1;
5102 xwin_info->attr.x = event->x;
5103 xwin_info->attr.y = event->y;
5104 xwin_info->attr.w = event->w;
5105 xwin_info->attr.h = event->h;
5107 if ((l = EINA_INLIST_GET(xwin_info)->prev) != NULL)
5109 old_above_xwin_info = EINA_INLIST_CONTAINER_GET (l, E_Illume_XWin_Info);
5112 new_above_xwin_info = _policy_xwin_info_find (event->abovewin);
5114 if (old_above_xwin_info != new_above_xwin_info)
5117 if (old_above_xwin_info)
5119 temp_xwin_info = old_above_xwin_info;
5120 for (; temp_xwin_info; temp_xwin_info = (EINA_INLIST_GET(temp_xwin_info)->prev ? _EINA_INLIST_CONTAINER(temp_xwin_info, EINA_INLIST_GET(temp_xwin_info)->prev) : NULL))
5122 if (temp_xwin_info == new_above_xwin_info)
5124 target_win = old_above_xwin_info->id;
5125 target_xwin_info = old_above_xwin_info;
5130 check_visibility = 1;
5133 _e_illume_xwin_info_list = eina_inlist_remove (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5134 if (new_above_xwin_info)
5135 _e_illume_xwin_info_list = eina_inlist_append_relative (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info), EINA_INLIST_GET(new_above_xwin_info));
5137 _e_illume_xwin_info_list = eina_inlist_prepend (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5139 if (check_visibility == 1)
5141 if (target_xwin_info->viewable)
5143 if (target_xwin_info->comp_vis)
5147 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. SIZE is changed... target win:0x%07x\n", __func__, __LINE__, target_xwin_info->id);
5148 target_xwin_info->is_drawed = EINA_FALSE;
5152 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5153 _g_visibility_changed = EINA_TRUE;
5155 else if (target_xwin_info->iconify_by_wm)
5157 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5158 _g_visibility_changed = EINA_TRUE;
5165 void _policy_window_configure_request (Ecore_X_Event_Window_Configure_Request *event)
5168 Ecore_X_Event_Window_Configure_Request *e;
5171 bd = e_border_find_by_client_window(e->win);
5174 if (!bd->lock_client_stacking)
5176 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
5177 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
5179 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5181 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5182 _policy_border_focus_top_stack_set (bd);
5185 else if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
5187 if (_e_illume_cfg->use_force_iconify)
5189 if (e->detail == ECORE_X_WINDOW_STACK_BELOW && !e->abovewin)
5191 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Request Lower window... win:0x%07x\n", __func__, __LINE__, e->win);
5192 E_Illume_XWin_Info *xwin_info = _policy_xwin_info_find(bd->win);
5195 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
5196 _policy_border_uniconify_top_border(bd);
5201 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5203 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5204 _policy_border_focus_top_stack_set(bd);
5210 void _policy_window_sync_draw_done(Ecore_X_Event_Client_Message* event)
5213 E_Illume_XWin_Info *xwin_info;
5216 win = event->data.l[0];
5217 bd = e_border_find_by_client_window(win);
5220 xwin_info = _policy_xwin_info_find(bd->win);
5221 if (!xwin_info) return;
5223 if (!xwin_info->is_drawed)
5225 if (xwin_info->comp_vis)
5227 xwin_info->is_drawed = EINA_TRUE;
5228 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5229 _g_visibility_changed = EINA_TRUE;
5231 else if (xwin_info->iconify_by_wm)
5233 xwin_info->is_drawed = EINA_TRUE;
5234 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5235 _g_visibility_changed = EINA_TRUE;
5240 /* Setting window mode requires window stack change and window geometry
5241 * change. But now, the WM can't control these sequential operations
5242 * using x property set API which whould be able to overwrite previous
5243 * value before getting x property by the WM.
5244 * So we changed ecore_x_e_illume_window_state_set function to use x send
5245 * message and x sync counter. When the WM receives this message,
5246 * the WM sets window mode and then increases x sync counter.
5248 * TODO: We need to make a new protocol to set the window mode!!
5250 void _policy_illume_win_state_change_request (Ecore_X_Event_Client_Message *event)
5252 E_Border *bd = NULL;
5253 Ecore_X_Atom atom = 0, set = 0;
5254 unsigned int state = 0;
5255 Ecore_X_Sync_Counter counter = 0;
5260 bd = e_border_find_by_client_window(event->win);
5261 atom = event->data.l[0];
5262 counter = event->data.l[1];
5263 val = event->data.l[2];
5265 if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL)
5267 state = ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
5270 else if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING)
5272 state = ECORE_X_ILLUME_WINDOW_STATE_FLOATING;
5276 ELBF(ELBT_ILLUME, 0, event->win,
5277 "GET WIN_STATE_CHANGE_REQ bd:0x%08x(%d->%d) counter:0x%08x val:%d",
5278 bd ? bd->client.win : (unsigned int)NULL,
5279 bd ? bd->client.illume.win_state.state : 0,
5284 _policy_border_illume_window_state_change(bd, state);
5288 ecore_x_window_prop_atom_set(event->win, ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
5290 ELB(ELBT_ILLUME, "SET WIN_STATE", event->win);
5293 if (counter) ecore_x_sync_counter_inc(counter, 1);
5296 void _policy_quickpanel_state_change (Ecore_X_Event_Client_Message* event)
5299 E_Illume_Quickpanel *qp;
5301 if ((zone = e_util_zone_window_find(event->win)))
5303 if ((qp = e_illume_quickpanel_by_zone_get(zone)))
5305 if (event->data.l[0] == (int)ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
5307 _policy_layout_quickpanel_rotate (qp, g_root_angle);
5314 _policy_root_angle_set(E_Border *bd)
5317 Ecore_X_Window root;
5321 angle = _policy_window_rotation_angle_get(bd->client.win);
5322 if (angle == -1) return EINA_FALSE;
5323 if (!(((bd->w == bd->zone->w) && (bd->h == bd->zone->h)) ||
5324 ((bd->w == bd->zone->h) && (bd->h == bd->zone->w))))
5327 g_rotated_win = bd->client.win;
5328 root = bd->zone->container->manager->root;
5332 angle = g_root_angle;
5337 if (_e_illume_cfg->use_indicator_widget)
5339 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, g_rotated_win);
5340 g_indi_control_win = g_rotated_win;
5343 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. new_win:0x%07x, old angle:%d -> new_angle:%d\n", __func__, __LINE__, g_rotated_win, g_root_angle, angle);
5344 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. SET ROOT ANGLE... angle:%d\n\n", __func__, __LINE__, angle);
5345 // set root window property
5346 ecore_x_window_prop_property_set(root, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, ECORE_X_ATOM_CARDINAL, 32, &angle, 1);
5352 e_illume_border_is_camera(E_Border *bd)
5354 const char *name = NULL;
5355 const char *clas = NULL;
5357 if (!bd) return EINA_FALSE;
5359 name = bd->client.icccm.name;
5360 clas = bd->client.icccm.class;
5362 if (clas == NULL) return EINA_FALSE;
5363 if (strncmp(clas,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5364 if (name == NULL) return EINA_FALSE;
5365 if (strncmp(name,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5371 _policy_change_root_angle_by_border_angle (E_Border* bd)
5373 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win:0x%07x\n", __func__, __LINE__, bd ? (unsigned int)bd->client.win:(unsigned int)NULL);
5376 // ignore the angle of special borders - like indicator, keyboard, quickpanel, etc.
5377 if (e_illume_border_is_indicator(bd)) return;
5378 if (e_illume_border_is_keyboard(bd)) return;
5379 if (e_illume_border_is_quickpanel(bd)) return;
5380 if (e_illume_border_is_quickpanel_popup(bd)) return;
5382 if (e_illume_border_is_camera(bd))
5384 if (dep_rot.refer.active_win == bd->client.win)
5386 // make rotation request for the dependent windows such as quickpanel
5387 int ang = _policy_window_rotation_angle_get(bd->client.win);
5388 if (ang == -1) ang = 0;
5390 if (dep_rot.ang != ang)
5391 _policy_border_dependent_rotation(bd);
5395 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... CALL _policy_root_angle_set.. win:0x%07x\n", __func__, __LINE__, bd->client.win);
5396 _policy_root_angle_set(bd);
5400 _policy_indicator_angle_change (E_Border* indi_bd, int angle)
5402 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... indicator:0x%07x\n", __func__, __LINE__, indi_bd ? (unsigned int)indi_bd->client.win:(unsigned int)NULL);
5403 if (!indi_bd) return;
5405 int old_angle = _policy_window_rotation_angle_get (indi_bd->client.win);
5406 if(old_angle == -1) return;
5408 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... old_angle:%d, new_angle:%d\n", __func__, __LINE__, old_angle, angle);
5409 if (old_angle != angle)
5413 angles[1] = old_angle;
5414 ecore_x_window_prop_property_set(indi_bd->client.win,
5415 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5416 ECORE_X_ATOM_CARDINAL,
5421 ecore_x_client_message32_send (indi_bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5422 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
5425 E_Illume_Quickpanel *qp;
5426 qp = e_illume_quickpanel_by_zone_get (indi_bd->zone);
5429 _policy_layout_quickpanel_rotate (qp, angle);
5435 _policy_border_transient_for_group_make(E_Border *bd,
5444 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5446 if (e_config->transient.raise)
5448 EINA_LIST_FOREACH(bd->transients, l, child)
5450 if (!child) continue;
5453 *list = eina_list_prepend(*list, child);
5454 _policy_border_transient_for_group_make(child, list);
5461 _policy_border_transient_for_border_top_get(E_Border *bd)
5463 E_Border *top_border = NULL;
5464 Eina_List *transient_list = NULL;
5466 _policy_border_transient_for_group_make(bd, &transient_list);
5470 Eina_List *l = NULL;
5475 bl = e_container_border_list_last(bd->zone->container);
5476 while ((temp_bd = e_container_border_list_prev(bl)))
5478 if (top_border) break;
5479 if (temp_bd == bd) break;
5481 EINA_LIST_FOREACH(transient_list, l, temp_bd2)
5483 if (temp_bd == temp_bd2)
5485 top_border = temp_bd2;
5490 e_container_border_list_free(bl);
5493 L (LT_TRANSIENT_FOR, "[ILLUME2][TRANSIENT] %s(%d).. win:0x%07x, transient_for_top_win:0x%07x\n", __func__, __LINE__, bd->client.win, top_border ? (unsigned int)top_border->client.win:(unsigned int)NULL);
5495 eina_list_free(transient_list);
5501 _policy_border_transient_for_layer_set(E_Border *bd,
5502 E_Border *parent_bd,
5506 E_Border *top_border;
5509 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5511 L (LT_TRANSIENT_FOR, "[ILLUME2][TRANSIENT] %s(%d).. win:0x%07x, transient_for:0x%07x, layer:%d\n", __func__, __LINE__, bd->client.win, parent_bd ? (unsigned int)parent_bd->client.win:(unsigned int)NULL, layer);
5513 ecore_x_window_shadow_tree_flush();
5515 raise = e_config->transient.raise;
5517 bd->saved.layer = bd->layer;
5519 if (e_config->transient.layer)
5524 /* We need to set raise to one, else the child wont
5525 * follow to the new layer. It should be like this,
5526 * even if the user usually doesn't want to raise
5529 e_config->transient.raise = 1;
5530 EINA_LIST_FOREACH(bd->transients, l, child)
5532 if (!child) continue;
5533 child->layer = layer;
5537 top_border = _policy_border_transient_for_border_top_get(parent_bd);
5540 if (top_border != bd)
5542 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... STACK CHANGE with ABOVE... win:0x%07x, above_win:0x%07x\n", __func__, __LINE__, bd->client.win, top_border->client.win);
5543 e_border_stack_above(bd, top_border);
5548 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... STACK CHANGE with ABOVE... win:0x%07x, above_win:0x%07x\n", __func__, __LINE__, bd->client.win, parent_bd->client.win);
5549 e_border_stack_above(bd, parent_bd);
5552 e_config->transient.raise = raise;
5555 /* for desktop mode */
5557 _policy_zone_layout_app_single_monitor(E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
5561 Eina_Bool resize = EINA_FALSE;
5562 Eina_Bool move = EINA_FALSE;
5564 bd = bd_info->border;
5567 fprintf(stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
5571 if ((!bd->new_client) && (!bd->visible)) return;
5573 layer = _policy_zone_layout_app_layer_check(bd);
5577 int zx = 0, zy = 0, zw = 0, zh = 0;
5578 int new_x, new_y, new_w, new_h;
5580 if (!bd->client.icccm.request_pos)
5583 Eina_List *skiplist = NULL;
5586 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5588 // calculate width & height
5594 delta = delta * 0.66;
5596 new_w = delta * 9.0;
5597 new_h = delta * 16.0;
5600 new_x = zx + (rand() % (zw - new_w));
5604 new_y = zy + (rand() % (zh - new_h));
5608 skiplist = eina_list_append(skiplist, bd);
5610 e_place_zone_region_smart(bd->zone, skiplist,
5611 bd->x, bd->y, new_w, new_h,
5614 eina_list_free(skiplist);
5619 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5621 if (zx > bd->x) new_x = zx;
5624 if (zy > bd->y) new_y = zy;
5627 if (zw < bd->w) new_w = zw;
5630 if (zh < bd->h) new_h = zh;
5634 if ((bd->x != new_x) || (bd->y != new_y))
5637 if ((bd->w != new_w) || (bd->h != new_h))
5641 e_border_move_resize(bd, new_x, new_y, new_w, new_h);
5643 _policy_border_move(bd, new_x, new_y);
5645 _policy_border_resize(bd, new_w, new_h);
5649 /* check if user defined position */
5650 if (bd->client.icccm.request_pos)
5652 if (bd->client.illume.win_state.state)
5654 if (bd_info->resize_req.need_change)
5656 if ((bd->x != bd_info->resize_req.mouse.x) ||
5657 (bd->y != bd_info->resize_req.mouse.y))
5660 if ((bd->w != bd_info->resize_req.mouse.w) ||
5661 (bd->h != bd_info->resize_req.mouse.h))
5666 e_border_move_resize(bd,
5667 bd_info->resize_req.mouse.x,
5668 bd_info->resize_req.mouse.y,
5669 bd_info->resize_req.mouse.w,
5670 bd_info->resize_req.mouse.h);
5674 _policy_border_move(bd,
5675 bd_info->resize_req.mouse.x,
5676 bd_info->resize_req.mouse.y);
5680 _policy_border_resize(bd,
5681 bd_info->resize_req.mouse.w,
5682 bd_info->resize_req.mouse.h);
5685 bd_info->resize_req.need_change = 0;
5686 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
5689 if (bd_info->resize_req.mouse.down &&
5690 bd_info->resize_req.mouse.locked)
5692 if ((bd->x != bd_info->resize_req.mouse.x) ||
5693 (bd->y != bd_info->resize_req.mouse.y))
5694 _policy_border_move(bd,
5695 bd_info->resize_req.mouse.x,
5696 bd_info->resize_req.mouse.y);
5697 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
5700 _policy_zone_layout_app_layer_set(bd, layer);
5704 /* resize & move if needed */
5705 if (bd->client.illume.win_state.state)
5707 if (bd_info->resize_req.need_change)
5709 if ((bd->x != bd_info->resize_req.mouse.x) ||
5710 (bd->y != bd_info->resize_req.mouse.y))
5713 if ((bd->w != bd_info->resize_req.mouse.w) ||
5714 (bd->h != bd_info->resize_req.mouse.h))
5719 e_border_move_resize(bd,
5720 bd_info->resize_req.mouse.x,
5721 bd_info->resize_req.mouse.y,
5722 bd_info->resize_req.mouse.w,
5723 bd_info->resize_req.mouse.h);
5727 _policy_border_move(bd,
5728 bd_info->resize_req.mouse.x,
5729 bd_info->resize_req.mouse.y);
5733 _policy_border_resize(bd,
5734 bd_info->resize_req.mouse.w,
5735 bd_info->resize_req.mouse.h);
5738 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
5739 bd_info->resize_req.need_change = 0;
5742 if (bd_info->resize_req.mouse.down &&
5743 bd_info->resize_req.mouse.locked)
5745 if ((bd->x != bd_info->resize_req.mouse.x) ||
5746 (bd->y != bd_info->resize_req.mouse.y))
5747 _policy_border_move(bd,
5748 bd_info->resize_req.mouse.x,
5749 bd_info->resize_req.mouse.y);
5750 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... bd move resize... (%d, %d, %d, %d)\n", __func__, __LINE__, bd->x, bd->y, bd->w, bd->h);
5755 /* set layer if needed */
5756 _policy_zone_layout_app_layer_set(bd, layer);
5759 void _policy_window_move_resize_request(Ecore_X_Event_Window_Move_Resize_Request *event)
5762 E_Illume_Border_Info *bd_info;
5763 Ecore_X_Event_Window_Move_Resize_Request *e;
5766 bd = e_border_find_by_client_window(e->win);
5768 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... win:0x%07x, x:%d, y:%d, direction:%d, button:%d, source:%d\n", __func__, __LINE__, e->win, e->x, e->y, e->direction, e->button, e->source);
5770 if (e->direction == ECORE_X_NETWM_DIRECTION_MOVE ||
5771 e->direction == ECORE_X_NETWM_DIRECTION_CANCEL)
5774 if (bd->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
5777 bd_info = _policy_get_border_info(bd);
5778 if (!bd_info) return;
5780 e_border_resize_cancel();
5782 if (bd_info->resize_req.mouse.down)
5785 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
5787 bd_info->resize_req.mouse.down = 1;
5788 bd_info->resize_req.mouse.dx = bd->x - e->x;
5789 bd_info->resize_req.mouse.dy = bd->y - e->y;
5790 bd_info->resize_req.mouse.x = bd->x;
5791 bd_info->resize_req.mouse.y = bd->y;
5793 bd->lock_user_location = 1;
5795 _policy_border_illume_handlers_add(bd_info);
5796 ecore_x_window_raise(bd->event_win);
5797 if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
5798 e_grabinput_get(bd->event_win, 0, bd->event_win);
5800 e_grabinput_get(bd->event_win, 0, 0);
5802 bd_info->resize_req.direction = e->direction;
5803 _policy_resize_start(bd_info);
5806 void _policy_window_state_request(Ecore_X_Event_Window_State_Request *event)
5809 Ecore_X_Event_Window_State_Request *e;
5811 E_Maximize maximize = 0;
5814 bd = e_border_find_by_client_window(e->win);
5817 for (i = 0; i < 2; i++)
5819 switch (e->state[i])
5821 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
5822 if (bd->lock_client_maximize) break;
5823 maximize |= E_MAXIMIZE_VERTICAL;
5826 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
5827 if (bd->lock_client_maximize) break;
5828 maximize |= E_MAXIMIZE_HORIZONTAL;
5836 if (maximize &= E_MAXIMIZE_BOTH)
5838 if (e->action == ECORE_X_WINDOW_STATE_ACTION_ADD)
5840 if (bd->pointer && bd->pointer->type)
5841 e_pointer_type_pop(bd->pointer, bd, bd->pointer->type);
5846 static void _policy_border_root_angle_control(E_Zone *zone)
5848 Eina_Inlist *xwin_info_list;
5849 E_Illume_XWin_Info *xwin_info;
5853 xwin_info_list = _e_illume_xwin_info_list;
5857 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
5859 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
5861 if (xwin_info->bd_info)
5863 bd = xwin_info->bd_info->border;
5866 if (!bd->visible) continue;
5867 if (bd->zone != zone) continue;
5868 if (e_illume_border_is_indicator(bd)) continue;
5869 if (e_illume_border_is_keyboard(bd)) continue;
5870 if (e_illume_border_is_quickpanel(bd)) continue;
5871 if (e_illume_border_is_quickpanel_popup(bd)) continue;
5872 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
5874 if (_policy_root_angle_set(bd)) break;
5881 static int _policy_border_layer_map(int layer)
5885 if (layer < 0) layer = 0;
5886 pos = 1 + (layer / 50);
5887 if (pos > POL_NUM_OF_LAYER) pos = POL_NUM_OF_LAYER;
5892 _policy_msg_handler(void *data, const char *name, const char *info, int val, E_Object *obj, void *msgdata)
5894 E_Manager *man = (E_Manager *)obj;
5895 E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
5897 // handle only comp.manager msg
5898 if (strncmp(name, "comp.manager", sizeof("comp.manager"))) return;
5900 if (!strncmp(info, "visibility.src", sizeof("visibility.src")))
5902 E_Illume_XWin_Info *xwin_info;
5904 Ecore_X_Window active_win;
5905 Ecore_X_Window client_win;
5908 win = e_manager_comp_src_window_get(man, src);
5910 xwin_info = _policy_xwin_info_find(win);
5911 if (!xwin_info) return;
5913 visible = e_manager_comp_src_visible_get(man, src);
5916 xwin_info->is_drawed = EINA_TRUE;
5917 xwin_info->comp_vis = 1;
5918 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, win);
5919 _g_visibility_changed = EINA_TRUE;
5921 if (xwin_info->bd_info && xwin_info->bd_info->border)
5922 client_win = xwin_info->bd_info->border->client.win;
5926 active_win = _policy_active_window_get(ecore_x_window_root_get(win));
5927 if (active_win == client_win)
5929 _policy_active_win_change(xwin_info, active_win);
5934 xwin_info->comp_vis = 0;
5939 void _policy_module_update(E_Event_Module_Update *event)
5941 if ((!strncmp(event->name, "comp-tizen", sizeof("comp-tizen"))) ||
5942 (!strncmp(event->name, "comp", sizeof("comp"))))
5947 _e_use_comp = EINA_TRUE;
5952 _e_use_comp = EINA_FALSE;
5954 // change all variable to 1
5955 Eina_Inlist* xwin_info_list;
5956 E_Illume_XWin_Info *xwin_info;
5958 xwin_info_list = _e_illume_xwin_info_list;
5961 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
5963 xwin_info->comp_vis = EINA_TRUE;
5970 void _policy_border_iconify_cb(E_Border *bd)
5972 if (!_e_illume_cfg->use_force_iconify) return;
5975 if (e_object_is_del(E_OBJECT(bd))) return;
5977 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
5978 if (xwin_info == NULL) return;
5980 _policy_border_uniconify_below_borders_by_illume(xwin_info);
5982 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
5984 int old_vis = xwin_info->visibility;
5985 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
5986 L (LT_VISIBILITY, "[ILLUME2][VISIBILITY] SEND VISIBILITY NOTIFY (Line:%d)... win:0x%07x (old:%d -> new:%d)\n", __LINE__, xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
5988 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
5990 _policy_send_visibility_notify (xwin_info->bd_info->border->client.win, xwin_info->visibility);
5993 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... ICONFIY win:0x%07x (iconify_by_wm:%d)\n", __func__, __LINE__, bd->client.win, xwin_info->iconify_by_wm);
5994 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
5995 _g_visibility_changed = EINA_TRUE;
5997 xwin_info->attr.visible = 0;
5999 _policy_border_focus_top_stack_set(bd);
6002 void _policy_border_uniconify_cb(E_Border *bd)
6004 if (!_e_illume_cfg->use_force_iconify) return;
6007 if (e_object_is_del(E_OBJECT(bd))) return;
6009 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
6010 if (xwin_info == NULL) return;
6012 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... UNICONIFY win:0x%07x (iconify_by_wm:%d)\n", __func__, __LINE__, bd->client.win, xwin_info->iconify_by_wm);
6014 xwin_info->iconify_by_wm = 0;
6015 xwin_info->attr.visible = 1;
6017 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
6018 _g_visibility_changed = EINA_TRUE;
6020 _policy_border_focus_top_stack_set(bd);
6024 _policy_border_event_border_iconify_free(void *data __UNUSED__,
6027 E_Event_Border_Iconify *e;
6030 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_iconify_event");
6031 e_object_unref(E_OBJECT(e->border));
6037 _policy_border_force_iconify(E_Border *bd)
6039 E_Event_Border_Iconify *ev;
6040 unsigned int iconic;
6041 E_Illume_XWin_Info* xwin_info;
6044 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6045 if (bd->shading) return;
6046 ecore_x_window_shadow_tree_flush();
6050 e_border_hide(bd, 0);
6051 if (bd->fullscreen) bd->desk->fullscreen_borders--;
6052 edje_object_signal_emit(bd->bg_object, "e,action,iconify", "e");
6055 e_hints_window_iconic_set(bd);
6056 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6058 ev = E_NEW(E_Event_Border_Iconify, 1);
6060 e_object_ref(E_OBJECT(bd));
6061 // e_object_breadcrumb_add(E_OBJECT(bd), "border_iconify_event");
6062 ecore_event_add(E_EVENT_BORDER_ICONIFY, ev, _policy_border_event_border_iconify_free, NULL);
6064 xwin_info = _policy_xwin_info_find(bd->win);
6067 xwin_info->iconify_by_wm = 1;
6070 if (e_config->transient.iconify)
6074 E_Illume_XWin_Info* child_xwin_info;
6076 EINA_LIST_FOREACH(bd->transients, l, child)
6078 if (!e_object_is_del(E_OBJECT(child)))
6082 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... Iconify by illume.. child:0x%07x\n", __func__, __LINE__, child->client.win);
6083 child_xwin_info = _policy_xwin_info_find(child->win);
6084 if (child_xwin_info)
6086 _policy_border_iconify_by_illume(child_xwin_info);
6092 e_remember_update(bd);
6096 _policy_border_iconify_by_illume(E_Illume_XWin_Info *xwin_info)
6100 if (!xwin_info) return;
6101 if (!xwin_info->bd_info) return;
6102 if (!xwin_info->bd_info->border) return;
6104 bd = xwin_info->bd_info->border;
6105 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) return;
6106 if (e_object_is_del(E_OBJECT(bd))) return;
6108 if (bd->parent && (!bd->parent->iconic)) return;
6110 if (e_illume_border_is_indicator(bd)) return;
6111 if (e_illume_border_is_keyboard(bd)) return;
6112 if (e_illume_border_is_keyboard_sub(bd)) return;
6113 if (e_illume_border_is_quickpanel(bd)) return;
6114 if (e_illume_border_is_quickpanel_popup(bd)) return;
6115 if (e_illume_border_is_clipboard(bd)) return;
6116 if (e_illume_border_is_app_tray(bd)) return;
6117 if (e_illume_border_is_miniapp_tray(bd)) return;
6118 // if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) return;
6120 xwin_info->iconify_by_wm = 1;
6124 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... FORCE_ICONIFY win:0x%07x\n", __func__, __LINE__, bd->client.win);
6125 _policy_border_force_iconify(bd);
6130 _policy_border_event_border_uniconify_free(void *data, void *ev)
6132 E_Event_Border_Uniconify *e;
6135 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_uniconify_event");
6136 e_object_unref(E_OBJECT(e->border));
6140 static void _policy_border_force_uniconify(E_Border *bd)
6143 E_Event_Border_Uniconify *ev;
6144 unsigned int iconic;
6145 E_Illume_XWin_Info* xwin_info;
6148 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6150 xwin_info = _policy_xwin_info_find(bd->win);
6151 if (!(xwin_info && xwin_info->iconify_by_wm)) return;
6153 if (bd->shading) return;
6154 ecore_x_window_shadow_tree_flush();
6159 if (bd->fullscreen) bd->desk->fullscreen_borders++;
6160 if (e_manager_comp_evas_get(bd->zone->container->manager))
6162 if (bd->await_hide_event > 0)
6163 bd->await_hide_event--;
6165 desk = e_desk_current_get(bd->desk->zone);
6166 e_border_desk_set(bd, desk);
6167 edje_object_signal_emit(bd->bg_object, "e,action,uniconify", "e");
6170 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6172 ev = E_NEW(E_Event_Border_Uniconify, 1);
6174 e_object_ref(E_OBJECT(bd));
6175 // e_object_breadcrumb_add(E_OBJECT(bd), "border_uniconify_event");
6176 ecore_event_add(E_EVENT_BORDER_UNICONIFY, ev, _policy_border_event_border_uniconify_free, NULL);
6178 if (e_config->transient.iconify)
6182 E_Illume_XWin_Info* child_xwin_info;
6184 EINA_LIST_FOREACH(bd->transients, l, child)
6186 if (!e_object_is_del(E_OBJECT(child)))
6190 child_xwin_info = _policy_xwin_info_find(child->win);
6191 if (child_xwin_info) child_xwin_info->iconify_by_wm = 1;
6193 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, child->client.win);
6194 _policy_border_force_uniconify(child);
6199 e_remember_update(bd);
6203 _policy_border_uniconify_below_borders_by_illume(E_Illume_XWin_Info *xwin_info)
6207 if (!xwin_info) return;
6208 if (!xwin_info->bd_info) return;
6210 bd = xwin_info->bd_info->border;
6212 // 1. check if iconify is caused by visibility change or not
6213 if (xwin_info->iconify_by_wm) return;
6215 // 2. check if current bd's visibility is fully-obscured or not
6216 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED) return;
6218 // 3-1. find bd's below window and un-iconify it
6219 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... UNICONIFY Below Windows of win:0x%07x\n", __func__, __LINE__, bd->client.win);
6220 _policy_border_uniconify_below_borders(bd);
6222 if (!e_object_is_del(E_OBJECT(bd)))
6228 static E_Border* _policy_border_find_below(E_Border *bd)
6233 E_Illume_XWin_Info* xwin_info;
6235 passed = EINA_FALSE;
6237 /* determine layering position */
6238 pos = _policy_border_layer_map(bd->layer);
6240 /* Find the windows below this one */
6241 for (i = pos; i >= 2; i--)
6245 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6249 /* skip if it's the same border */
6256 if ((b->x == b->zone->x) &&
6257 (b->y == b->zone->y) &&
6258 (b->w == b->zone->w) &&
6259 (b->h == b->zone->h) &&
6260 (b->h == b->zone->h) &&
6261 (b->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING) &&
6264 xwin_info = _policy_xwin_info_find(b->win);
6267 if ((!xwin_info->argb) ||
6268 (xwin_info->argb && xwin_info->bd_info->opaque))
6270 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... win:0x%07x, ALREADY FULLY-OBSCURED... by win:0x%07x visible:%d (visibility:%d)\n", __func__, __LINE__, bd->client.win, b->client.win, b->visible, xwin_info->visibility);
6276 if (!passed) continue;
6278 /* skip if it's not on this zone */
6279 if (b->zone != bd->zone) continue;
6281 /* skip special borders */
6282 if (e_illume_border_is_indicator(b)) continue;
6283 if (e_illume_border_is_keyboard(b)) continue;
6284 if (e_illume_border_is_keyboard_sub(b)) continue;
6285 if (e_illume_border_is_quickpanel(b)) continue;
6286 if (e_illume_border_is_quickpanel_popup(b)) continue;
6287 if (e_illume_border_is_clipboard(b)) continue;
6288 if (e_illume_border_is_app_tray(b)) continue;
6289 if (e_illume_border_is_miniapp_tray(b)) continue;
6298 static void _policy_border_uniconify_below_borders(E_Border *bd)
6302 below_bd = _policy_border_find_below(bd);
6303 if (!below_bd) return;
6305 E_Illume_XWin_Info* below_xwin_info = _policy_xwin_info_find(below_bd->win);
6306 if (below_xwin_info == NULL) return;
6308 if ((below_bd->w != below_bd->zone->w) ||
6309 (below_bd->h != below_bd->zone->h) ||
6310 (below_xwin_info->argb))
6312 if (!(below_xwin_info->bd_info && below_xwin_info->bd_info->opaque))
6313 _policy_border_uniconify_below_borders(below_bd);
6317 if (below_bd->iconic)
6319 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, below_bd->client.win);
6320 _policy_border_force_uniconify(below_bd);
6324 static void _policy_border_uniconify_top_border(E_Border *bd)
6329 E_Illume_XWin_Info* xwin_info;
6331 if (!_e_illume_cfg->use_force_iconify) return;
6333 zone_w = bd->zone->w;
6334 zone_h = bd->zone->h;
6335 /* determine layering position */
6337 /* Find the windows below this one */
6338 for (i = POL_NUM_OF_LAYER; i >= 2; i--)
6342 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6346 if ((b->x >= zone_w) || (b->y >= zone_h)) continue;
6347 if (((b->x + b->w) <= 0) || ((b->y + b->h) <= 0)) continue;
6349 /* skip if it's not on this zone */
6350 if (b->zone != bd->zone) continue;
6352 /* skip special borders */
6353 if (e_illume_border_is_indicator(b)) continue;
6354 if (e_illume_border_is_keyboard(b)) continue;
6355 if (e_illume_border_is_keyboard_sub(b)) continue;
6356 if (e_illume_border_is_quickpanel(b)) continue;
6357 if (e_illume_border_is_quickpanel_popup(b)) continue;
6358 if (e_illume_border_is_clipboard(b)) continue;
6359 if (e_illume_border_is_app_tray(b)) continue;
6360 if (e_illume_border_is_miniapp_tray(b)) continue;
6364 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, b->client.win);
6365 _policy_border_force_uniconify(b);
6368 if ((b->x == b->zone->x) &&
6369 (b->y == b->zone->y) &&
6370 (b->w == b->zone->w) &&
6371 (b->h == b->zone->h))
6373 xwin_info = _policy_xwin_info_find(b->win);
6376 if (xwin_info->argb && !xwin_info->bd_info->opaque)
6391 /* change the desk of window for popsync.
6392 * if there is no window in data read from ev->l[0],
6393 * window that is latest above stack will be changed.
6394 * - event->data.l[0] : window ID
6395 * - event->data.l[1]
6396 * 1(default): mobile
6400 _policy_window_desk_set(Ecore_X_Event_Client_Message *event)
6402 Ecore_X_Event_Client_Message *ev = event;
6406 E_Desk *desk = NULL;
6409 Eina_Bool one_time = EINA_FALSE;
6410 char *profile = NULL, *new_profile = NULL;
6411 unsigned int desk_num;
6415 EINA_SAFETY_ON_NULL_RETURN(ev);
6417 win = ev->data.l[0];
6418 desk_num = ev->data.l[1];
6419 if (win) one_time = EINA_TRUE;
6421 // decide new desk's profile from received data.
6425 new_profile = _e_illume_cfg->display_name.popsync;
6429 new_profile = _e_illume_cfg->display_name.mobile;
6433 con = e_container_current_get(e_manager_current_get());
6434 bl = e_container_border_list_last(con);
6436 // if there exists a ID of window read from data ev->data.l[0],
6437 // find and set this window's border window, or set latest above border.
6438 bd = win ? e_border_find_by_client_window(win) :
6439 e_container_border_list_prev(bl);
6440 if (!bd) bd = e_border_find_by_window(win);
6445 // skip special window.
6446 if ((e_illume_border_is_indicator(bd)) ||
6447 (e_illume_border_is_keyboard(bd)) ||
6448 (e_illume_border_is_keyboard_sub(bd)) ||
6449 (e_illume_border_is_quickpanel(bd)) ||
6450 (e_illume_border_is_quickpanel_popup(bd)) ||
6451 (e_illume_border_is_clipboard(bd)))
6453 if (one_time) goto fin;
6457 if ((bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) &&
6458 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
6459 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
6460 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
6461 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
6462 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP) &&
6463 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NOTIFICATION))
6468 // terminated this function if there is only one desk.
6469 if ((zone->desk_x_count < 2) && (zone->desk_y_count < 2))
6473 // find the corresponsive desk.
6474 for (x = 0; x < zone->desk_x_count; x++)
6476 for (y = 0; y < zone->desk_y_count; y++)
6478 int index = x + (y * zone->desk_x_count);
6479 profile = zone->desks[index]->window_profile;
6481 if (!strcmp(new_profile, profile))
6482 desk = zone->desks[index];
6486 if (!desk) goto fin;
6488 e_border_desk_set(bd, desk);
6490 // we have to receive the DAMAGE notify from this window.
6491 // for this, the window has to have visible state as a its property.
6492 // if not, can not receive DAMAGE notify.
6493 e_hints_window_visible_set(bd);
6494 e_hints_window_desktop_set(bd);
6495 _policy_border_uniconify_below_borders(bd);
6498 } while((!one_time) && (bd = e_container_border_list_prev(bl)));
6501 e_container_border_list_free(bl);
6505 "[POPSYNC] ERROR: ");
6509 fprintf(stderr, "Couldn't find border.\n");
6512 fprintf(stderr, "Couldn't change desk. No border, or special window.\n");
6515 fprintf(stderr, "NO desk to change \n");
6518 fprintf(stderr, "Couldn't find desk such a profile.\n");
6521 fprintf(stderr, "Non-defined error\n");
6527 /* for supporting rotation */
6529 _policy_border_hook_rotation_list_add(E_Border *bd)
6531 _policy_border_dependent_rotation(bd);
6535 _policy_border_dependent_rotation(E_Border *bd)
6538 E_Border *dep_bd = NULL;
6542 if (!dep_rot.list) return;
6543 if (dep_rot.refer.active_win != bd->client.win) return;
6545 rotation = bd->client.e.state.rot.curr;
6546 EINA_LIST_FOREACH(dep_rot.list, l, dep_bd)
6548 if (!dep_bd) continue;
6549 if (_policy_dependent_rotation_check(dep_bd, rotation))
6551 ELBF(ELBT_ROT, 0, dep_bd->client.win, "ROT_SET ANG [%d -> %d]",
6552 dep_bd->client.e.state.rot.curr, rotation);
6553 dep_rot.ang = rotation;
6554 e_border_rotation_set(dep_bd, rotation);
6560 _policy_dependent_rotation_check(E_Border *bd, int rotation)
6562 Eina_Bool ret = EINA_FALSE;
6564 if (!bd) return ret;
6565 if (!bd->visible) return ret;
6566 if (bd->client.e.state.rot.curr == rotation) return ret;
6573 _policy_property_indicator_cmd_win_change(Ecore_X_Event_Window_Property *event)
6575 Ecore_X_Window cmd_win;
6577 cmd_win = _policy_indicator_cmd_win_get(event->win);
6581 ELB(ELBT_ROT, "ERR! NO INDI_CMD_WIN", event->win);
6585 if (dep_rot.refer.cmd_win != cmd_win)
6587 ELBF(ELBT_ROT, 0, cmd_win,
6588 "INDICATOR COMMAND WIN: [0x%08x -> 0x%08x]",
6589 dep_rot.refer.cmd_win, cmd_win);
6590 dep_rot.refer.cmd_win = cmd_win;
6595 _policy_property_active_indicator_win_change(Ecore_X_Event_Window_Property *event)
6597 Ecore_X_Window active_win = 0;
6598 E_Border *bd = NULL;
6602 active_win = _policy_active_indicator_win_get(event->win);
6605 ELB(ELBT_ROT, "ERR! NO ACTIVE_INDI_WIN", event->win);
6609 if (dep_rot.refer.active_win != active_win)
6611 bd = e_border_find_by_client_window(active_win);
6614 ELB(ELBT_ROT, "ERR! NO BD ACTIVE_INDI_WIN", active_win);
6618 /* The normal application window is ok to rotate dependent rotation windows.
6619 * But if the notification window which doesn't have accepts_focus such as volume popup
6620 * is the active window, then the illume doesn't rotate dependent windows.
6622 Eina_Bool rot = EINA_FALSE;
6623 if (e_illume_border_is_notification(bd))
6625 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
6635 ELBF(ELBT_ROT, 0, bd->client.win,
6636 "ROT:%d NOTI:%d ACCEPT_FOCUS:%d TAKE_FOCUS:%d",
6638 e_illume_border_is_notification(bd),
6639 bd->client.icccm.accepts_focus,
6640 bd->client.icccm.take_focus);
6644 E_Border *prev_bd = e_border_find_by_client_window(dep_rot.refer.active_win);
6645 ELBF(ELBT_ROT, 0, active_win,
6646 "INDICATOR ACTIVE WIN: [%s(0x%08x) -> %s(0x%08x)]",
6647 prev_bd ? (prev_bd->client.icccm.name ? prev_bd->client.icccm.name : "") : "",
6648 dep_rot.refer.active_win,
6649 bd->client.icccm.name ? bd->client.icccm.name : "",
6651 dep_rot.refer.active_win = active_win;
6652 dep_rot.ang = bd->client.e.state.rot.curr;
6654 _policy_border_dependent_rotation(bd);
6659 static Ecore_X_Window
6660 _policy_indicator_cmd_win_get(Ecore_X_Window win)
6662 Ecore_X_Window cmd_win = NULL;
6663 unsigned char* prop_data = NULL;
6664 int ret = 0, count = 0;
6666 if (win != dep_rot.root) return NULL;
6668 ret = ecore_x_window_prop_property_get(win, E_INDICATOR_CMD_WIN,
6669 ECORE_X_ATOM_WINDOW, 32,
6670 &prop_data, &count);
6672 memcpy (&cmd_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6674 if (prop_data) free(prop_data);
6679 static Ecore_X_Window
6680 _policy_active_indicator_win_get(Ecore_X_Window win)
6682 Ecore_X_Window active_win = NULL;
6683 unsigned char* prop_data = NULL;
6684 int ret = 0, count = 0;
6686 if (win != dep_rot.refer.cmd_win) return NULL;
6688 ret = ecore_x_window_prop_property_get(win, E_ACTIVE_INDICATOR_WIN,
6689 ECORE_X_ATOM_WINDOW, 32,
6690 &prop_data, &count);
6692 memcpy (&active_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6694 if (prop_data) free(prop_data);
6700 _prev_angle_get(Ecore_X_Window win)
6702 int ret, count = 0, ang = -1;
6703 unsigned char* data = NULL;
6705 ret = ecore_x_window_prop_property_get
6706 (win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
6707 ECORE_X_ATOM_CARDINAL, 32, &data, &count);
6709 if ((ret) && (data) && (count))
6710 ang = ((int *)data)[0];
6711 if (data) free(data);
6717 _policy_idle_enterer(void)
6719 _policy_calculate_visibility();