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, int rotation);
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 e_illume_border_is_app_selector(bd))
950 dep_rot.list = eina_list_remove(dep_rot.list, bd);
954 _policy_border_focus_in(E_Border *bd __UNUSED__)
956 // printf("Border focus in: %s\n", bd->client.icccm.name);
960 _policy_border_focus_out(E_Border *bd)
962 // printf("Border focus out: %s\n", bd->client.icccm.name);
966 /* NB: if we got this focus_out event on a deleted border, we check if
967 * it is a transient (child) of another window. If it is, then we
968 * transfer focus back to the parent window */
969 if (e_object_is_del(E_OBJECT(bd)))
971 if (e_illume_border_is_dialog(bd))
975 if ((parent = e_illume_border_parent_get(bd)))
976 _policy_border_set_focus(parent);
982 _policy_border_activate(E_Border *bd)
984 // printf("Border Activate: %s\n", bd->client.icccm.name);
987 /* NB: stolen borders may or may not need focus call...have to test */
988 if (bd->stolen) return;
990 /* NB: We cannot use our set_focus function here because it does,
991 * occasionally fall through wrt E's focus policy, so cherry pick the good
992 * parts and use here :) */
994 /* if the border is iconified then uniconify if allowed */
995 if ((bd->iconic) && (!bd->lock_user_iconify))
996 e_border_uniconify(bd);
998 ILLUME2_TRACE ("[ILLUME2] _policy_border_activate.. (%d) ACTIVE WIN = 0x%07x\n", __LINE__, bd->client.win);
1000 /* NB: since we skip needless border evals when container layout
1001 * is called (to save cpu cycles), we need to
1002 * signal this border that it's focused so that the edj gets
1005 * This is potentially useless as THIS policy
1006 * makes all windows borderless anyway, but it's in here for
1008 e_border_focus_latest_set(bd);
1010 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
1011 if (bd->icon_object)
1012 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
1013 e_focus_event_focus_in(bd);
1018 _policy_border_post_fetch(E_Border *bd)
1020 // printf("Border post fetch\n");
1024 /* NB: for this policy we disable all remembers set on a border */
1025 if (bd->remember) e_remember_del(bd->remember);
1026 bd->remember = NULL;
1028 /* set this border to borderless */
1029 #ifdef DIALOG_USES_PIXEL_BORDER
1030 if ((e_illume_border_is_dialog(bd)) && (e_illume_border_parent_get(bd)))
1031 eina_stringshare_replace(&bd->bordername, "pixel");
1035 /* for desktop mode */
1036 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1038 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1040 if (!bd->client.illume.win_state.state)
1047 // for supporting rotation such as quickpanel
1048 if (e_illume_border_is_quickpanel(bd) ||
1049 e_illume_border_is_miniapp_tray(bd) ||
1050 (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) ||
1051 e_illume_border_is_syspopup(bd) ||
1052 e_illume_border_is_app_selector(bd))
1054 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
1055 if (!eina_list_data_find(dep_rot.list, bd))
1059 dep_rot.list = eina_list_append(dep_rot.list, bd);
1061 if (_prev_angle_get(bd->client.win) != -1)
1062 bd->client.e.state.rot.curr = prev_ang;
1064 if (dep_rot.ang != bd->client.e.state.rot.curr)
1065 e_border_rotation_set(bd, dep_rot.ang);
1069 /* tell E the border has changed */
1070 bd->client.border.changed = 1;
1075 _policy_border_post_new_border(E_Border *bd)
1078 E_Illume_Border_Info* bd_info = NULL;
1082 bd_info = _policy_get_border_info(bd);
1083 if (!bd_info) return;
1085 bd_info->win_type = bd->client.netwm.type;
1087 if (e_illume_border_is_notification(bd))
1089 bd_info->level = _policy_border_get_notification_level(bd->client.win);
1090 layer = _policy_notification_level_map(bd_info->level);
1091 e_border_layer_set(bd, layer);
1092 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
1093 __func__, __LINE__, bd->client.win, bd_info->level);
1099 _check_parent_in_transient_for_tree(E_Border *bd, E_Border *parent_bd)
1103 if (!bd || !parent_bd) return EINA_FALSE;
1105 ancestor = parent_bd;
1106 while (ancestor->parent)
1108 if (ancestor->parent == bd)
1110 // This is very bad. bd and parent_bd are transient_for each other
1112 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);
1114 ELBF(ELBT_ILLUME, 0, bd->client.win, "BAD. Transient_for Error. Parent:0x%07x is descendant", parent_bd->client.win);
1117 ancestor = ancestor->parent;
1124 _policy_border_pre_fetch(E_Border *bd)
1126 #ifdef _F_DEICONIFY_APPROVE_
1127 Eina_Bool change_parent = EINA_TRUE;
1135 state = ecore_x_e_illume_window_state_get(bd->client.win);
1136 _policy_border_illume_window_state_change(bd, state);
1139 /* Below code are same to _e_border_eval0 in e_border.c.
1140 But we added code to handle notification window */
1141 if (bd->client.icccm.fetch.transient_for)
1143 /* TODO: What do to if the transient for isn't mapped yet? */
1144 E_Border *bd_parent = NULL;
1145 E_Illume_XWin_Info *xwin_info = NULL;
1146 Eina_Bool transient_each_other;
1147 Ecore_X_Window transient_for_win;
1149 if (_e_illume_cfg->use_force_iconify)
1150 xwin_info = _policy_xwin_info_find(bd->win);
1152 transient_for_win = ecore_x_icccm_transient_for_get(bd->client.win);
1153 if (bd->client.icccm.transient_for == transient_for_win)
1155 ELBF(ELBT_ILLUME, 0, bd->client.win, "Same transient_for:0x%07x. SKIP...", transient_for_win);
1156 goto transient_fetch_done;
1159 bd->client.icccm.transient_for = transient_for_win;
1160 if (bd->client.icccm.transient_for)
1162 bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
1165 /* If we already have a parent, remove it */
1168 #ifdef _F_DEICONIFY_APPROVE_
1169 if (bd_parent == bd->parent) change_parent = EINA_FALSE;
1171 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
1172 if (bd->parent->modal == bd) bd->parent->modal = NULL;
1176 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);
1179 transient_each_other = _check_parent_in_transient_for_tree(bd, bd_parent);
1180 if (!transient_each_other)
1182 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);
1183 if (_e_illume_cfg->use_force_iconify)
1185 if (!bd_parent->iconic)
1187 if (xwin_info && xwin_info->iconify_by_wm)
1191 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, bd->client.win);
1192 _policy_border_force_uniconify(bd);
1198 if (bd_parent != bd)
1200 bd->parent = bd_parent;
1201 _policy_border_transient_for_layer_set(bd, bd->parent, bd->parent->layer);
1202 bd_parent->transients = eina_list_append(bd_parent->transients, bd);
1204 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
1205 bd->parent->modal = bd;
1207 if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
1208 (bd->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
1214 #ifdef _F_DEICONIFY_APPROVE_
1217 E_Border *ancestor_bd;
1218 bd->client.e.state.deiconify_approve.render_done = 0;
1220 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
1221 if ((ancestor_bd) &&
1222 (!e_object_is_del(E_OBJECT(ancestor_bd))))
1224 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
1225 bd->client.e.state.deiconify_approve.ancestor = NULL;
1227 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
1228 (ancestor_bd->client.e.state.deiconify_approve.render_done))
1230 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
1232 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
1233 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
1234 e_border_uniconify(ancestor_bd);
1241 transient_fetch_done:
1242 bd->client.icccm.fetch.transient_for = 0;
1247 _policy_border_new_border(E_Border *bd)
1252 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
1254 _policy_add_border_info_list(bd);
1257 #ifdef _F_BORDER_HOOK_PATCH_
1259 _policy_border_del_border(E_Border *bd)
1265 _policy_border_del(bd);
1271 _policy_border_post_assign(E_Border *bd)
1273 // printf("Border post assign\n");
1276 if (!bd->new_client) return;
1278 bd->internal_no_remember = 1;
1280 /* do not allow client to change these properties */
1281 bd->lock_client_shade = 1;
1283 if (e_illume_border_is_utility (bd))
1285 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... win(0x%07x) is UTILITY type.. SET REQUEST_POS!!!\n", __func__, __LINE__, bd->client.win);
1286 bd->client.icccm.request_pos = 1;
1289 /* do not allow the user to change these properties */
1290 /* for desktop mode */
1291 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1293 if (bd->client.illume.win_state.state)
1295 bd->lock_user_location = 0;
1296 bd->lock_user_size = 0;
1300 bd->lock_user_location = 1;
1301 bd->lock_user_size = 1;
1303 bd->lock_user_shade = 1;
1304 if (bd->client.icccm.request_pos == 0)
1307 bd->changes.pos = 1;
1311 bd->lock_user_shade = 1;
1313 /* clear any centered states */
1314 /* NB: this is mainly needed for E's main config dialog */
1315 bd->client.e.state.centered = 0;
1317 /* lock the border type so user/client cannot change */
1318 bd->lock_border = 1;
1322 _policy_border_show(E_Border *bd)
1326 /* make sure we have a name so that we don't handle windows like E's root */
1327 if (!bd->client.icccm.name) return;
1329 // printf("Border Show: %s\n", bd->client.icccm.class);
1331 /* trap for special windows so we can ignore hides below them */
1332 if (e_illume_border_is_indicator(bd)) return;
1333 if (e_illume_border_is_quickpanel(bd)) return;
1334 if (e_illume_border_is_quickpanel_popup(bd)) return;
1336 if (e_illume_border_is_keyboard(bd))
1339 angle = _policy_window_rotation_angle_get(bd->client.win);
1342 if (angle != g_root_angle)
1344 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);
1345 ecore_x_client_message32_send(bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
1346 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, g_root_angle, g_active_win, 0, 0, 0);
1353 if (e_illume_border_is_clipboard(bd))
1355 ecore_x_e_illume_clipboard_state_set(bd->zone->black_win, ECORE_X_ILLUME_CLIPBOARD_STATE_ON);
1356 ecore_x_e_illume_clipboard_geometry_set(bd->zone->black_win, bd->x, bd->y, bd->w, bd->h);
1360 if (eina_list_data_find(dep_rot.list, bd) == bd)
1361 e_border_rotation_set(bd, dep_rot.ang);
1365 _policy_border_cb_move(E_Border *bd)
1369 if (e_illume_border_is_app_tray(bd) ||
1370 e_illume_border_is_miniapp_tray(bd))
1372 _policy_border_focus_top_stack_set(bd);
1379 _policy_zone_layout(E_Zone *zone)
1381 E_Illume_Config_Zone *cz;
1385 // printf("Zone Layout: %d\n", zone->id);
1389 /* get the config for this zone */
1390 cz = e_illume_zone_config_get(zone->id);
1393 /* loop through border list and update layout */
1394 E_Illume_Border_Info* bd_info;
1395 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
1397 if (!bd_info) continue;
1399 bd = bd_info->border;
1401 /* skip borders that are being deleted */
1402 if (e_object_is_del(E_OBJECT(bd))) continue;
1404 /* skip borders not on this zone */
1405 if (bd->zone != zone) continue;
1407 /* only update layout for this border if it really needs it */
1408 if ((!bd->new_client) && (!bd->changes.pos) && (!bd->changes.size) &&
1409 (!bd->changes.visible) && (!bd->pending_move_resize) &&
1410 (!bd->need_shape_export) && (!bd->need_shape_merge)) continue;
1412 /* are we laying out an indicator ? */
1413 if (e_illume_border_is_indicator(bd))
1414 _policy_zone_layout_indicator(bd, cz);
1416 /* are we layout out a quickpanel ? */
1417 else if (e_illume_border_is_quickpanel(bd))
1418 _policy_zone_layout_quickpanel(bd);
1420 else if (e_illume_border_is_quickpanel_popup(bd))
1421 _policy_zone_layout_quickpanel_popup(bd);
1423 /* are we laying out a keyboard ? */
1424 else if (e_illume_border_is_keyboard(bd))
1425 _policy_zone_layout_keyboard(bd, cz);
1427 else if (e_illume_border_is_keyboard_sub(bd))
1428 _policy_zone_layout_keyboard(bd, cz);
1430 /* are we laying out a fullscreen window ? */
1431 /* NB: we could use the e_illume_border_is_fullscreen function here
1432 * but we save ourselves a function call this way. */
1433 else if ((bd->fullscreen) || (bd->need_fullscreen))
1434 _policy_zone_layout_fullscreen(bd);
1436 /* are we laying out a dialog ? */
1437 else if (e_illume_border_is_dialog(bd))
1438 _policy_zone_layout_dialog(bd, cz);
1440 else if (e_illume_border_is_splash(bd))
1441 _policy_zone_layout_splash(bd, cz);
1443 else if (e_illume_border_is_clipboard(bd))
1444 _policy_zone_layout_clipboard(bd, cz);
1446 else if (e_illume_border_is_app_tray(bd))
1447 _policy_zone_layout_apptray(bd);
1449 else if (e_illume_border_is_miniapp_tray(bd))
1450 _policy_zone_layout_miniapptray(bd);
1452 /* must be an app */
1455 /* are we in single mode ? */
1458 /* for desktop mode */
1459 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1460 _policy_zone_layout_app_single_new(bd_info, cz);
1461 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1462 _policy_zone_layout_app_single_monitor(bd_info, cz);
1464 _policy_zone_layout_app_single_new(bd_info, cz);
1468 /* we are in dual-mode, check orientation */
1469 if (cz->mode.side == 0)
1473 /* grab the indicator position so we can tell if it
1474 * is in a custom position or not (user dragged it) */
1475 e_illume_border_indicator_pos_get(bd->zone, NULL, &ty);
1476 if (ty <= bd->zone->y)
1477 _policy_zone_layout_app_dual_top_new (bd_info, cz);
1479 _policy_zone_layout_app_dual_custom_new (bd_info, cz);
1482 _policy_zone_layout_app_dual_left_new (bd_info, cz);
1489 _policy_zone_move_resize(E_Zone *zone)
1494 // printf("Zone move resize\n");
1498 ecore_x_window_size_get (zone->container->manager->root, &_g_root_width, &_g_root_height);
1500 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
1503 /* skip borders not on this zone */
1504 if (bd->zone != zone) continue;
1506 /* signal a changed pos here so layout gets updated */
1507 bd->changes.pos = 1;
1513 _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode)
1515 E_Illume_Config_Zone *cz;
1518 // printf("Zone mode change: %d\n", zone->id);
1522 /* get the config for this zone */
1523 cz = e_illume_zone_config_get(zone->id);
1526 /* update config with new mode */
1527 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
1532 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
1534 else if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
1537 e_config_save_queue();
1539 /* lock indicator window from dragging if we need to */
1540 bd = e_illume_border_indicator_get(zone);
1543 /* only dual-top mode can drag */
1544 if ((cz->mode.dual == 1) && (cz->mode.side == 0))
1546 /* only set locked if we need to */
1547 if (bd->client.illume.drag.locked != 0)
1548 ecore_x_e_illume_drag_locked_set(bd->client.win, 0);
1552 /* only set locked if we need to */
1553 if (bd->client.illume.drag.locked != 1)
1554 ecore_x_e_illume_drag_locked_set(bd->client.win, 1);
1558 /* Need to trigger a layout update here */
1559 _policy_zone_layout_update(zone);
1563 _policy_zone_close(E_Zone *zone)
1567 // printf("Zone close\n");
1571 /* make sure we have a focused border */
1572 if (!(bd = e_border_focused_get())) return;
1574 /* make sure focused border is on this zone */
1575 if (bd->zone != zone) return;
1577 /* close this border */
1578 e_border_act_close_begin(bd);
1582 _policy_drag_start(E_Border *bd)
1584 // printf("Drag start\n");
1588 /* ignore stolen borders */
1589 if (bd->stolen) return;
1591 if (!bd->visible) return;
1593 /* set property on this border to say we are dragging */
1594 ecore_x_e_illume_drag_set(bd->client.win, 1);
1596 /* set property on zone window that a drag is happening */
1597 ecore_x_e_illume_drag_set(bd->zone->black_win, 1);
1601 _policy_drag_end(E_Border *bd)
1603 // printf("Drag end\n");
1607 /* ignore stolen borders */
1608 if (bd->stolen) return;
1610 /* set property on this border to say we are done dragging */
1611 ecore_x_e_illume_drag_set(bd->client.win, 0);
1613 /* set property on zone window that a drag is finished */
1614 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
1618 _policy_resize_start(E_Illume_Border_Info *bd_info)
1625 const char buf[PATH_MAX];
1627 bd = bd_info->border;
1630 if (bd->stolen) return;
1631 if (!bd->client.illume.win_state.state) return;
1632 if (!bd_info->resize_req.mouse.down) return;
1634 bd_info->resize_req.need_change = 0;
1635 bd_info->resize_req.mouse.locked = 1;
1636 bd_info->resize_req.mouse.resize = 1;
1637 int ang = _policy_window_rotation_angle_get(bd->client.win);
1638 if (ang == -1) ang = 0;
1639 bd_info->resize_req.angle = ang;
1641 m = e_manager_current_get();
1643 canvas = e_manager_comp_evas_get(m);
1644 if (!canvas) return;
1646 o = edje_object_add(canvas);
1647 snprintf(buf, sizeof(buf), "%s/e-module-illume2-tizen.edj", _e_illume_mod_dir);
1648 evas_object_image_border_center_fill_set(o, EVAS_BORDER_FILL_NONE);
1649 if(!(edje_object_file_set(o, buf, "new_shadow"))
1650 || !(bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
1652 o = evas_object_rectangle_add(canvas);
1653 evas_object_color_set(o, 100, 100, 100, 100);
1656 nx = bd->x - bd->zone->x;
1657 ny = bd->y - bd->zone->y;
1658 evas_object_move(o, nx, ny);
1659 evas_object_resize(o, bd->w, bd->h);
1660 e_object_data_set(E_OBJECT(bd), o);
1661 evas_object_show(o);
1665 _policy_resize_end(E_Illume_Border_Info *bd_info)
1668 bd = bd_info->border;
1672 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
1673 if (o) evas_object_del(o);
1675 if (bd->stolen) return;
1676 if (!bd->client.illume.win_state.state) return;
1677 if (!bd_info->resize_req.mouse.down) return;
1679 bd_info->resize_req.mouse.locked = 0;
1680 bd_info->resize_req.mouse.resize = 0;
1684 _policy_focus_back(E_Zone *zone)
1686 Eina_List *l, *fl = NULL;
1690 if (eina_list_count(_pol_focus_stack) < 1) return;
1692 // printf("Focus back\n");
1694 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1697 if (bd->zone != zone) continue;
1698 fl = eina_list_append(fl, bd);
1701 if (!(fbd = e_border_focused_get())) return;
1702 if (fbd->parent) return;
1704 EINA_LIST_REVERSE_FOREACH(fl, l, bd)
1706 if ((fbd) && (bd == fbd))
1710 if ((l->next) && (b = l->next->data))
1712 _policy_border_set_focus(b);
1717 /* we've reached the end of the list. Set focus to first */
1718 if ((b = eina_list_nth(fl, 0)))
1720 _policy_border_set_focus(b);
1730 _policy_focus_forward(E_Zone *zone)
1732 Eina_List *l, *fl = NULL;
1736 if (eina_list_count(_pol_focus_stack) < 1) return;
1738 // printf("Focus forward\n");
1740 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1743 if (bd->zone != zone) continue;
1744 fl = eina_list_append(fl, bd);
1747 if (!(fbd = e_border_focused_get())) return;
1748 if (fbd->parent) return;
1750 EINA_LIST_FOREACH(fl, l, bd)
1752 if ((fbd) && (bd == fbd))
1756 if ((l->next) && (b = l->next->data))
1758 _policy_border_set_focus(b);
1763 /* we've reached the end of the list. Set focus to first */
1764 if ((b = eina_list_nth(fl, 0)))
1766 _policy_border_set_focus(b);
1775 /* enable/disable composite module - 100320 yigl */
1776 #ifdef COMP_MODULE_CONTROL
1778 _policy_property_composite_module_change(Ecore_X_Event_Window_Property *ev)
1782 int current_enabled = 0;
1783 unsigned char* prop_data = NULL;
1784 E_Module* comp = NULL;
1786 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_COMP_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1787 if( ret && prop_data )
1789 memcpy (&enable, prop_data, sizeof (int));
1790 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1792 comp = e_module_find ("comp-tizen");
1795 current_enabled = e_module_enabled_get(comp);
1796 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1798 if( current_enabled && !enable )
1800 fprintf( stdout, "e_module_disable(comp-tizen) " );
1801 e_module_disable(comp);
1803 else if( !current_enabled && enable )
1805 fprintf( stdout, "e_module_enable(comp-tizen) " );
1806 e_module_enable(comp);
1810 fprintf( stdout, "skip... " );
1813 fprintf( stdout, "\n" );
1817 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find comp module.\n", __func__, __LINE__ );
1821 if (prop_data) free (prop_data);
1826 /* enable/disable backkey module - 130610 seongwon1.cho */
1827 #ifdef BACKKEY_MODULE_CONTROL
1829 _policy_property_backkey_module_change(Ecore_X_Event_Window_Property *ev)
1833 int current_enabled = 0;
1834 unsigned char* prop_data = NULL;
1835 E_Module* backkey = NULL;
1837 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1838 if( ret && prop_data )
1840 memcpy (&enable, prop_data, sizeof (int));
1841 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1843 backkey = e_module_find ("backkey-tizen");
1846 current_enabled = e_module_enabled_get(backkey);
1847 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1849 if( current_enabled && !enable )
1851 fprintf( stdout, "e_module_disable(backkey-tizen) " );
1852 e_module_disable(backkey);
1854 else if( !current_enabled && enable )
1856 fprintf( stdout, "e_module_enable(backkey-tizen) " );
1857 e_module_enable(backkey);
1861 fprintf( stdout, "skip... " );
1864 fprintf( stdout, "\n" );
1868 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find backkey module.\n", __func__, __LINE__ );
1869 backkey = e_module_new("backkey-tizen");
1870 if (backkey) e_module_enable(backkey);
1874 if (prop_data) free (prop_data);
1880 /* enable/disable devmode module - 130610 seongwon1.cho */
1881 #ifdef DEVMODE_MODULE_CONTROL
1883 _policy_property_devmode_module_change(Ecore_X_Event_Window_Property *ev)
1887 int current_enabled = 0;
1888 unsigned char* prop_data = NULL;
1889 E_Module* devmode = NULL;
1891 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1892 if( ret && prop_data )
1894 memcpy (&enable, prop_data, sizeof (int));
1895 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1897 devmode = e_module_find ("devmode-tizen");
1900 current_enabled = e_module_enabled_get(devmode);
1901 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1903 if( current_enabled && !enable )
1905 fprintf( stdout, "e_module_disable(devmode-tizen) " );
1906 e_module_disable(devmode);
1908 else if( !current_enabled && enable )
1910 fprintf( stdout, "e_module_enable(devmode-tizen) " );
1911 e_module_enable(devmode);
1915 fprintf( stdout, "skip... " );
1918 fprintf( stdout, "\n" );
1922 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find devmode module.\n", __func__, __LINE__ );
1923 devmode = e_module_new("devmode-tizen");
1924 if (devmode) e_module_enable(devmode);
1928 if (prop_data) free (prop_data);
1934 static void _policy_property_window_state_change (Ecore_X_Event_Window_Property *event)
1936 E_Border *bd, *indi_bd;
1938 if (!(bd = e_border_find_by_client_window(event->win))) return;
1940 /* not interested in stolen or invisible borders */
1941 if ((bd->stolen) || (!bd->visible)) return;
1943 /* make sure the border has a name or class */
1944 /* NB: this check is here because some E borders get State Changes
1945 * but do not have a name/class associated with them. Not entirely sure
1946 * which ones they are, but I would guess Managers, Containers, or Zones.
1947 * At any rate, we're not interested in those types of borders */
1948 if ((!bd->client.icccm.name) || (!bd->client.icccm.class)) return;
1950 /* NB: If we have reached this point, then it should be a fullscreen
1951 * border that has toggled fullscreen on/off */
1953 /* if the window is not active window, then it doesn't need to hande indicator */
1954 if (g_active_win != bd->client.win) return;
1956 /* try to get the Indicator on this zone */
1957 if (!(indi_bd = e_illume_border_indicator_get(bd->zone))) return;
1959 /* if we are fullscreen, hide the indicator...else we show it */
1960 /* NB: we could use the e_illume_border_is_fullscreen function here
1961 * but we save ourselves a function call this way */
1962 if ((bd->fullscreen) || (bd->need_fullscreen))
1964 if (indi_bd->visible)
1966 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
1967 e_border_hide(indi_bd, 2);
1972 int indi_show = _policy_border_indicator_state_get(bd);
1975 if (!indi_bd->visible)
1977 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
1978 e_border_show(indi_bd);
1985 static void _policy_property_indicator_geometry_change (Ecore_X_Event_Window_Property *event)
1992 /* make sure this property changed on a zone */
1993 if (!(zone = e_util_zone_window_find(event->win))) return;
1995 /* get the geometry */
1996 if (!(bd = e_illume_border_indicator_get(zone))) return;
2002 /* look for conformant borders */
2003 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2006 if (bd->zone != zone) continue;
2007 if (!e_illume_border_is_conformant(bd)) continue;
2008 /* set indicator geometry on conformant window */
2009 /* NB: This is needed so that conformant apps get told about
2010 * the indicator size/position...else they have no way of
2011 * knowing that the geometry has been updated */
2012 ecore_x_e_illume_indicator_geometry_set(bd->client.win, x, y, w, h);
2016 static void _policy_property_clipboard_geometry_change (Ecore_X_Event_Window_Property *event)
2023 /* make sure this property changed on a zone */
2024 if (!(zone = e_util_zone_window_find(event->win))) return;
2026 ecore_x_e_illume_clipboard_geometry_get(zone->black_win, &x, &y, &w, &h);
2028 /* look for conformant borders */
2029 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2032 if (bd->zone != zone) continue;
2033 if (e_illume_border_is_indicator(bd)) continue;
2034 if (e_illume_border_is_keyboard(bd)) continue;
2035 if (e_illume_border_is_keyboard_sub(bd)) continue;
2036 if (e_illume_border_is_quickpanel(bd)) continue;
2037 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2040 SECURE_SLOGD("[WM] Clipboard geometry set. win:0x%07x, geo(%d,%d,%d,%d)", bd->client.win, x, y, w, h);
2042 ecore_x_e_illume_clipboard_geometry_set(bd->client.win, x, y, w, h);
2046 static void _policy_property_clipboard_state_change (Ecore_X_Event_Window_Property *event)
2051 Ecore_X_Illume_Clipboard_State state;
2053 /* make sure this property changed on a zone */
2054 if (!(zone = e_util_zone_window_find(event->win))) return;
2056 state = ecore_x_e_illume_clipboard_state_get(zone->black_win);
2058 /* look for conformant borders */
2059 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2062 if (bd->zone != zone) continue;
2063 if (e_illume_border_is_indicator(bd)) continue;
2064 if (e_illume_border_is_keyboard(bd)) continue;
2065 if (e_illume_border_is_keyboard_sub(bd)) continue;
2066 if (e_illume_border_is_quickpanel(bd)) continue;
2067 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2070 SECURE_SLOGD("[WM] Clipboard state set. win:0x%07x, state:%d", bd->client.win, state);
2072 ecore_x_e_illume_clipboard_state_set(bd->client.win, state);
2076 static void _policy_property_enlightenment_scale_change (Ecore_X_Event_Window_Property *event)
2081 EINA_LIST_FOREACH(e_manager_list(), ml, man)
2087 if (event->win != man->root) continue;
2088 EINA_LIST_FOREACH(man->containers, cl, con)
2094 EINA_LIST_FOREACH(con->zones, zl, zone)
2095 _policy_zone_layout_update(zone);
2100 static void _policy_property_rotate_win_angle_change (Ecore_X_Event_Window_Property *event)
2103 E_Illume_XWin_Info* xwin_info;
2105 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. win:0x%07x\n", __func__, __LINE__, event->win);
2107 if (!(bd = e_border_find_by_client_window(event->win))) return;
2109 xwin_info = _policy_xwin_info_find (bd->win);
2112 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
2114 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. CALL _policy_change_root_angle_by_border_angle!!! win:0x%07x\n", __func__, __LINE__, bd->client.win);
2115 _policy_change_root_angle_by_border_angle (bd);
2119 bd->changes.pos = 1;
2123 static void _policy_property_indicator_state_change (Ecore_X_Event_Window_Property *event)
2125 E_Border *bd, *indi_bd;
2127 if (!(bd = e_border_find_by_client_window(event->win))) return;
2129 indi_bd = e_illume_border_indicator_get(bd->zone);
2130 if (!indi_bd) return;
2132 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2133 _policy_border_indicator_control(indi_bd);
2136 static void _policy_property_indicator_opacity_change(Ecore_X_Event_Window_Property *event)
2138 E_Border *bd, *indi_bd;
2139 Ecore_X_Window active_win;
2140 Ecore_X_Illume_Indicator_Opacity_Mode mode;
2142 if (!(bd = e_border_find_by_client_window(event->win))) return;
2144 indi_bd = e_illume_border_indicator_get(bd->zone);
2145 if (!indi_bd) return;
2147 active_win = _policy_active_window_get(bd->zone->container->manager->root);
2148 if (active_win == bd->client.win)
2150 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
2151 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
2155 static void _policy_active_win_change(E_Illume_XWin_Info *xwin_info, Ecore_X_Window active_win)
2157 E_Border *active_bd = NULL;
2160 if (!xwin_info) return;
2161 if (!xwin_info->comp_vis) return;
2163 active_bd = e_border_find_by_client_window(active_win);
2165 /* for active/deactive message */
2166 if (active_win != g_active_win)
2169 active_pid = active_bd->client.netwm.pid;
2173 // 1. send deactive event to g_active_win
2174 ecore_x_client_message32_send(g_active_win, E_ILLUME_ATOM_DEACTIVATE_WINDOW,
2175 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2177 // 2. send active event to active_win
2178 ecore_x_client_message32_send(active_win, E_ILLUME_ATOM_ACTIVATE_WINDOW,
2179 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2185 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2187 if ((E_ILLUME_BORDER_IS_IN_DESKTOP(active_bd)) ||
2188 (active_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
2190 e_border_raise(active_bd);
2196 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2199 g_active_win = active_win;
2200 g_active_pid = active_pid;
2205 if (_e_illume_cfg->use_indicator_widget)
2207 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
2208 _policy_border_root_angle_control(active_bd->zone);
2213 indi_bd = e_illume_border_indicator_get(active_bd->zone);
2216 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, active_bd->client.win);
2217 _policy_border_indicator_control(indi_bd);
2221 ILLUME2_TRACE ("[ILLUME2] ACTIVE WINDOW... (%d) active win = 0x%07x HIDE quickpanel\n", __LINE__, active_win);
2222 e_illume_quickpanel_hide(active_bd->zone, 0);
2226 static void _policy_property_active_win_change (Ecore_X_Event_Window_Property *event)
2228 Ecore_X_Window active_win;
2229 E_Border* active_bd;
2230 E_Illume_XWin_Info *xwin_info;
2232 active_win = _policy_active_window_get(event->win);
2233 active_bd = e_border_find_by_client_window(active_win);
2236 xwin_info = _policy_xwin_info_find(active_bd->win);
2240 xwin_info = _policy_xwin_info_find(active_win);
2243 _policy_active_win_change(xwin_info, active_win);
2246 static void _policy_property_win_type_change (Ecore_X_Event_Window_Property *event)
2250 E_Illume_Border_Info* bd_info = NULL;
2253 if (!(bd = e_border_find_by_client_window(event->win))) return;
2255 bd_info = _policy_get_border_info(bd);
2256 if (!bd_info) return;
2258 e_hints_window_type_get (bd);
2260 if (bd_info->win_type == bd->client.netwm.type) return;
2261 bd_info->win_type = bd->client.netwm.type;
2263 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2265 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NOTIFICATION!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2266 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2267 layer = _policy_notification_level_map(bd_info->level);
2268 e_border_layer_set(bd, layer);
2270 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n", __func__, __LINE__, bd->client.win, bd_info->level);
2272 indi_bd = e_illume_border_indicator_get(bd->zone);
2275 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2276 _policy_border_indicator_control(indi_bd);
2279 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2280 _policy_border_uniconify_top_border(bd);
2282 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL)
2284 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NORMAL!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2285 if (bd->layer != POL_APP_LAYER)
2287 if ( (!e_illume_border_is_quickpanel(bd)) &&
2288 (!e_illume_border_is_quickpanel_popup(bd)) &&
2289 (!e_illume_border_is_keyboard(bd)) &&
2290 (!e_illume_border_is_keyboard_sub(bd)))
2292 e_border_layer_set(bd, POL_APP_LAYER);
2296 indi_bd = e_illume_border_indicator_get(bd->zone);
2299 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2300 _policy_border_indicator_control(indi_bd);
2303 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2304 _policy_border_uniconify_top_border(bd);
2306 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY)
2308 bd->client.icccm.request_pos = 1;
2310 if (bd->layer != POL_APP_LAYER)
2311 e_border_layer_set(bd, POL_APP_LAYER);
2316 static void _policy_property_rotate_root_angle_change (Ecore_X_Event_Window_Property *event)
2323 unsigned char *prop_data = NULL;
2326 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);
2327 if( ret && prop_data )
2328 memcpy (&angle, prop_data, sizeof (int));
2330 if (prop_data) free (prop_data);
2332 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. ROOT ANGLE CHANGED... angle = %d. control_win:0x%07x\n", __func__, __LINE__, angle, g_indi_control_win);
2333 bd = e_border_find_by_client_window(g_indi_control_win);
2335 if (bd) zone = bd->zone;
2336 else zone = e_util_container_zone_number_get (0, 0);
2340 // send client message to all visible windows
2341 if (g_root_angle != angle)
2343 indi_bd = e_illume_border_indicator_get(zone);
2346 _policy_indicator_angle_change (indi_bd, angle);
2352 EINA_LIST_FOREACH(e_border_client_list(), l, bd_temp)
2354 if (!bd_temp) continue;
2355 if (!bd_temp->visible && !bd_temp->iconic)
2357 if (!e_illume_border_is_keyboard(bd_temp))
2361 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win = 0x%07x.. SEND client Event with angle = %d\n", __func__, __LINE__, bd_temp->client.win, angle);
2362 ecore_x_client_message32_send (bd_temp->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
2363 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, angle, g_indi_control_win, 0, 0, 0);
2366 if (_e_illume_cfg->use_indicator_widget)
2368 E_Illume_Quickpanel *qp;
2369 qp = e_illume_quickpanel_by_zone_get(zone);
2371 _policy_layout_quickpanel_rotate(qp, angle);
2374 e_illume_util_hdmi_rotation (event->win, angle);
2378 g_root_angle = angle;
2381 static void _policy_property_notification_level_change (Ecore_X_Event_Window_Property *event)
2384 0. Check if border is exist or not
2385 1. Check if a window is notification or not
2386 2. Get and Set level
2389 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... E_ILLUME_ATOM_NOTIFICATION_LEVEL property!!! win = 0x%07x\n", __func__, __LINE__, event->win);
2393 E_Illume_Border_Info *bd_info = NULL;
2397 if (!(bd = e_border_find_by_client_window(event->win)))
2399 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... Win (0x%07x) doesn't have border... So return..\n", __func__, __LINE__, event->win);
2403 bd_info = _policy_get_border_info(bd);
2404 if (!bd_info) return;
2407 if (!e_illume_border_is_notification (bd))
2409 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);
2414 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2415 layer = _policy_notification_level_map(bd_info->level);
2418 e_border_layer_set(bd, layer);
2419 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
2420 __func__, __LINE__, bd->client.win, bd_info->level);
2423 indi_bd = e_illume_border_indicator_get(bd->zone);
2426 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2427 _policy_border_indicator_control(indi_bd);
2430 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2431 _policy_border_uniconify_top_border(bd);
2434 static void _policy_property_overlay_win_change (Ecore_X_Event_Window_Property *event)
2438 unsigned char* prop_data = NULL;
2440 ret = ecore_x_window_prop_property_get (event->win, E_ILLUME_ATOM_OVERAY_WINDOW, ECORE_X_ATOM_WINDOW, 32, &prop_data, &count);
2441 if( ret && prop_data )
2442 memcpy (&_e_overlay_win, prop_data, sizeof (ECORE_X_ATOM_WINDOW));
2444 if (prop_data) free (prop_data);
2446 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d)... OVERAY_WINDOW:0x%07x\n", __func__, __LINE__, _e_overlay_win);
2447 _policy_xwin_info_delete (_e_overlay_win);
2450 static int _policy_property_window_opaque_get (Ecore_X_Window win)
2455 unsigned char* prop_data = NULL;
2457 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_WINDOW_OPAQUE, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
2458 if( ret && prop_data )
2459 memcpy (&is_opaque, prop_data, sizeof (ECORE_X_ATOM_CARDINAL));
2461 if (prop_data) free (prop_data);
2466 static void _policy_property_window_opaque_change (Ecore_X_Event_Window_Property *event)
2469 E_Illume_Border_Info* bd_info;
2471 if (!(bd = e_border_find_by_client_window(event->win))) return;
2474 bd_info = _policy_get_border_info (bd);
2475 if (!bd_info) return;
2477 // set current property
2478 bd_info->opaque = _policy_property_window_opaque_get (event->win);
2480 // visibility is changed
2481 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
2482 _g_visibility_changed = EINA_TRUE;
2486 _policy_property_illume_window_state_change(Ecore_X_Event_Window_Property *event)
2490 if (!(bd = e_border_find_by_client_window(event->win))) return;
2491 if (bd->stolen) return;
2493 unsigned int state = ecore_x_e_illume_window_state_get(event->win);
2494 _policy_border_illume_window_state_change(bd, state);
2498 _policy_border_illume_window_state_change(E_Border *bd, unsigned int state)
2503 if (bd->client.illume.win_state.state == state) return;
2505 ELBF(ELBT_ILLUME, 0, bd->client.win, "SET WIN_STATE %d->%d",
2506 bd->client.illume.win_state.state, state);
2508 bd->client.illume.win_state.state = state;
2511 case ECORE_X_ILLUME_WINDOW_STATE_FLOATING:
2512 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_ADD);
2514 if (_e_illume_cfg->use_force_iconify)
2515 _policy_border_uniconify_below_borders(bd);
2517 bd->client.icccm.request_pos = EINA_TRUE;
2518 bd->lock_user_size = 0;
2519 bd->lock_user_location = 0;
2523 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
2525 indi_bd = e_illume_border_indicator_get(bd->zone);
2528 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2529 _policy_border_indicator_control(indi_bd);
2532 if (!eina_list_data_find(dep_rot.list, bd))
2534 int prev_ang = _prev_angle_get(bd->client.win);
2536 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
2538 dep_rot.list = eina_list_append(dep_rot.list, bd);
2541 bd->client.e.state.rot.curr = prev_ang;
2543 if (dep_rot.ang != bd->client.e.state.rot.curr)
2544 e_border_rotation_set(bd, dep_rot.ang);
2548 case ECORE_X_ILLUME_WINDOW_STATE_NORMAL:
2549 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_REMOVE);
2551 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
2553 bd->lock_user_size = 1;
2554 bd->lock_user_location = 1;
2556 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
2561 bd->client.icccm.request_pos = EINA_FALSE;
2563 indi_bd = e_illume_border_indicator_get(bd->zone);
2566 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2567 _policy_border_indicator_control(indi_bd);
2570 if (eina_list_data_find(dep_rot.list, bd) == bd)
2572 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_NORMAL;
2573 dep_rot.list = eina_list_remove(dep_rot.list, bd);
2577 bd->changes.size = 1;
2578 bd->changes.pos = 1;
2583 _policy_border_illume_handlers_add(E_Illume_Border_Info *bd_info)
2585 if (!bd_info) return;
2586 if (bd_info->handlers) return;
2588 bd_info->handlers = eina_list_append(bd_info->handlers,
2589 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
2590 _policy_border_cb_mouse_up, bd_info));
2591 bd_info->handlers = eina_list_append(bd_info->handlers,
2592 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
2593 _policy_border_cb_mouse_move, bd_info));
2597 _policy_border_illume_handlers_remove(E_Illume_Border_Info *bd_info)
2599 Ecore_Event_Handler *hdl;
2601 if (!bd_info) return;
2602 if (!bd_info->handlers) return;
2604 EINA_LIST_FREE(bd_info->handlers, hdl)
2605 ecore_event_handler_del(hdl);
2609 _policy_border_cb_mouse_down(void *data,
2610 int type __UNUSED__,
2613 Ecore_Event_Mouse_Button *ev;
2614 E_Illume_Border_Info *bd_info;
2617 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2620 bd = bd_info->border;
2622 if (ev->window != bd->event_win &&
2623 ev->event_window != bd->event_win)
2624 return ECORE_CALLBACK_PASS_ON;
2626 if (bd_info->resize_req.mouse.down)
2627 return ECORE_CALLBACK_PASS_ON;
2629 bd_info->resize_req.mouse.down = 1;
2631 bd_info->resize_req.mouse.dx = bd->x - ev->root.x;
2632 bd_info->resize_req.mouse.dy = bd->y - ev->root.y;
2634 bd_info->resize_req.mouse.x = bd->x;
2635 bd_info->resize_req.mouse.y = bd->y;
2638 ecore_x_mouse_down_send(bd->client.win, ev->x, ev->y, ev->buttons);
2640 return ECORE_CALLBACK_PASS_ON;
2644 _resize_rect_geometry_get(E_Illume_Border_Info *bd_info,
2645 Evas_Coord_Rectangle *r,
2649 E_Resizable_Area_Info *area)
2652 int x = 0, y = 0, w = 0, h = 0;
2658 bd = bd_info->border;
2660 e_illume_border_min_get(bd, &mw, &mh);
2661 // min_size is workaround adjustement due to some window's wrong w h after rotation is changed.
2662 if(mw < min_size) mw = min_size;
2663 if(mh < min_size) mh = min_size;
2665 if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BR)
2667 switch (bd_info->resize_req.angle)
2670 cx = bd->x; cy = bd->y;
2671 x = bd->x; y = bd->y;
2672 w = ev_x - bd->x; h = ev_y - bd->y;
2675 cx = bd->x; cy = bd->y + bd->h;
2676 x = bd->x; y = ev_y;
2677 w = ev_x - x; h = (bd->y + bd->h) - y;
2680 cx = bd->x + bd->w; cy = bd->y + bd->h;
2682 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2685 cx = bd->x + bd->w; cy = bd->y;
2686 x = ev_x; y = bd->y;
2687 w = (bd->x + bd->w) - x; h = ev_y - y;
2693 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TL)
2695 switch (bd_info->resize_req.angle)
2698 cx = bd->x + bd->w; cy = bd->y + bd->h;
2700 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2703 cx = bd->x + bd->w; cy = bd->y;
2704 x = ev_x; y = bd->y;
2705 w = (bd->x + bd->w) - x; h = ev_y - y;
2708 cx = bd->x; cy = bd->y;
2709 x = bd->x; y = bd->y;
2710 w = ev_x - bd->x; h = ev_y - bd->y;
2713 cx = bd->x; cy = bd->y + bd->h;
2714 x = bd->x; y = ev_y;
2715 w = ev_x - x; h = (bd->y + bd->h) - y;
2721 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TR)
2723 switch (bd_info->resize_req.angle)
2726 cx = bd->x; cy = bd->y + bd->h;
2727 x = bd->x; y = ev_y;
2728 w = ev_x - x; h = (bd->y + bd->h) - y;
2731 cx = bd->x + bd->w; cy = bd->y + bd->h;
2733 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2736 cx = bd->x + bd->w; cy = bd->y;
2737 x = ev_x; y = bd->y;
2738 w = (bd->x + bd->w) - x; h = ev_y - y;
2741 cx = bd->x; cy = bd->y;
2742 x = bd->x; y = bd->y;
2743 w = ev_x - bd->x; h = ev_y - bd->y;
2749 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BL)
2751 switch (bd_info->resize_req.angle)
2754 cx = bd->x + bd->w; cy = bd->y;
2755 x = ev_x; y = bd->y;
2756 w = (bd->x + bd->w) - x; h = ev_y - y;
2759 cx = bd->x; cy = bd->y;
2760 x = bd->x; y = bd->y;
2761 w = ev_x - bd->x; h = ev_y - bd->y;
2764 cx = bd->x; cy = bd->y + bd->h;
2765 x = bd->x; y = ev_y;
2766 w = ev_x - x; h = (bd->y + bd->h) - y;
2769 cx = bd->x + bd->w; cy = bd->y + bd->h;
2771 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2777 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_R)
2779 switch (bd_info->resize_req.angle)
2782 cx = bd->x; cy = bd->y;
2783 x = bd->x; y = bd->y;
2784 w = ev_x - bd->x; h = bd->h;
2787 cx = bd->x; cy = bd->y + bd->h;
2788 x = bd->x; y = ev_y;
2789 w = bd->w; h = (bd->y + bd->h) - y;
2792 cx = bd->x + bd->w; cy = bd->y + bd->h;
2794 w = (bd->x + bd->w) - x; h = bd->h;
2797 cx = bd->x + bd->w; cy = bd->y;
2798 x = ev_x; y = bd->y;
2799 w = bd->w; h = ev_y - y;
2805 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_L)
2807 switch (bd_info->resize_req.angle)
2810 cx = bd->x + bd->w; cy = bd->y + bd->h;
2811 x = ev_x; y = bd->y;
2812 w = (bd->x + bd->w) - x; h = bd->h;
2815 cx = bd->x + bd->w; cy = bd->y;
2816 x = ev_x; y = bd->y;
2817 w = bd->w; h = ev_y - y;
2820 cx = bd->x; cy = bd->y;
2821 x = bd->x; y = bd->y;
2822 w = ev_x - bd->x; h = bd->h;
2825 cx = bd->x; cy = bd->y + bd->h;
2826 x = bd->x; y = ev_y;
2827 w = bd->w; h = (bd->y + bd->h) - y;
2833 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_T)
2835 switch (bd_info->resize_req.angle)
2838 cx = bd->x + bd->w; cy = bd->y + bd->h;
2839 x = bd->x; y = ev_y;
2840 w = bd->w; h = (bd->y + bd->h) - y;
2843 cx = bd->x + bd->w; cy = bd->y;
2844 x = ev_x; y = bd->y;
2845 w = (bd->x + bd->w) - x; h = bd->h;
2848 cx = bd->x; cy = bd->y;
2849 x = bd->x; y = bd->y;
2850 w = bd->w; h = ev_y - bd->y;
2853 cx = bd->x + bd->w; cy = bd->y;
2854 x = bd->x; y = bd->y;
2855 w = ev_x - bd->x; h = bd->h;
2861 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_B)
2863 switch (bd_info->resize_req.angle)
2866 cx = bd->x; cy = bd->y;
2867 x = bd->x; y = bd->y;
2868 w = bd->w; h = ev_y - bd->y;
2871 cx = bd->x + bd->w; cy = bd->y;
2872 x = bd->x; y = bd->y;
2873 w = ev_x - bd->x; h = bd->h;
2876 cx = bd->x + bd->w; cy = bd->y + bd->h;
2877 x = bd->x; y = ev_y;
2878 w = bd->w; h = (bd->y + bd->h) - y;
2881 cx = bd->x + bd->w; cy = bd->y;
2882 x = ev_x; y = bd->y;
2883 w = (bd->x + bd->w) - x; h = bd->h;
2892 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... ERROR... direction(%d) is not defined!!!\n", __func__, __LINE__, direction);
2896 if (bd->zone->w > bd->zone->h)
2897 max_size = bd->zone->h;
2899 max_size = bd->zone->w;
2905 area->min_width = mw;
2906 area->min_height = mh;
2907 area->max_width = max_size;
2908 area->max_height = max_size;
2913 if (w > max_size) w = max_size;
2914 if (h > max_size) h = max_size;
2916 if ((x + w) > (bd->x + w)) x = cx - w;
2917 if ((y + h) > (bd->y + h)) y = cy - h;
2919 if ((cx - x) > max_size)
2921 if ((cy - y) > max_size)
2924 x = x - bd->zone->x;
2925 y = y - bd->zone->y;
2934 _policy_border_cb_mouse_up(void *data,
2935 int type __UNUSED__,
2938 Ecore_Event_Mouse_Button *ev;
2939 E_Illume_Border_Info *bd_info;
2942 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2945 bd = bd_info->border;
2947 if (ev->window != bd->event_win &&
2948 ev->event_window != bd->event_win)
2949 return ECORE_CALLBACK_PASS_ON;
2951 if (!bd_info->resize_req.mouse.down)
2952 return ECORE_CALLBACK_PASS_ON;
2954 bd->lock_user_location = 0;
2955 e_grabinput_release(bd->event_win, bd->event_win);
2957 if (bd_info->resize_req.mouse.resize)
2959 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2960 Evas_Coord_Rectangle r;
2961 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, NULL);
2963 bd_info->resize_req.direction = ECORE_X_NETWM_DIRECTION_CANCEL;
2964 bd_info->resize_req.mouse.x = r.x + bd->zone->x;
2965 bd_info->resize_req.mouse.y = r.y + bd->zone->y;
2966 bd_info->resize_req.mouse.w = r.w;
2967 bd_info->resize_req.mouse.h = r.h;
2968 bd_info->resize_req.need_change = 1;
2969 bd->changes.pos = 1;
2970 bd->changes.size = 1;
2972 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
2976 printf("[IL2] DEL OBJ in UP\n");
2981 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2982 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
2983 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
2986 bd_info->resize_req.mouse.down = 0;
2987 bd_info->resize_req.mouse.resize = 0;
2988 bd_info->resize_req.mouse.locked = 0;
2990 /* set property on this border to say we are done dragging */
2991 ecore_x_e_illume_drag_set(bd->client.win, 0);
2993 /* set property on zone window that a drag is finished */
2994 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
2996 ecore_x_window_raise(bd->client.shell_win);
2997 _policy_border_illume_handlers_remove(bd_info);
2999 return ECORE_CALLBACK_PASS_ON;
3003 _policy_border_cb_mouse_move(void *data,
3004 int type __UNUSED__,
3007 Ecore_Event_Mouse_Move *ev;
3008 E_Illume_Border_Info *bd_info;
3012 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3015 bd = bd_info->border;
3017 if (ev->window != bd->event_win &&
3018 ev->event_window != bd->event_win)
3019 return ECORE_CALLBACK_PASS_ON;
3021 if (!bd_info->resize_req.mouse.down)
3022 return ECORE_CALLBACK_PASS_ON;
3024 if (bd_info->resize_req.mouse.resize)
3026 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);
3027 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
3028 if (!o) return ECORE_CALLBACK_PASS_ON;
3030 Evas_Coord_Rectangle r;
3031 E_Resizable_Area_Info area;
3033 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, &area);
3034 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);
3036 rect = edje_object_part_object_get(o, "opacity_rect");
3038 if((r.w <= area.min_width && r.h <= area.min_height)
3039 || (r.w >= area.max_width && r.h >= area.max_height))
3041 edje_object_signal_emit(o, "resize,notavail", "illume2");
3042 evas_object_color_set(rect, 64, 64, 64, 64);
3046 edje_object_signal_emit(o, "resize,normal", "illume2");
3047 evas_object_color_set(rect, 255, 255, 255, 255);
3049 if(area.x_dist < area.min_width && area.y_dist < area.min_height)
3052 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;
3058 tmp = (int)(128*( (double)tmp/10 + 1));
3059 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3061 if (area.x_dist > area.max_width && area.y_dist > area.max_height)
3064 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;
3070 tmp = (int)(128*( (double)tmp/10 + 1));
3071 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3074 evas_object_move(o, r.x, r.y);
3075 evas_object_resize(o, r.w, r.h);
3079 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3080 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
3081 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
3082 bd->changes.pos = 1;
3083 bd->changed = EINA_TRUE;
3086 return ECORE_CALLBACK_PASS_ON;
3090 _policy_property_change(Ecore_X_Event_Window_Property *event)
3092 // printf("Property Change\n");
3094 /* we are interested in state changes here */
3095 if (event->atom == ECORE_X_ATOM_NET_WM_STATE)
3097 _policy_property_window_state_change (event);
3099 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY)
3101 _policy_property_indicator_geometry_change (event);
3103 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
3105 _policy_property_clipboard_geometry_change (event);
3107 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
3109 _policy_property_clipboard_state_change (event);
3111 else if (event->atom == ATM_ENLIGHTENMENT_SCALE)
3113 _policy_property_enlightenment_scale_change (event);
3115 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
3117 _policy_property_rotate_win_angle_change (event);
3119 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
3121 _policy_property_indicator_state_change (event);
3123 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE)
3125 _policy_property_indicator_opacity_change(event);
3127 else if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
3129 _policy_property_active_win_change (event);
3131 else if (event->atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
3133 _policy_property_win_type_change (event);
3135 else if (event->atom == E_ILLUME_ATOM_STACK_DISPLAY)
3137 _policy_border_list_print (event->win);
3139 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
3141 _policy_property_rotate_root_angle_change (event);
3143 else if (event->atom == E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3145 _policy_property_notification_level_change (event);
3147 /* for visibility */
3148 else if (event->atom == E_ILLUME_ATOM_OVERAY_WINDOW)
3150 _policy_property_overlay_win_change (event);
3152 else if (event->atom == E_ILLUME_ATOM_WINDOW_OPAQUE)
3154 _policy_property_window_opaque_change (event);
3156 else if (event->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
3158 _policy_property_illume_window_state_change(event);
3160 /* enable/disable composite module - 100320 yigl */
3161 #ifdef COMP_MODULE_CONTROL
3162 else if (event->atom == E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3164 _policy_property_composite_module_change (event);
3167 /* enable/disable backkey module - 130610 seongwon1.cho */
3168 #ifdef BACKKEY_MODULE_CONTROL
3169 else if (event->atom == E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3171 _policy_property_backkey_module_change (event);
3174 /* enable/disable devmode module - 130610 seongwon1.cho */
3175 #ifdef DEVMODE_MODULE_CONTROL
3176 else if (event->atom == E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3178 _policy_property_devmode_module_change (event);
3181 else if (event->atom == E_INDICATOR_CMD_WIN)
3183 _policy_property_indicator_cmd_win_change(event);
3185 else if (event->atom == E_ACTIVE_INDICATOR_WIN)
3187 _policy_property_active_indicator_win_change(event);
3193 _policy_border_list_print (Ecore_X_Window win)
3195 Eina_List* border_list;
3198 E_Border* temp_bd = NULL;
3200 E_Illume_Print_Info info;
3201 unsigned char* prop_data = NULL;
3205 memset (info.file_name, 0, 256);
3207 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_STACK_DISPLAY, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
3208 if( ret && prop_data )
3209 memcpy (&info, prop_data, sizeof (E_Illume_Print_Info));
3211 if (prop_data) free (prop_data);
3213 out = fopen (info.file_name, "w+");
3214 if (out == NULL) out = stderr;
3216 if ((info.type & PT_STACK) == PT_STACK)
3218 border_list = e_border_client_list();
3222 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3223 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3224 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3226 EINA_LIST_FOREACH(border_list, l, bd)
3229 if (temp_bd == NULL) temp_bd = bd;
3231 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3232 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3234 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3238 E_Illume_Border_Info* bd_info;
3239 if (e_border_info_list)
3242 fprintf (out, "--------------------------------ILLUME BORDER INFO------------------------------------------------------------------\n" );
3243 fprintf (out, " No Border ClientWin w h x y isKBD layer level desk WinName\n" );
3244 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3246 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
3251 int desk_x=0, desk_y=0;
3252 if (!bd_info) continue;
3254 bd = bd_info->border;
3257 for (x = 0; x < zone->desk_x_count; x++)
3259 for (y = 0; y < zone->desk_y_count; y++)
3261 if (bd->desk == zone->desks[x + zone->desk_x_count * y])
3269 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %3i %5i %5i (%d,%d) %-30s \n",
3270 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,
3271 bd_info->border->client.vkbd.vkbd, bd_info->border->layer, bd_info->level, desk_x, desk_y, bd_info->border->client.netwm.name);
3273 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3277 if (temp_bd == NULL) goto finish;
3281 fprintf (out, "-------------------------------- E17 STACK INFO--------------------------------------------\n" );
3282 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3283 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3286 bl = e_container_border_list_last(temp_bd->zone->container);
3287 while ((bd = e_container_border_list_prev(bl)))
3289 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3290 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3292 e_container_border_list_free(bl);
3293 fprintf (out, "---------------------------------------------------------------------------------------------\n\n" );
3296 /* for visibility */
3297 if ((info.type & PT_VISIBILITY) == PT_VISIBILITY)
3299 Eina_Inlist* xwin_info_list;
3300 E_Illume_XWin_Info *xwin_info;
3302 xwin_info_list = _e_illume_xwin_info_list;
3306 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3307 fprintf (out, " No Win w h x y depth viewable visibility comp_vis iconify by_wm is_border(Client Win)\n" );
3308 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3310 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
3312 if (xwin_info->bd_info)
3314 if (xwin_info->bd_info->border)
3316 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i %5i %5i yes(0x%07x)\n",
3317 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3318 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);
3322 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3323 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3324 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3329 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3330 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3331 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3334 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3342 fprintf (out, "--------------------------------GLOBAL INFO--------------------------------------------------\n" );
3343 fprintf (out, "g_rotated_win:0x%07x (g_root_angle:%d)\n", g_rotated_win, g_root_angle);
3344 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));
3345 fprintf (out, "g_indi_control_win:0x%07x\n", g_indi_control_win);
3346 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3354 ecore_x_client_message32_send (ecore_x_window_root_first_get(), E_ILLUME_ATOM_STACK_DISPLAY_DONE,
3355 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3361 _policy_window_rotation_angle_get(Ecore_X_Window win)
3364 int ret, size_ret = 0;
3365 unsigned long num_ret = 0, bytes = 0;
3366 unsigned char *prop_ret = NULL;
3367 Ecore_X_Display *dpy;
3370 dpy = ecore_x_display_get();
3373 win = ecore_x_window_root_first_get();
3375 ret = XGetWindowProperty(dpy, win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, 0, LONG_MAX,
3376 False, ECORE_X_ATOM_CARDINAL, &type_ret, &size_ret,
3377 &num_ret, &bytes, &prop_ret);
3379 if (ret == ECORE_X_ERROR_CODE_SUCCESS)
3381 if (prop_ret && num_ret)
3383 angle = ((int *)prop_ret)[0];
3384 if (angle % 90) angle = -1;
3394 if (prop_ret) XFree(prop_ret);
3400 static Ecore_X_Window
3401 _policy_active_window_get(Ecore_X_Window root)
3406 ret = ecore_x_window_prop_xid_get(root,
3407 ECORE_X_ATOM_NET_ACTIVE_WINDOW,
3408 ECORE_X_ATOM_WINDOW,
3411 if ((ret == 1) && win)
3418 _policy_border_indicator_state_get(E_Border *bd)
3420 Ecore_X_Illume_Indicator_State state;
3423 state = ecore_x_e_illume_indicator_state_get(bd->client.win);
3424 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
3426 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
3434 static void _policy_layout_quickpanel_rotate (E_Illume_Quickpanel* qp, int angle)
3438 E_Illume_Quickpanel_Info *panel;
3444 // pass 1 - resize window
3445 // It caused abnormal size of quickpanel window and abnormal rotation state.
3446 // disable it for now.
3448 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3450 if (!panel) continue;
3451 if (panel->angle == angle) continue;
3453 if (panel->angle > angle) diff = panel->angle - angle;
3454 else diff = angle - panel->angle;
3458 if (angle == 0 || angle == 180)
3460 if (diff == 90 || diff == 270)
3463 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);
3464 _policy_border_resize (bd, bd->zone->w, temp);
3467 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Portrait quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3471 if (diff == 90 || diff == 270)
3474 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);
3475 _policy_border_resize (bd, temp, bd->zone->h);
3478 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Landscape quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3483 // pass 2 - send client message
3484 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3486 if (!panel) continue;
3487 if (panel->angle == angle) continue;
3489 if (panel->angle > angle) diff = panel->angle - angle;
3490 else diff = angle - panel->angle;
3494 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] SEND CLIENT MESSAGE TO QUICKPANEL!!!!(%d) win:0x%07x, angle = %d\n", __LINE__, bd->client.win, angle);
3495 ecore_x_client_message32_send (bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
3496 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3499 panel->angle = angle;
3504 _policy_window_focus_in(Ecore_X_Event_Window_Focus_In *event)
3506 ILLUME2_TRACE("[ILLUME2-FOCUS] _policy_window_focus_in... win = 0x%07x\n", event->win);
3510 if (e_config->focus_policy == E_FOCUS_CLICK) return;
3512 if (!(bd = e_border_find_by_client_window(event->win))) return;
3514 if (e_illume_border_is_indicator (bd))
3520 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3523 EINA_LIST_FOREACH(man->containers, cl, con)
3528 // send focus to top-level window.
3529 bl = e_container_border_list_last(con);
3530 while ((temp_bd = e_container_border_list_prev(bl)))
3532 if (temp_bd->client.icccm.accepts_focus && temp_bd->visible)
3534 /* focus the border */
3535 e_border_focus_set(temp_bd, 1, 1);
3536 e_container_border_list_free(bl);
3540 e_container_border_list_free(bl);
3547 void _policy_border_stack_change (E_Border* bd, E_Border* sibling, int stack_mode)
3549 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);
3551 if (bd->layer != sibling->layer)
3553 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);
3557 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);
3558 if (stack_mode == E_ILLUME_STACK_ABOVE)
3560 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);
3561 e_border_stack_above (bd, sibling);
3563 else if (stack_mode == E_ILLUME_STACK_BELOW)
3565 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);
3566 e_border_stack_below (bd, sibling);
3571 int _policy_atom_init (void)
3573 /* Notification Level Atom */
3574 E_ILLUME_ATOM_NOTIFICATION_LEVEL = ecore_x_atom_get ("_E_ILLUME_NOTIFICATION_LEVEL");
3575 if (!E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3577 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_NOTIFICATION_LEVEL Atom...\n");
3581 /* for active/deactive message */
3582 E_ILLUME_ATOM_ACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_ACTIVATE_WINDOW");
3583 if (!E_ILLUME_ATOM_ACTIVATE_WINDOW)
3585 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_ACTIVATE_WINDOW Atom...\n");
3589 E_ILLUME_ATOM_DEACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_DEACTIVATE_WINDOW");
3590 if (!E_ILLUME_ATOM_DEACTIVATE_WINDOW)
3592 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_DEACTIVATE_WINDOW Atom...\n");
3596 /* for visibility */
3597 E_ILLUME_ATOM_OVERAY_WINDOW = ecore_x_atom_get ("_E_COMP_OVERAY_WINDOW");
3598 if (!E_ILLUME_ATOM_OVERAY_WINDOW)
3600 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_OVERAY_WINDOW Atom...\n");
3604 E_ILLUME_ATOM_STACK_DISPLAY = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK");
3605 if (!E_ILLUME_ATOM_STACK_DISPLAY)
3607 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK Atom...\n");
3611 E_ILLUME_ATOM_STACK_DISPLAY_DONE = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK_DONE");
3612 if (!E_ILLUME_ATOM_STACK_DISPLAY_DONE)
3614 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK_DONE Atom...\n");
3618 E_ILLUME_ATOM_WINDOW_OPAQUE = ecore_x_atom_get ("_E_ILLUME_WINDOW_REGION_OPAQUE");
3619 if (!E_ILLUME_ATOM_WINDOW_OPAQUE)
3621 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_WINDOW_REGION_OPAQUE Atom...\n");
3625 #ifdef COMP_MODULE_CONTROL
3626 E_ILLUME_ATOM_COMP_MODULE_ENABLED = ecore_x_atom_get ("_E_COMP_ENABLE");
3627 if(!E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3629 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_ENABLE Atom...\n");
3634 #ifdef BACKKEY_MODULE_CONTROL
3635 E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED = ecore_x_atom_get ("_E_BACKKEY_ENABLE");
3636 if(!E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3638 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_BACKKEY_ENABLE Atom...\n");
3643 #ifdef DEVMODE_MODULE_CONTROL
3644 E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED = ecore_x_atom_get ("_E_DEVMODE_ENABLE");
3645 if(!E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3647 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_DEVMODE_ENABLE Atom...\n");
3652 E_INDICATOR_CMD_WIN = ecore_x_atom_get("_E_INDICATOR_CMD_WIN");
3653 if (!E_INDICATOR_CMD_WIN)
3655 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_INDICATOR_CMD_WIN Atom...\n");
3659 E_ACTIVE_INDICATOR_WIN = ecore_x_atom_get("_E_ACTIVE_INDICATOR_WIN");
3660 if (!E_ACTIVE_INDICATOR_WIN)
3662 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ACTIVE_INDICATOR_WIN Atom...\n");
3670 int _policy_init (void)
3675 /* for visibility */
3676 _e_illume_xwin_info_hash = eina_hash_string_superfast_new(NULL);
3677 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3679 _policy_manage_xwins (man);
3681 dep_rot.root = man->root;
3682 dep_rot.refer.cmd_win = _policy_indicator_cmd_win_get(dep_rot.root);
3683 if (dep_rot.refer.cmd_win)
3684 dep_rot.refer.active_win = _policy_active_indicator_win_get(dep_rot.refer.cmd_win);
3688 if (!_policy_atom_init())
3690 eina_hash_free (_e_illume_xwin_info_hash);
3694 /* for visibility */
3695 _e_illume_msg_handler = e_msg_handler_add(_policy_msg_handler, NULL);
3701 void _policy_fin (void)
3703 /* for visibility */
3704 if (_e_illume_msg_handler) e_msg_handler_del(_e_illume_msg_handler);
3705 eina_hash_free (_e_illume_xwin_info_hash);
3709 _policy_compare_cb_border (E_Illume_Border_Info* data1, E_Illume_Border_Info* data2)
3713 if (data1->border == data2->border)
3721 static E_Illume_Border_Info*
3722 _policy_get_border_info (E_Border* bd)
3724 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3725 E_Illume_Border_Info tmp_win;
3726 tmp_win.border = bd;
3727 return (E_Illume_Border_Info*) eina_list_search_unsorted (
3728 e_border_info_list, EINA_COMPARE_CB(_policy_compare_cb_border), &tmp_win);
3732 static E_Illume_Border_Info* _policy_add_border_info_list (E_Border* bd)
3734 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3736 if (e_object_is_del(E_OBJECT(bd))) return NULL;
3738 E_Illume_Border_Info* bd_info = (E_Illume_Border_Info*) calloc (1, sizeof (E_Illume_Border_Info));
3741 fprintf (stderr, "[ILLUME2] Critical Error... Fail to create memory... (%s:%d)\n", __func__, __LINE__);
3744 bd_info->pid = bd->client.netwm.pid;
3745 bd_info->border = bd;
3747 bd_info->level = 50;
3749 bd_info->opaque = _policy_property_window_opaque_get(bd->client.win);
3751 // could find bd_info of ev->stack.. there is no bd_info yet...
3752 Eina_List *l = NULL;
3753 E_Illume_Border_Info *temp_bd_info = NULL;
3755 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
3757 if (!temp_bd_info) continue;
3758 if (bd_info->border->layer >= temp_bd_info->border->layer)
3764 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
3765 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);
3769 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
3770 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, bd->client.win);
3777 static void _policy_delete_border_info_list (E_Border* bd)
3779 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3780 E_Illume_Border_Info* bd_info = _policy_get_border_info (bd);
3782 if (bd_info == NULL)
3784 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);
3788 _policy_border_illume_handlers_remove(bd_info);
3790 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
3791 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... remove bd(win:0x%07x)\n", __func__, __LINE__, bd->client.win);
3797 _policy_zone_layout_app_layer_check (E_Border* bd)
3799 Ecore_X_Window_Type *types = NULL;
3800 E_Illume_Border_Info *bd_info;
3803 if (!bd) return POL_APP_LAYER;
3805 bd_info = _policy_get_border_info(bd);
3806 if (!bd_info) return POL_APP_LAYER;
3808 layer = POL_APP_LAYER;
3810 num = ecore_x_netwm_window_types_get(bd->client.win, &types);
3814 for (i=0; i< num; i++)
3816 if (types[i] == ECORE_X_WINDOW_TYPE_NOTIFICATION)
3817 layer = _policy_notification_level_map(bd_info->level);
3823 if (bd->client.netwm.state.stacking == E_STACKING_BELOW)
3825 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is BELOW state.. Change layer to 50\n", __func__, __LINE__, bd->client.win);
3826 layer = POL_STATE_BELOW_LAYER;
3828 else if (bd->client.netwm.state.stacking == E_STACKING_ABOVE)
3830 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is ABOVE state.. Change layer to 150\n", __func__, __LINE__, bd->client.win);
3831 layer = POL_STATE_ABOVE_LAYER;
3839 _policy_zone_layout_app_layer_set (E_Border* bd, int new_layer)
3843 /* if a window sets transient_for property, it sets same layer to parent window */
3844 if (bd->client.icccm.transient_for != 0)
3846 E_Border *bd_parent = NULL;
3847 bd_parent = e_border_find_by_client_window (bd->client.icccm.transient_for);
3850 if (bd->layer != bd_parent->layer)
3851 e_border_layer_set (bd, bd_parent->layer);
3856 if (bd->layer != new_layer)
3857 e_border_layer_set(bd, new_layer);
3862 _policy_zone_layout_app_single_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
3866 Eina_Bool resize = EINA_FALSE;
3867 Eina_Bool move = EINA_FALSE;
3869 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);
3871 bd = bd_info->border;
3874 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
3878 if (bd->moving && !bd->client.illume.win_state.state)
3880 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... Cancel moving... win:0x%07x, bd->moving:%d\n", __func__, __LINE__, bd->client.win, bd->moving);
3881 e_border_move_cancel();
3884 if ((!bd->new_client) && (!bd->visible)) return;
3886 layer = _policy_zone_layout_app_layer_check (bd);
3888 /* check if user defined position */
3889 if (bd->client.icccm.request_pos)
3891 if (bd->client.illume.win_state.state)
3893 if (bd_info->resize_req.need_change)
3895 if ((bd->x != bd_info->resize_req.mouse.x) ||
3896 (bd->y != bd_info->resize_req.mouse.y))
3899 if ((bd->w != bd_info->resize_req.mouse.w) ||
3900 (bd->h != bd_info->resize_req.mouse.h))
3905 e_border_move_resize(bd,
3906 bd_info->resize_req.mouse.x,
3907 bd_info->resize_req.mouse.y,
3908 bd_info->resize_req.mouse.w,
3909 bd_info->resize_req.mouse.h);
3913 _policy_border_move(bd,
3914 bd_info->resize_req.mouse.x,
3915 bd_info->resize_req.mouse.y);
3919 _policy_border_resize(bd,
3920 bd_info->resize_req.mouse.w,
3921 bd_info->resize_req.mouse.h);
3924 bd_info->resize_req.need_change = 0;
3925 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);
3928 if (bd_info->resize_req.mouse.down &&
3929 bd_info->resize_req.mouse.locked)
3931 if ((bd->x != bd_info->resize_req.mouse.x) ||
3932 (bd->y != bd_info->resize_req.mouse.y))
3933 _policy_border_move(bd,
3934 bd_info->resize_req.mouse.x,
3935 bd_info->resize_req.mouse.y);
3936 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);
3940 _policy_zone_layout_app_layer_set (bd, layer);
3944 /* resize & move if needed */
3945 if (bd->client.illume.win_state.state)
3947 if (bd_info->resize_req.need_change)
3949 if ((bd->x != bd_info->resize_req.mouse.x) ||
3950 (bd->y != bd_info->resize_req.mouse.y))
3953 if ((bd->w != bd_info->resize_req.mouse.w) ||
3954 (bd->h != bd_info->resize_req.mouse.h))
3959 e_border_move_resize(bd,
3960 bd_info->resize_req.mouse.x,
3961 bd_info->resize_req.mouse.y,
3962 bd_info->resize_req.mouse.w,
3963 bd_info->resize_req.mouse.h);
3967 _policy_border_move(bd,
3968 bd_info->resize_req.mouse.x,
3969 bd_info->resize_req.mouse.y);
3973 _policy_border_resize(bd,
3974 bd_info->resize_req.mouse.w,
3975 bd_info->resize_req.mouse.h);
3978 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);
3979 bd_info->resize_req.need_change = 0;
3982 if (bd_info->resize_req.mouse.down &&
3983 bd_info->resize_req.mouse.locked)
3985 if ((bd->x != bd_info->resize_req.mouse.x) ||
3986 (bd->y != bd_info->resize_req.mouse.y))
3987 _policy_border_move(bd,
3988 bd_info->resize_req.mouse.x,
3989 bd_info->resize_req.mouse.y);
3990 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);
3995 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
3998 if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y))
4002 e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
4004 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
4006 _policy_border_move(bd, bd->zone->x, bd->zone->y);
4009 /* set layer if needed */
4010 _policy_zone_layout_app_layer_set (bd, layer);
4015 _policy_zone_layout_app_dual_top_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4021 Eina_Bool resize = EINA_FALSE;
4022 Eina_Bool move = EINA_FALSE;
4024 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);
4026 bd = bd_info->border;
4028 if (!bd || !cz) return;
4029 if ((!bd->new_client) && (!bd->visible)) return;
4031 layer = _policy_zone_layout_app_layer_check (bd);
4033 // check if user defined position
4034 if (bd->client.icccm.request_pos)
4036 _policy_zone_layout_app_layer_set (bd, layer);
4040 /* set a default Y position */
4041 ny = (bd->zone->y + cz->indicator.size);
4042 nh = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2);
4044 /* see if there is a border already there. if so, check placement based on
4045 * virtual keyboard usage */
4046 temp_bd = e_illume_border_at_xy_get(bd->zone, bd->zone->x, ny);
4047 if ((temp_bd) && (temp_bd != bd)) ny = temp_bd->y + nh;
4049 /* resize if needed */
4050 if ((bd->w != bd->zone->w) || (bd->h != nh))
4053 /* move to correct position (relative to zone) if needed */
4054 if ((bd->x != bd->zone->x) || (bd->y != ny))
4058 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4060 _policy_border_resize(bd, bd->zone->w, nh);
4062 _policy_border_move(bd, bd->zone->x, ny);
4064 /* set layer if needed */
4065 _policy_zone_layout_app_layer_set (bd, layer);
4069 _policy_zone_layout_app_dual_left_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4075 Eina_Bool resize = EINA_FALSE;
4076 Eina_Bool move = EINA_FALSE;
4078 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);
4080 bd = bd_info->border;
4082 if (!bd || !cz) return;
4083 if ((!bd->new_client) && (!bd->visible)) return;
4085 layer = _policy_zone_layout_app_layer_check (bd);
4087 // check if user defined position
4088 if (bd->client.icccm.request_pos)
4090 _policy_zone_layout_app_layer_set (bd, layer);
4094 /* set some defaults */
4096 nw = (bd->zone->w / 2);
4098 ky = bd->zone->y + cz->indicator.size;
4099 kh = bd->zone->h - cz->indicator.size - cz->softkey.size;
4101 /* see if there is a border already there. if so, place at right */
4102 temp_bd = e_illume_border_at_xy_get(bd->zone, nx, (ky + bd->zone->h / 2));
4103 if ((temp_bd) && (bd != temp_bd)) nx = temp_bd->x + nw;
4105 /* resize if needed */
4106 if ((bd->w != nw) || (bd->h != kh))
4109 /* move to correct position (relative to zone) if needed */
4110 if ((bd->x != nx) || (bd->y != ky))
4114 e_border_move_resize(bd, nx, ky, nw, kh);
4116 _policy_border_resize(bd, nw, kh);
4118 _policy_border_move(bd, nx, ky);
4120 /* set layer if needed */
4121 _policy_zone_layout_app_layer_set (bd, layer);
4126 _policy_zone_layout_app_dual_custom_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4131 Eina_Bool resize = EINA_FALSE;
4132 Eina_Bool move = EINA_FALSE;
4134 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);
4136 bd = bd_info->border;
4139 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
4143 if ((!bd->new_client) && (!bd->visible)) return;
4145 /* grab indicator position */
4146 e_illume_border_indicator_pos_get(bd->zone, NULL, &iy);
4148 /* set a default position */
4152 app = e_illume_border_at_xy_get(bd->zone, bd->zone->x, bd->zone->y);
4157 ny = (iy + cz->indicator.size);
4158 nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size);
4162 /* make sure it's the required width & height */
4163 if ((bd->w != bd->zone->w) || (bd->h != nh))
4166 /* move to correct position (relative to zone) if needed */
4167 if ((bd->x != bd->zone->x) || (bd->y != ny))
4171 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4173 _policy_border_resize(bd, bd->zone->w, nh);
4175 _policy_border_move(bd, bd->zone->x, ny);
4177 /* set layer if needed */
4178 if (bd->layer != POL_APP_LAYER)
4179 e_border_layer_set(bd, POL_APP_LAYER);
4182 static int _policy_border_get_notification_level (Ecore_X_Window win)
4187 unsigned char* prop_data = NULL;
4189 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_NOTIFICATION_LEVEL, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &num);
4190 if( ret && prop_data )
4191 memcpy (&level, prop_data, sizeof (int));
4193 if (prop_data) free (prop_data);
4199 _policy_notification_level_map(int level)
4203 case E_ILLUME_NOTIFICATION_LEVEL_LOW: return POL_NOTIFICATION_LAYER_LOW;
4204 case E_ILLUME_NOTIFICATION_LEVEL_NORMAL: return POL_NOTIFICATION_LAYER_NORMAL;
4205 case E_ILLUME_NOTIFICATION_LEVEL_HIGH: return POL_NOTIFICATION_LAYER_HIGH;
4206 default: return POL_NOTIFICATION_LAYER_LOW;
4210 /* find new focus window */
4212 _policy_border_focus_top_stack_set (E_Border* bd)
4215 E_Border *cur_focus;
4219 root_w = bd->zone->w;
4220 root_h = bd->zone->h;
4222 cur_focus = e_border_focused_get();
4224 bl = e_container_border_list_last(bd->zone->container);
4225 while ((temp_bd = e_container_border_list_prev(bl)))
4227 if (temp_bd == cur_focus) break;
4229 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
4230 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
4231 if ((temp_bd != bd) &&
4232 (temp_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)) continue;
4234 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
4235 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
4236 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
4237 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
4238 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
4239 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
4240 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
4242 if (!temp_bd->focused)
4244 /* this border is the top of the latest stack */
4245 e_border_focus_set (temp_bd, 1, 1);
4250 e_container_border_list_free(bl);
4253 void _policy_border_stack (E_Event_Border_Stack *event)
4255 E_Event_Border_Stack* ev;
4256 E_Illume_Border_Info* bd_info;
4257 E_Illume_Border_Info* stack_bd_info;
4261 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);
4263 bd_info = _policy_get_border_info(ev->border);
4264 if (!bd_info) return;
4268 stack_bd_info = _policy_get_border_info(ev->stack);
4272 stack_bd_info = NULL;
4275 if (ev->type == E_STACKING_ABOVE)
4281 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4282 e_border_info_list = eina_list_prepend_relative (e_border_info_list, bd_info, stack_bd_info);
4283 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);
4287 // could find bd_info of ev->stack.. there is no bd_info yet...
4288 Eina_List *l = NULL;
4289 E_Illume_Border_Info *temp_bd_info;
4291 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4293 if (!temp_bd_info) continue;
4294 if (bd_info->border->layer >= temp_bd_info->border->layer)
4298 if (bd_info != temp_bd_info)
4300 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4301 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4302 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);
4308 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4309 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
4310 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, ev->border->client.win);
4313 else if (ev->type == E_STACKING_BELOW)
4319 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4320 e_border_info_list = eina_list_append_relative (e_border_info_list, bd_info, stack_bd_info);
4321 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);
4325 // could find bd_info of ev->stack.. there is no bd_info yet...
4326 Eina_List *l = NULL;
4327 E_Illume_Border_Info *temp_bd_info;
4329 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4331 if (!temp_bd_info) continue;
4332 if (bd_info->border->layer >= temp_bd_info->border->layer)
4336 if (bd_info != temp_bd_info)
4338 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4339 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4340 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);
4346 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4347 e_border_info_list = eina_list_prepend (e_border_info_list, bd_info);
4348 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) ---> ]\n", __func__, __LINE__, ev->border->client.win);
4353 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);
4356 /* restack indicator when a active window stack is changed */
4357 if ((ev->border->client.win == g_active_win) &&
4358 (ev->border->layer == POL_NOTIFICATION_LAYER))
4361 indi_bd = e_illume_border_indicator_get(ev->border->zone);
4364 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, ev->border->client.win);
4365 _policy_border_indicator_control(indi_bd);
4369 ev->border->changes.pos = 1;
4370 ev->border->changed = 1;
4375 void _policy_border_zone_set(E_Event_Border_Zone_Set *event)
4377 E_Event_Border_Zone_Set* ev;
4385 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
4388 static void _policy_change_quickpanel_layer (E_Illume_Quickpanel* qp, E_Border* indi_bd, int layer, int level)
4391 E_Illume_Quickpanel_Info *panel;
4392 E_Illume_Border_Info* bd_info;
4398 bd_info = _policy_get_border_info(qp->popup->border);
4401 bd_info->level = level;
4402 e_border_stack_below (qp->popup->border, indi_bd);
4406 EINA_LIST_FOREACH(qp->hidden_mini_controllers, bd_list, panel)
4408 if (!panel) continue;
4409 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4411 bd_info = _policy_get_border_info(panel->bd);
4414 bd_info->level = level;
4415 e_border_stack_below (panel->bd, indi_bd);
4419 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
4421 if (!panel) continue;
4422 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4424 bd_info = _policy_get_border_info(panel->bd);
4427 bd_info->level = level;
4428 e_border_stack_below (panel->bd, indi_bd);
4433 static void _policy_change_indicator_layer(E_Border *indi_bd, E_Border *bd, int layer, int level)
4435 // the indicator's layer is changed to layer with level
4436 E_Illume_Border_Info *indi_bd_info;
4437 E_Illume_Quickpanel *qp;
4438 int new_noti_layer = 0;
4440 indi_bd_info = _policy_get_border_info(indi_bd);
4443 indi_bd_info->level = level;
4446 if (layer == POL_NOTIFICATION_LAYER)
4448 new_noti_layer = _policy_notification_level_map(level);
4450 if (indi_bd->layer != new_noti_layer)
4451 e_border_layer_set(indi_bd, new_noti_layer);
4453 else if (indi_bd->layer != layer)
4454 e_border_layer_set(indi_bd, layer);
4459 E_Illume_Border_Info *top_bd_info;
4461 // check transient_for window
4462 top_bd = _policy_border_transient_for_border_top_get(bd);
4463 if (!top_bd) top_bd = bd;
4465 top_bd_info = _policy_get_border_info(top_bd);
4468 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4470 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4475 L (LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator's below win:0x%07x\n", __func__, __LINE__, top_bd->client.win);
4476 _policy_border_stack_change(indi_bd, top_bd, E_ILLUME_STACK_ABOVE);
4478 e_border_info_list = eina_list_remove(e_border_info_list, indi_bd_info);
4479 e_border_info_list = eina_list_prepend_relative(e_border_info_list, indi_bd_info, top_bd_info);
4480 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);
4483 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4485 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4489 static Eina_Bool _policy_border_indicator_state_change(E_Border *indi_bd, E_Border *bd)
4491 E_Illume_Border_Info *bd_info;
4495 if (!indi_bd || !bd) return EINA_FALSE;
4497 indi_show = _policy_border_indicator_state_get(bd);
4500 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4501 e_border_show(indi_bd);
4503 if ((e_illume_border_is_notification(bd)) ||
4504 (bd->layer == POL_NOTIFICATION_LAYER))
4506 bd_info = _policy_get_border_info(bd);
4508 level = bd_info->level;
4512 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);
4513 _policy_change_indicator_layer(indi_bd, bd, POL_NOTIFICATION_LAYER, level);
4517 _policy_change_indicator_layer(indi_bd, NULL, POL_NOTIFICATION_LAYER, 50);
4522 else if (indi_show == 0)
4524 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4525 e_border_hide(indi_bd, 2);
4535 _policy_border_indicator_control(E_Border *indi_bd)
4537 Eina_Inlist *xwin_info_list;
4538 E_Illume_XWin_Info *xwin_info;
4540 Ecore_X_Illume_Indicator_Opacity_Mode mode;
4542 if (!indi_bd) return;
4545 xwin_info_list = _e_illume_xwin_info_list;
4549 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4551 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4553 if (xwin_info->bd_info)
4555 bd = xwin_info->bd_info->border;
4558 if (!bd->visible) continue;
4559 if (indi_bd == bd) continue;
4560 if (indi_bd->zone != bd->zone) continue;
4561 if (e_illume_border_is_indicator(bd)) continue;
4562 if (e_illume_border_is_keyboard(bd)) continue;
4563 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
4565 if (!_policy_border_indicator_state_change(indi_bd, bd))
4568 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
4569 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
4571 _policy_root_angle_set(bd);
4573 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, bd->client.win);
4574 g_indi_control_win = bd->client.win;
4582 /* for visibility */
4584 _policy_send_visibility_notify (Ecore_X_Window win, int visibility)
4588 event.type = VisibilityNotify;
4589 event.xvisibility.display = ecore_x_display_get();
4590 event.xvisibility.send_event = EINA_TRUE;
4591 event.xvisibility.state = visibility;
4592 event.xvisibility.window = win;
4594 XSendEvent(event.xvisibility.display
4595 , event.xvisibility.window
4597 , VisibilityChangeMask, &event);
4601 _policy_check_transient_child_visible(E_Border *bd)
4603 Eina_Bool ret = EINA_FALSE;
4604 E_Illume_XWin_Info *child_xwin_info = NULL;
4606 E_Border *child = NULL;
4608 EINA_LIST_FOREACH(bd->transients, l, child)
4610 if (!child) continue;
4611 if (ret) return ret;
4613 child_xwin_info = _policy_xwin_info_find(child->win);
4614 if ((child_xwin_info) &&
4615 (child_xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED))
4620 ret = _policy_check_transient_child_visible(child);
4627 _policy_calculate_visibility(void)
4629 // 1. CALCULATES window's region and decide it's visibility.
4630 // 2. DO (UN)ICONIFY if it's needed.
4631 // 3. SEND notify about visibility.
4633 E_Zone *zone = NULL;
4634 E_Border *bd = NULL, *indi_bd = NULL;
4635 Eina_Inlist *xwin_info_list = NULL;
4636 E_Illume_XWin_Info *xwin_info = NULL;
4637 E_Illume_Border_Info *bd_info = NULL;
4638 Ecore_X_XRegion *visible_region = NULL;
4639 Ecore_X_XRegion *win_region = NULL;
4640 Ecore_X_Rectangle visible_rect, win_rect;
4641 Eina_Bool is_fully_obscured = EINA_FALSE;
4642 Eina_Bool is_opaque_win = EINA_FALSE;
4643 Eina_Bool do_not_iconify = EINA_FALSE;
4644 Eina_Bool alpha_opaque = EINA_FALSE;
4645 Eina_Bool obscured_by_alpha_opaque = EINA_FALSE;
4647 int set_root_angle = 0;
4648 int control_indi = 0;
4650 if (!_g_visibility_changed) return;
4651 _g_visibility_changed = EINA_FALSE;
4653 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. BEGIN calculate visibility ...\n", __func__, __LINE__);
4654 xwin_info_list = _e_illume_xwin_info_list;
4655 if (!xwin_info_list) return;
4657 // set the entire visible region as a root geometry
4660 visible_rect.width = _g_root_width;
4661 visible_rect.height = _g_root_height;
4663 visible_region = ecore_x_xregion_new();
4664 if (!visible_region)
4666 L (LT_VISIBILITY_DETAIL,
4667 "[ILLUME2][VISIBILITY] BAD.... Creating visible region is failed.\n");
4671 ecore_x_xregion_union_rect(visible_region, visible_region, &visible_rect);
4673 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4675 // skip "input only" window
4676 if (xwin_info->attr.input_only) continue;
4678 // skip "unmap" window
4679 if ((xwin_info->viewable == 0) &&
4680 (xwin_info->iconify_by_wm == 0)) continue;
4682 if (!xwin_info->is_drawed) continue;
4684 // initializing variable
4687 is_opaque_win = EINA_TRUE;
4688 do_not_iconify = EINA_FALSE;
4689 old_vis = xwin_info->visibility;
4691 bd_info = xwin_info->bd_info;
4692 if (bd_info) bd = bd_info->border;
4694 // 1. calculates window's region and decide it's visibility.
4695 if (is_fully_obscured == EINA_FALSE)
4697 win_rect.x = xwin_info->attr.x;
4698 win_rect.y = xwin_info->attr.y;
4699 win_rect.width = xwin_info->attr.w;
4700 win_rect.height = xwin_info->attr.h;
4702 // if it stick out or is bigger than the entire visible region,
4703 // clip it by the entire visible's geometry.
4704 E_RECTS_CLIP_TO_RECT(win_rect.x, win_rect.y,
4705 win_rect.width, win_rect.height,
4706 visible_rect.x, visible_rect.y,
4707 (int)(visible_rect.width), (int)(visible_rect.height));
4709 if (ecore_x_xregion_rect_contain(visible_region, &win_rect))
4711 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Un-OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4712 xwin_info->visibility = E_ILLUME_VISIBILITY_UNOBSCURED;
4716 if (bd->client.argb)
4718 if (bd_info && bd_info->opaque)
4720 alpha_opaque = EINA_TRUE;
4724 is_opaque_win = EINA_FALSE;
4728 if (bd->client.illume.win_state.state ==
4729 ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
4731 is_opaque_win = EINA_FALSE;
4736 if (xwin_info->argb)
4737 is_opaque_win = EINA_FALSE;
4742 win_region = ecore_x_xregion_new();
4745 ecore_x_xregion_union_rect(win_region, win_region, &win_rect);
4746 ecore_x_xregion_subtract(visible_region, visible_region, win_region);
4747 ecore_x_xregion_free(win_region);
4750 if (ecore_x_xregion_is_empty(visible_region))
4752 is_fully_obscured = EINA_TRUE;
4755 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... OBSCURED by alpha opaque win:0x%07x\n", __func__, __LINE__, xwin_info->id);
4756 obscured_by_alpha_opaque = EINA_TRUE;
4757 alpha_opaque = EINA_FALSE;
4765 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. place on OUTSIDE\n", __func__, __LINE__, xwin_info->id);
4766 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4771 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4772 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4776 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) continue;
4778 // decide if it's the border that DO NOT iconify.
4779 if (obscured_by_alpha_opaque)
4781 do_not_iconify = EINA_TRUE;
4783 // when this border has transient windows,
4784 // check out this child's visibility.
4785 // if there is any child window that is UNOBSCURED,
4786 // DO NOT iconify this border.
4787 else if (bd->transients)
4789 do_not_iconify = _policy_check_transient_child_visible(bd);
4792 // 2. DO (UN)ICONIFY and send visibility notify if it's needed.
4793 if (old_vis != xwin_info->visibility)
4796 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
4798 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);
4799 _policy_send_visibility_notify(bd->client.win, xwin_info->visibility);
4801 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
4803 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);
4806 if (_e_illume_cfg->use_force_iconify)
4810 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);
4811 _policy_border_force_uniconify(bd);
4815 else if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4817 if (bd->client.win == g_rotated_win)
4819 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. g_rotated_win(0x%07x) is obscured.\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4823 if (_e_illume_cfg->use_force_iconify)
4825 if ((!bd->iconic) && (!do_not_iconify))
4827 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);
4828 _policy_border_iconify_by_illume(xwin_info);
4834 zone = xwin_info->bd_info->border->zone;
4838 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4840 if (_e_illume_cfg->use_force_iconify)
4842 if (bd->parent && bd->parent->iconic)
4844 if ((!bd->iconic) && (!do_not_iconify))
4846 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);
4847 _policy_border_iconify_by_illume(xwin_info);
4850 else if (bd->iconic && do_not_iconify)
4852 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Uniconify by illume.. win:0x%07x\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4853 _policy_border_force_uniconify(bd);
4859 // 3. check if opaque window is ocupied the screen.
4860 // then we reset the obscured_by_alpha_opaque flag
4861 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4863 if (obscured_by_alpha_opaque && is_opaque_win)
4865 if (E_CONTAINS(xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.w, xwin_info->attr.h,
4866 0, 0, _g_root_width, _g_root_height))
4868 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... unset obscured_by_alpha_opaque win:%x\n", __func__, __LINE__, xwin_info->id);
4869 obscured_by_alpha_opaque = EINA_FALSE;
4877 if (_e_illume_cfg->use_indicator_widget)
4879 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
4880 _policy_border_root_angle_control(zone);
4884 indi_bd = e_illume_border_indicator_get(zone);
4887 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Control Indicator.\n", __func__, __LINE__);
4888 _policy_border_indicator_control(indi_bd);
4893 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. END calculate visibility ...\n", __func__, __LINE__);
4895 if (visible_region) ecore_x_xregion_free(visible_region);
4898 static E_Illume_XWin_Info*
4899 _policy_xwin_info_find (Ecore_X_Window win)
4901 return eina_hash_find(_e_illume_xwin_info_hash, e_util_winid_str_get(win));
4906 _policy_manage_xwins (E_Manager* man)
4908 Ecore_X_Window *windows;
4912 windows = ecore_x_window_children_get(man->root, &wnum);
4915 for (i = 0; i < wnum; i++)
4916 _policy_xwin_info_add(windows[i]);
4921 ecore_x_window_size_get (man->root, &_g_root_width, &_g_root_height);
4926 _policy_xwin_info_add (Ecore_X_Window win)
4930 if (win == _e_overlay_win) return EINA_FALSE;
4932 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
4935 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x EXIST in the list...\n", __func__, __LINE__, win);
4939 xwin_info = (E_Illume_XWin_Info*) calloc (1, sizeof (E_Illume_XWin_Info));
4942 L (LT_XWIN, "[ILLUME2][XWIN] (%s:%d).. Critical Error... Fail to create memory... \n", __func__, __LINE__);
4946 xwin_info->id = win;
4947 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4949 if (!ecore_x_window_attributes_get(win, &xwin_info->attr))
4955 xwin_info->viewable = xwin_info->attr.viewable;
4957 bd = e_border_find_by_window (win);
4958 xwin_info->bd_info = _policy_get_border_info(bd);
4959 xwin_info->argb = ecore_x_window_argb_get (win);
4961 if (_e_use_comp) xwin_info->comp_vis = 0;
4962 else xwin_info->comp_vis = 1;
4964 eina_hash_add(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
4965 _e_illume_xwin_info_list = eina_inlist_append(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
4972 _policy_xwin_info_delete (Ecore_X_Window win)
4974 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
4975 if (xwin_info == NULL)
4977 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, win);
4981 _e_illume_xwin_info_list = eina_inlist_remove(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
4982 eina_hash_del(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
4990 void _policy_window_create (Ecore_X_Event_Window_Create *event)
4992 Ecore_X_Window parent;
4994 parent = ecore_x_window_parent_get(event->win);
4995 if (parent != ecore_x_window_root_get(event->win))
4998 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5000 _policy_xwin_info_add (event->win);
5004 void _policy_window_destroy (Ecore_X_Event_Window_Destroy *event)
5006 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5008 _policy_xwin_info_delete (event->win);
5012 void _policy_window_reparent (Ecore_X_Event_Window_Reparent *event)
5014 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5016 if (event->parent == ecore_x_window_root_first_get())
5017 _policy_xwin_info_add (event->win);
5019 _policy_xwin_info_delete (event->win);
5023 void _policy_window_show (Ecore_X_Event_Window_Show *event)
5025 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5027 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5028 if (xwin_info == NULL)
5030 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5034 xwin_info->viewable = EINA_TRUE;
5036 if (xwin_info->comp_vis)
5038 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5039 _g_visibility_changed = EINA_TRUE;
5044 void _policy_window_hide (Ecore_X_Event_Window_Hide *event)
5046 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5048 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5049 if (xwin_info == NULL)
5051 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5055 xwin_info->viewable = EINA_FALSE;
5057 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5058 _g_visibility_changed = EINA_TRUE;
5062 void _policy_window_configure (Ecore_X_Event_Window_Configure *event)
5065 E_Illume_XWin_Info* xwin_info;
5066 E_Illume_XWin_Info* old_above_xwin_info;
5067 E_Illume_XWin_Info* new_above_xwin_info;
5068 E_Illume_XWin_Info* temp_xwin_info;
5069 E_Illume_XWin_Info* target_xwin_info;
5070 int check_visibility;
5072 Ecore_X_Window target_win;
5074 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5077 old_above_xwin_info = NULL;
5078 new_above_xwin_info = NULL;
5079 check_visibility = 0;
5081 target_win = event->win;
5083 xwin_info = _policy_xwin_info_find (event->win);
5084 if (xwin_info == NULL)
5086 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5089 target_xwin_info = xwin_info;
5091 if ((xwin_info->attr.x != event->x) ||
5092 (xwin_info->attr.y != event->y))
5094 check_visibility = 1;
5097 if ((xwin_info->attr.w != event->w) ||
5098 (xwin_info->attr.h != event->h))
5101 check_visibility = 1;
5104 xwin_info->attr.x = event->x;
5105 xwin_info->attr.y = event->y;
5106 xwin_info->attr.w = event->w;
5107 xwin_info->attr.h = event->h;
5109 if ((l = EINA_INLIST_GET(xwin_info)->prev) != NULL)
5111 old_above_xwin_info = EINA_INLIST_CONTAINER_GET (l, E_Illume_XWin_Info);
5114 new_above_xwin_info = _policy_xwin_info_find (event->abovewin);
5116 if (old_above_xwin_info != new_above_xwin_info)
5119 if (old_above_xwin_info)
5121 temp_xwin_info = old_above_xwin_info;
5122 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))
5124 if (temp_xwin_info == new_above_xwin_info)
5126 target_win = old_above_xwin_info->id;
5127 target_xwin_info = old_above_xwin_info;
5132 check_visibility = 1;
5135 _e_illume_xwin_info_list = eina_inlist_remove (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5136 if (new_above_xwin_info)
5137 _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));
5139 _e_illume_xwin_info_list = eina_inlist_prepend (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5141 if (check_visibility == 1)
5143 if (target_xwin_info->viewable)
5145 if (target_xwin_info->comp_vis)
5149 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. SIZE is changed... target win:0x%07x\n", __func__, __LINE__, target_xwin_info->id);
5150 target_xwin_info->is_drawed = EINA_FALSE;
5154 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5155 _g_visibility_changed = EINA_TRUE;
5157 else if (target_xwin_info->iconify_by_wm)
5159 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5160 _g_visibility_changed = EINA_TRUE;
5167 void _policy_window_configure_request (Ecore_X_Event_Window_Configure_Request *event)
5170 Ecore_X_Event_Window_Configure_Request *e;
5173 bd = e_border_find_by_client_window(e->win);
5176 if (!bd->lock_client_stacking)
5178 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
5179 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
5181 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5183 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5184 _policy_border_focus_top_stack_set (bd);
5187 else if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
5189 if (_e_illume_cfg->use_force_iconify)
5191 if (e->detail == ECORE_X_WINDOW_STACK_BELOW && !e->abovewin)
5193 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Request Lower window... win:0x%07x\n", __func__, __LINE__, e->win);
5194 E_Illume_XWin_Info *xwin_info = _policy_xwin_info_find(bd->win);
5197 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
5198 _policy_border_uniconify_top_border(bd);
5203 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5205 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5206 _policy_border_focus_top_stack_set(bd);
5212 void _policy_window_sync_draw_done(Ecore_X_Event_Client_Message* event)
5215 E_Illume_XWin_Info *xwin_info;
5218 win = event->data.l[0];
5219 bd = e_border_find_by_client_window(win);
5222 xwin_info = _policy_xwin_info_find(bd->win);
5223 if (!xwin_info) return;
5225 if (!xwin_info->is_drawed)
5227 if (xwin_info->comp_vis)
5229 xwin_info->is_drawed = EINA_TRUE;
5230 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5231 _g_visibility_changed = EINA_TRUE;
5233 else if (xwin_info->iconify_by_wm)
5235 xwin_info->is_drawed = EINA_TRUE;
5236 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5237 _g_visibility_changed = EINA_TRUE;
5242 /* Setting window mode requires window stack change and window geometry
5243 * change. But now, the WM can't control these sequential operations
5244 * using x property set API which whould be able to overwrite previous
5245 * value before getting x property by the WM.
5246 * So we changed ecore_x_e_illume_window_state_set function to use x send
5247 * message and x sync counter. When the WM receives this message,
5248 * the WM sets window mode and then increases x sync counter.
5250 * TODO: We need to make a new protocol to set the window mode!!
5252 void _policy_illume_win_state_change_request (Ecore_X_Event_Client_Message *event)
5254 E_Border *bd = NULL;
5255 Ecore_X_Atom atom = 0, set = 0;
5256 unsigned int state = 0;
5257 Ecore_X_Sync_Counter counter = 0;
5262 bd = e_border_find_by_client_window(event->win);
5263 atom = event->data.l[0];
5264 counter = event->data.l[1];
5265 val = event->data.l[2];
5267 if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL)
5269 state = ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
5272 else if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING)
5274 state = ECORE_X_ILLUME_WINDOW_STATE_FLOATING;
5278 ELBF(ELBT_ILLUME, 0, event->win,
5279 "GET WIN_STATE_CHANGE_REQ bd:0x%08x(%d->%d) counter:0x%08x val:%d",
5280 bd ? bd->client.win : (unsigned int)NULL,
5281 bd ? bd->client.illume.win_state.state : 0,
5286 _policy_border_illume_window_state_change(bd, state);
5290 ecore_x_window_prop_atom_set(event->win, ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
5292 ELB(ELBT_ILLUME, "SET WIN_STATE", event->win);
5295 if (counter) ecore_x_sync_counter_inc(counter, 1);
5298 void _policy_quickpanel_state_change (Ecore_X_Event_Client_Message* event)
5301 E_Illume_Quickpanel *qp;
5303 if ((zone = e_util_zone_window_find(event->win)))
5305 if ((qp = e_illume_quickpanel_by_zone_get(zone)))
5307 if (event->data.l[0] == (int)ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
5309 _policy_layout_quickpanel_rotate (qp, g_root_angle);
5316 _policy_root_angle_set(E_Border *bd)
5319 Ecore_X_Window root;
5323 angle = _policy_window_rotation_angle_get(bd->client.win);
5324 if (angle == -1) return EINA_FALSE;
5325 if (!(((bd->w == bd->zone->w) && (bd->h == bd->zone->h)) ||
5326 ((bd->w == bd->zone->h) && (bd->h == bd->zone->w))))
5329 g_rotated_win = bd->client.win;
5330 root = bd->zone->container->manager->root;
5334 angle = g_root_angle;
5339 if (_e_illume_cfg->use_indicator_widget)
5341 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, g_rotated_win);
5342 g_indi_control_win = g_rotated_win;
5345 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);
5346 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. SET ROOT ANGLE... angle:%d\n\n", __func__, __LINE__, angle);
5347 // set root window property
5348 ecore_x_window_prop_property_set(root, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, ECORE_X_ATOM_CARDINAL, 32, &angle, 1);
5354 e_illume_border_is_camera(E_Border *bd)
5356 const char *name = NULL;
5357 const char *clas = NULL;
5359 if (!bd) return EINA_FALSE;
5361 name = bd->client.icccm.name;
5362 clas = bd->client.icccm.class;
5364 if (clas == NULL) return EINA_FALSE;
5365 if (strncmp(clas,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5366 if (name == NULL) return EINA_FALSE;
5367 if (strncmp(name,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5373 _policy_change_root_angle_by_border_angle (E_Border* bd)
5375 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win:0x%07x\n", __func__, __LINE__, bd ? (unsigned int)bd->client.win:(unsigned int)NULL);
5378 // ignore the angle of special borders - like indicator, keyboard, quickpanel, etc.
5379 if (e_illume_border_is_indicator(bd)) return;
5380 if (e_illume_border_is_keyboard(bd)) return;
5381 if (e_illume_border_is_quickpanel(bd)) return;
5382 if (e_illume_border_is_quickpanel_popup(bd)) return;
5384 if (e_illume_border_is_camera(bd))
5386 if (dep_rot.refer.active_win == bd->client.win)
5388 // make rotation request for the dependent windows such as quickpanel
5389 int ang = _policy_window_rotation_angle_get(bd->client.win);
5390 if (ang == -1) ang = 0;
5392 if (dep_rot.ang != ang)
5393 _policy_border_dependent_rotation(bd, ang);
5397 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... CALL _policy_root_angle_set.. win:0x%07x\n", __func__, __LINE__, bd->client.win);
5398 _policy_root_angle_set(bd);
5402 _policy_indicator_angle_change (E_Border* indi_bd, int angle)
5404 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... indicator:0x%07x\n", __func__, __LINE__, indi_bd ? (unsigned int)indi_bd->client.win:(unsigned int)NULL);
5405 if (!indi_bd) return;
5407 int old_angle = _policy_window_rotation_angle_get (indi_bd->client.win);
5408 if(old_angle == -1) return;
5410 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... old_angle:%d, new_angle:%d\n", __func__, __LINE__, old_angle, angle);
5411 if (old_angle != angle)
5415 angles[1] = old_angle;
5416 ecore_x_window_prop_property_set(indi_bd->client.win,
5417 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5418 ECORE_X_ATOM_CARDINAL,
5423 ecore_x_client_message32_send (indi_bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5424 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
5427 E_Illume_Quickpanel *qp;
5428 qp = e_illume_quickpanel_by_zone_get (indi_bd->zone);
5431 _policy_layout_quickpanel_rotate (qp, angle);
5437 _policy_border_transient_for_group_make(E_Border *bd,
5446 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5448 if (e_config->transient.raise)
5450 EINA_LIST_FOREACH(bd->transients, l, child)
5452 if (!child) continue;
5455 *list = eina_list_prepend(*list, child);
5456 _policy_border_transient_for_group_make(child, list);
5463 _policy_border_transient_for_border_top_get(E_Border *bd)
5465 E_Border *top_border = NULL;
5466 Eina_List *transient_list = NULL;
5468 _policy_border_transient_for_group_make(bd, &transient_list);
5472 Eina_List *l = NULL;
5477 bl = e_container_border_list_last(bd->zone->container);
5478 while ((temp_bd = e_container_border_list_prev(bl)))
5480 if (top_border) break;
5481 if (temp_bd == bd) break;
5483 EINA_LIST_FOREACH(transient_list, l, temp_bd2)
5485 if (temp_bd == temp_bd2)
5487 top_border = temp_bd2;
5492 e_container_border_list_free(bl);
5495 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);
5497 eina_list_free(transient_list);
5503 _policy_border_transient_for_layer_set(E_Border *bd,
5504 E_Border *parent_bd,
5508 E_Border *top_border;
5511 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5513 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);
5515 ecore_x_window_shadow_tree_flush();
5517 raise = e_config->transient.raise;
5519 bd->saved.layer = bd->layer;
5521 if (e_config->transient.layer)
5526 /* We need to set raise to one, else the child wont
5527 * follow to the new layer. It should be like this,
5528 * even if the user usually doesn't want to raise
5531 e_config->transient.raise = 1;
5532 EINA_LIST_FOREACH(bd->transients, l, child)
5534 if (!child) continue;
5535 child->layer = layer;
5539 top_border = _policy_border_transient_for_border_top_get(parent_bd);
5542 if (top_border != bd)
5544 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);
5545 e_border_stack_above(bd, top_border);
5550 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);
5551 e_border_stack_above(bd, parent_bd);
5554 e_config->transient.raise = raise;
5557 /* for desktop mode */
5559 _policy_zone_layout_app_single_monitor(E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
5563 Eina_Bool resize = EINA_FALSE;
5564 Eina_Bool move = EINA_FALSE;
5566 bd = bd_info->border;
5569 fprintf(stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
5573 if ((!bd->new_client) && (!bd->visible)) return;
5575 layer = _policy_zone_layout_app_layer_check(bd);
5579 int zx = 0, zy = 0, zw = 0, zh = 0;
5580 int new_x, new_y, new_w, new_h;
5582 if (!bd->client.icccm.request_pos)
5585 Eina_List *skiplist = NULL;
5588 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5590 // calculate width & height
5596 delta = delta * 0.66;
5598 new_w = delta * 9.0;
5599 new_h = delta * 16.0;
5602 new_x = zx + (rand() % (zw - new_w));
5606 new_y = zy + (rand() % (zh - new_h));
5610 skiplist = eina_list_append(skiplist, bd);
5612 e_place_zone_region_smart(bd->zone, skiplist,
5613 bd->x, bd->y, new_w, new_h,
5616 eina_list_free(skiplist);
5621 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5623 if (zx > bd->x) new_x = zx;
5626 if (zy > bd->y) new_y = zy;
5629 if (zw < bd->w) new_w = zw;
5632 if (zh < bd->h) new_h = zh;
5636 if ((bd->x != new_x) || (bd->y != new_y))
5639 if ((bd->w != new_w) || (bd->h != new_h))
5643 e_border_move_resize(bd, new_x, new_y, new_w, new_h);
5645 _policy_border_move(bd, new_x, new_y);
5647 _policy_border_resize(bd, new_w, new_h);
5651 /* check if user defined position */
5652 if (bd->client.icccm.request_pos)
5654 if (bd->client.illume.win_state.state)
5656 if (bd_info->resize_req.need_change)
5658 if ((bd->x != bd_info->resize_req.mouse.x) ||
5659 (bd->y != bd_info->resize_req.mouse.y))
5662 if ((bd->w != bd_info->resize_req.mouse.w) ||
5663 (bd->h != bd_info->resize_req.mouse.h))
5668 e_border_move_resize(bd,
5669 bd_info->resize_req.mouse.x,
5670 bd_info->resize_req.mouse.y,
5671 bd_info->resize_req.mouse.w,
5672 bd_info->resize_req.mouse.h);
5676 _policy_border_move(bd,
5677 bd_info->resize_req.mouse.x,
5678 bd_info->resize_req.mouse.y);
5682 _policy_border_resize(bd,
5683 bd_info->resize_req.mouse.w,
5684 bd_info->resize_req.mouse.h);
5687 bd_info->resize_req.need_change = 0;
5688 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);
5691 if (bd_info->resize_req.mouse.down &&
5692 bd_info->resize_req.mouse.locked)
5694 if ((bd->x != bd_info->resize_req.mouse.x) ||
5695 (bd->y != bd_info->resize_req.mouse.y))
5696 _policy_border_move(bd,
5697 bd_info->resize_req.mouse.x,
5698 bd_info->resize_req.mouse.y);
5699 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);
5702 _policy_zone_layout_app_layer_set(bd, layer);
5706 /* resize & move if needed */
5707 if (bd->client.illume.win_state.state)
5709 if (bd_info->resize_req.need_change)
5711 if ((bd->x != bd_info->resize_req.mouse.x) ||
5712 (bd->y != bd_info->resize_req.mouse.y))
5715 if ((bd->w != bd_info->resize_req.mouse.w) ||
5716 (bd->h != bd_info->resize_req.mouse.h))
5721 e_border_move_resize(bd,
5722 bd_info->resize_req.mouse.x,
5723 bd_info->resize_req.mouse.y,
5724 bd_info->resize_req.mouse.w,
5725 bd_info->resize_req.mouse.h);
5729 _policy_border_move(bd,
5730 bd_info->resize_req.mouse.x,
5731 bd_info->resize_req.mouse.y);
5735 _policy_border_resize(bd,
5736 bd_info->resize_req.mouse.w,
5737 bd_info->resize_req.mouse.h);
5740 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);
5741 bd_info->resize_req.need_change = 0;
5744 if (bd_info->resize_req.mouse.down &&
5745 bd_info->resize_req.mouse.locked)
5747 if ((bd->x != bd_info->resize_req.mouse.x) ||
5748 (bd->y != bd_info->resize_req.mouse.y))
5749 _policy_border_move(bd,
5750 bd_info->resize_req.mouse.x,
5751 bd_info->resize_req.mouse.y);
5752 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);
5757 /* set layer if needed */
5758 _policy_zone_layout_app_layer_set(bd, layer);
5761 void _policy_window_move_resize_request(Ecore_X_Event_Window_Move_Resize_Request *event)
5764 E_Illume_Border_Info *bd_info;
5765 Ecore_X_Event_Window_Move_Resize_Request *e;
5768 bd = e_border_find_by_client_window(e->win);
5770 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);
5772 if (e->direction == ECORE_X_NETWM_DIRECTION_MOVE ||
5773 e->direction == ECORE_X_NETWM_DIRECTION_CANCEL)
5776 if (bd->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
5779 bd_info = _policy_get_border_info(bd);
5780 if (!bd_info) return;
5782 e_border_resize_cancel();
5784 if (bd_info->resize_req.mouse.down)
5787 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
5789 bd_info->resize_req.mouse.down = 1;
5790 bd_info->resize_req.mouse.dx = bd->x - e->x;
5791 bd_info->resize_req.mouse.dy = bd->y - e->y;
5792 bd_info->resize_req.mouse.x = bd->x;
5793 bd_info->resize_req.mouse.y = bd->y;
5795 bd->lock_user_location = 1;
5797 _policy_border_illume_handlers_add(bd_info);
5798 ecore_x_window_raise(bd->event_win);
5799 if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
5800 e_grabinput_get(bd->event_win, 0, bd->event_win);
5802 e_grabinput_get(bd->event_win, 0, 0);
5804 bd_info->resize_req.direction = e->direction;
5805 _policy_resize_start(bd_info);
5808 void _policy_window_state_request(Ecore_X_Event_Window_State_Request *event)
5811 Ecore_X_Event_Window_State_Request *e;
5813 E_Maximize maximize = 0;
5816 bd = e_border_find_by_client_window(e->win);
5819 for (i = 0; i < 2; i++)
5821 switch (e->state[i])
5823 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
5824 if (bd->lock_client_maximize) break;
5825 maximize |= E_MAXIMIZE_VERTICAL;
5828 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
5829 if (bd->lock_client_maximize) break;
5830 maximize |= E_MAXIMIZE_HORIZONTAL;
5838 if (maximize &= E_MAXIMIZE_BOTH)
5840 if (e->action == ECORE_X_WINDOW_STATE_ACTION_ADD)
5842 if (bd->pointer && bd->pointer->type)
5843 e_pointer_type_pop(bd->pointer, bd, bd->pointer->type);
5848 static void _policy_border_root_angle_control(E_Zone *zone)
5850 Eina_Inlist *xwin_info_list;
5851 E_Illume_XWin_Info *xwin_info;
5855 xwin_info_list = _e_illume_xwin_info_list;
5859 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
5861 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
5863 if (xwin_info->bd_info)
5865 bd = xwin_info->bd_info->border;
5868 if (!bd->visible) continue;
5869 if (bd->zone != zone) continue;
5870 if (e_illume_border_is_indicator(bd)) continue;
5871 if (e_illume_border_is_keyboard(bd)) continue;
5872 if (e_illume_border_is_quickpanel(bd)) continue;
5873 if (e_illume_border_is_quickpanel_popup(bd)) continue;
5874 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
5876 if (_policy_root_angle_set(bd)) break;
5883 static int _policy_border_layer_map(int layer)
5887 if (layer < 0) layer = 0;
5888 pos = 1 + (layer / 50);
5889 if (pos > POL_NUM_OF_LAYER) pos = POL_NUM_OF_LAYER;
5894 _policy_msg_handler(void *data, const char *name, const char *info, int val, E_Object *obj, void *msgdata)
5896 E_Manager *man = (E_Manager *)obj;
5897 E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
5899 // handle only comp.manager msg
5900 if (strncmp(name, "comp.manager", sizeof("comp.manager"))) return;
5902 if (!strncmp(info, "visibility.src", sizeof("visibility.src")))
5904 E_Illume_XWin_Info *xwin_info;
5906 Ecore_X_Window active_win;
5907 Ecore_X_Window client_win;
5910 win = e_manager_comp_src_window_get(man, src);
5912 xwin_info = _policy_xwin_info_find(win);
5913 if (!xwin_info) return;
5915 visible = e_manager_comp_src_visible_get(man, src);
5918 xwin_info->is_drawed = EINA_TRUE;
5919 xwin_info->comp_vis = 1;
5920 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, win);
5921 _g_visibility_changed = EINA_TRUE;
5923 if (xwin_info->bd_info && xwin_info->bd_info->border)
5924 client_win = xwin_info->bd_info->border->client.win;
5928 active_win = _policy_active_window_get(ecore_x_window_root_get(win));
5929 if (active_win == client_win)
5931 _policy_active_win_change(xwin_info, active_win);
5936 xwin_info->comp_vis = 0;
5941 void _policy_module_update(E_Event_Module_Update *event)
5943 if ((!strncmp(event->name, "comp-tizen", sizeof("comp-tizen"))) ||
5944 (!strncmp(event->name, "comp", sizeof("comp"))))
5949 _e_use_comp = EINA_TRUE;
5954 _e_use_comp = EINA_FALSE;
5956 // change all variable to 1
5957 Eina_Inlist* xwin_info_list;
5958 E_Illume_XWin_Info *xwin_info;
5960 xwin_info_list = _e_illume_xwin_info_list;
5963 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
5965 xwin_info->comp_vis = EINA_TRUE;
5972 void _policy_border_iconify_cb(E_Border *bd)
5974 if (!_e_illume_cfg->use_force_iconify) return;
5977 if (e_object_is_del(E_OBJECT(bd))) return;
5979 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
5980 if (xwin_info == NULL) return;
5982 _policy_border_uniconify_below_borders_by_illume(xwin_info);
5984 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
5986 int old_vis = xwin_info->visibility;
5987 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
5988 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);
5990 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
5992 _policy_send_visibility_notify (xwin_info->bd_info->border->client.win, xwin_info->visibility);
5995 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);
5996 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
5997 _g_visibility_changed = EINA_TRUE;
5999 xwin_info->attr.visible = 0;
6001 _policy_border_focus_top_stack_set(bd);
6004 void _policy_border_uniconify_cb(E_Border *bd)
6006 if (!_e_illume_cfg->use_force_iconify) return;
6009 if (e_object_is_del(E_OBJECT(bd))) return;
6011 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
6012 if (xwin_info == NULL) return;
6014 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);
6016 xwin_info->iconify_by_wm = 0;
6017 xwin_info->attr.visible = 1;
6019 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
6020 _g_visibility_changed = EINA_TRUE;
6022 _policy_border_focus_top_stack_set(bd);
6026 _policy_border_event_border_iconify_free(void *data __UNUSED__,
6029 E_Event_Border_Iconify *e;
6032 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_iconify_event");
6033 e_object_unref(E_OBJECT(e->border));
6039 _policy_border_force_iconify(E_Border *bd)
6041 E_Event_Border_Iconify *ev;
6042 unsigned int iconic;
6043 E_Illume_XWin_Info* xwin_info;
6046 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6047 if (bd->shading) return;
6048 ecore_x_window_shadow_tree_flush();
6052 e_border_hide(bd, 0);
6053 if (bd->fullscreen) bd->desk->fullscreen_borders--;
6054 edje_object_signal_emit(bd->bg_object, "e,action,iconify", "e");
6057 e_hints_window_iconic_set(bd);
6058 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6060 ev = E_NEW(E_Event_Border_Iconify, 1);
6062 e_object_ref(E_OBJECT(bd));
6063 // e_object_breadcrumb_add(E_OBJECT(bd), "border_iconify_event");
6064 ecore_event_add(E_EVENT_BORDER_ICONIFY, ev, _policy_border_event_border_iconify_free, NULL);
6066 xwin_info = _policy_xwin_info_find(bd->win);
6069 xwin_info->iconify_by_wm = 1;
6072 if (e_config->transient.iconify)
6076 E_Illume_XWin_Info* child_xwin_info;
6078 EINA_LIST_FOREACH(bd->transients, l, child)
6080 if (!e_object_is_del(E_OBJECT(child)))
6084 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... Iconify by illume.. child:0x%07x\n", __func__, __LINE__, child->client.win);
6085 child_xwin_info = _policy_xwin_info_find(child->win);
6086 if (child_xwin_info)
6088 _policy_border_iconify_by_illume(child_xwin_info);
6094 e_remember_update(bd);
6098 _policy_border_iconify_by_illume(E_Illume_XWin_Info *xwin_info)
6102 if (!xwin_info) return;
6103 if (!xwin_info->bd_info) return;
6104 if (!xwin_info->bd_info->border) return;
6106 bd = xwin_info->bd_info->border;
6107 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) return;
6108 if (e_object_is_del(E_OBJECT(bd))) return;
6110 if (bd->parent && (!bd->parent->iconic)) return;
6112 if (e_illume_border_is_indicator(bd)) return;
6113 if (e_illume_border_is_keyboard(bd)) return;
6114 if (e_illume_border_is_keyboard_sub(bd)) return;
6115 if (e_illume_border_is_quickpanel(bd)) return;
6116 if (e_illume_border_is_quickpanel_popup(bd)) return;
6117 if (e_illume_border_is_clipboard(bd)) return;
6118 if (e_illume_border_is_app_tray(bd)) return;
6119 if (e_illume_border_is_miniapp_tray(bd)) return;
6120 // if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) return;
6122 xwin_info->iconify_by_wm = 1;
6126 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... FORCE_ICONIFY win:0x%07x\n", __func__, __LINE__, bd->client.win);
6127 _policy_border_force_iconify(bd);
6132 _policy_border_event_border_uniconify_free(void *data, void *ev)
6134 E_Event_Border_Uniconify *e;
6137 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_uniconify_event");
6138 e_object_unref(E_OBJECT(e->border));
6142 static void _policy_border_force_uniconify(E_Border *bd)
6145 E_Event_Border_Uniconify *ev;
6146 unsigned int iconic;
6147 E_Illume_XWin_Info* xwin_info;
6150 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6152 xwin_info = _policy_xwin_info_find(bd->win);
6153 if (!(xwin_info && xwin_info->iconify_by_wm)) return;
6155 if (bd->shading) return;
6156 ecore_x_window_shadow_tree_flush();
6161 if (bd->fullscreen) bd->desk->fullscreen_borders++;
6162 if (e_manager_comp_evas_get(bd->zone->container->manager))
6164 if (bd->await_hide_event > 0)
6165 bd->await_hide_event--;
6167 desk = e_desk_current_get(bd->desk->zone);
6168 e_border_desk_set(bd, desk);
6169 edje_object_signal_emit(bd->bg_object, "e,action,uniconify", "e");
6172 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6174 ev = E_NEW(E_Event_Border_Uniconify, 1);
6176 e_object_ref(E_OBJECT(bd));
6177 // e_object_breadcrumb_add(E_OBJECT(bd), "border_uniconify_event");
6178 ecore_event_add(E_EVENT_BORDER_UNICONIFY, ev, _policy_border_event_border_uniconify_free, NULL);
6180 if (e_config->transient.iconify)
6184 E_Illume_XWin_Info* child_xwin_info;
6186 EINA_LIST_FOREACH(bd->transients, l, child)
6188 if (!e_object_is_del(E_OBJECT(child)))
6192 child_xwin_info = _policy_xwin_info_find(child->win);
6193 if (child_xwin_info) child_xwin_info->iconify_by_wm = 1;
6195 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, child->client.win);
6196 _policy_border_force_uniconify(child);
6201 e_remember_update(bd);
6205 _policy_border_uniconify_below_borders_by_illume(E_Illume_XWin_Info *xwin_info)
6209 if (!xwin_info) return;
6210 if (!xwin_info->bd_info) return;
6212 bd = xwin_info->bd_info->border;
6214 // 1. check if iconify is caused by visibility change or not
6215 if (xwin_info->iconify_by_wm) return;
6217 // 2. check if current bd's visibility is fully-obscured or not
6218 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED) return;
6220 // 3-1. find bd's below window and un-iconify it
6221 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... UNICONIFY Below Windows of win:0x%07x\n", __func__, __LINE__, bd->client.win);
6222 _policy_border_uniconify_below_borders(bd);
6224 if (!e_object_is_del(E_OBJECT(bd)))
6230 static E_Border* _policy_border_find_below(E_Border *bd)
6235 E_Illume_XWin_Info* xwin_info;
6237 passed = EINA_FALSE;
6239 /* determine layering position */
6240 pos = _policy_border_layer_map(bd->layer);
6242 /* Find the windows below this one */
6243 for (i = pos; i >= 2; i--)
6247 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6251 /* skip if it's the same border */
6258 if ((b->x == b->zone->x) &&
6259 (b->y == b->zone->y) &&
6260 (b->w == b->zone->w) &&
6261 (b->h == b->zone->h) &&
6262 (b->h == b->zone->h) &&
6263 (b->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING) &&
6266 xwin_info = _policy_xwin_info_find(b->win);
6269 if ((!xwin_info->argb) ||
6270 (xwin_info->argb && xwin_info->bd_info->opaque))
6272 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);
6278 if (!passed) continue;
6280 /* skip if it's not on this zone */
6281 if (b->zone != bd->zone) continue;
6283 /* skip special borders */
6284 if (e_illume_border_is_indicator(b)) continue;
6285 if (e_illume_border_is_keyboard(b)) continue;
6286 if (e_illume_border_is_keyboard_sub(b)) continue;
6287 if (e_illume_border_is_quickpanel(b)) continue;
6288 if (e_illume_border_is_quickpanel_popup(b)) continue;
6289 if (e_illume_border_is_clipboard(b)) continue;
6290 if (e_illume_border_is_app_tray(b)) continue;
6291 if (e_illume_border_is_miniapp_tray(b)) continue;
6300 static void _policy_border_uniconify_below_borders(E_Border *bd)
6304 below_bd = _policy_border_find_below(bd);
6305 if (!below_bd) return;
6307 E_Illume_XWin_Info* below_xwin_info = _policy_xwin_info_find(below_bd->win);
6308 if (below_xwin_info == NULL) return;
6310 if ((below_bd->w != below_bd->zone->w) ||
6311 (below_bd->h != below_bd->zone->h) ||
6312 (below_xwin_info->argb))
6314 if (!(below_xwin_info->bd_info && below_xwin_info->bd_info->opaque))
6315 _policy_border_uniconify_below_borders(below_bd);
6319 if (below_bd->iconic)
6321 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, below_bd->client.win);
6322 _policy_border_force_uniconify(below_bd);
6326 static void _policy_border_uniconify_top_border(E_Border *bd)
6331 E_Illume_XWin_Info* xwin_info;
6333 if (!_e_illume_cfg->use_force_iconify) return;
6335 zone_w = bd->zone->w;
6336 zone_h = bd->zone->h;
6337 /* determine layering position */
6339 /* Find the windows below this one */
6340 for (i = POL_NUM_OF_LAYER; i >= 2; i--)
6344 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6348 if ((b->x >= zone_w) || (b->y >= zone_h)) continue;
6349 if (((b->x + b->w) <= 0) || ((b->y + b->h) <= 0)) continue;
6351 /* skip if it's not on this zone */
6352 if (b->zone != bd->zone) continue;
6354 /* skip special borders */
6355 if (e_illume_border_is_indicator(b)) continue;
6356 if (e_illume_border_is_keyboard(b)) continue;
6357 if (e_illume_border_is_keyboard_sub(b)) continue;
6358 if (e_illume_border_is_quickpanel(b)) continue;
6359 if (e_illume_border_is_quickpanel_popup(b)) continue;
6360 if (e_illume_border_is_clipboard(b)) continue;
6361 if (e_illume_border_is_app_tray(b)) continue;
6362 if (e_illume_border_is_miniapp_tray(b)) continue;
6366 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, b->client.win);
6367 _policy_border_force_uniconify(b);
6370 if ((b->x == b->zone->x) &&
6371 (b->y == b->zone->y) &&
6372 (b->w == b->zone->w) &&
6373 (b->h == b->zone->h))
6375 xwin_info = _policy_xwin_info_find(b->win);
6378 if (xwin_info->argb && !xwin_info->bd_info->opaque)
6393 /* change the desk of window for popsync.
6394 * if there is no window in data read from ev->l[0],
6395 * window that is latest above stack will be changed.
6396 * - event->data.l[0] : window ID
6397 * - event->data.l[1]
6398 * 1(default): mobile
6402 _policy_window_desk_set(Ecore_X_Event_Client_Message *event)
6404 Ecore_X_Event_Client_Message *ev = event;
6408 E_Desk *desk = NULL;
6411 Eina_Bool one_time = EINA_FALSE;
6412 char *profile = NULL, *new_profile = NULL;
6413 unsigned int desk_num;
6417 EINA_SAFETY_ON_NULL_RETURN(ev);
6419 win = ev->data.l[0];
6420 desk_num = ev->data.l[1];
6421 if (win) one_time = EINA_TRUE;
6423 // decide new desk's profile from received data.
6427 new_profile = _e_illume_cfg->display_name.popsync;
6431 new_profile = _e_illume_cfg->display_name.mobile;
6435 con = e_container_current_get(e_manager_current_get());
6436 bl = e_container_border_list_last(con);
6438 // if there exists a ID of window read from data ev->data.l[0],
6439 // find and set this window's border window, or set latest above border.
6440 bd = win ? e_border_find_by_client_window(win) :
6441 e_container_border_list_prev(bl);
6442 if (!bd) bd = e_border_find_by_window(win);
6447 // skip special window.
6448 if ((e_illume_border_is_indicator(bd)) ||
6449 (e_illume_border_is_keyboard(bd)) ||
6450 (e_illume_border_is_keyboard_sub(bd)) ||
6451 (e_illume_border_is_quickpanel(bd)) ||
6452 (e_illume_border_is_quickpanel_popup(bd)) ||
6453 (e_illume_border_is_clipboard(bd)))
6455 if (one_time) goto fin;
6459 if ((bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) &&
6460 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
6461 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
6462 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
6463 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
6464 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP) &&
6465 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NOTIFICATION))
6470 // terminated this function if there is only one desk.
6471 if ((zone->desk_x_count < 2) && (zone->desk_y_count < 2))
6475 // find the corresponsive desk.
6476 for (x = 0; x < zone->desk_x_count; x++)
6478 for (y = 0; y < zone->desk_y_count; y++)
6480 int index = x + (y * zone->desk_x_count);
6481 profile = zone->desks[index]->window_profile;
6483 if (!strcmp(new_profile, profile))
6484 desk = zone->desks[index];
6488 if (!desk) goto fin;
6490 e_border_desk_set(bd, desk);
6492 // we have to receive the DAMAGE notify from this window.
6493 // for this, the window has to have visible state as a its property.
6494 // if not, can not receive DAMAGE notify.
6495 e_hints_window_visible_set(bd);
6496 e_hints_window_desktop_set(bd);
6497 _policy_border_uniconify_below_borders(bd);
6500 } while((!one_time) && (bd = e_container_border_list_prev(bl)));
6503 e_container_border_list_free(bl);
6507 "[POPSYNC] ERROR: ");
6511 fprintf(stderr, "Couldn't find border.\n");
6514 fprintf(stderr, "Couldn't change desk. No border, or special window.\n");
6517 fprintf(stderr, "NO desk to change \n");
6520 fprintf(stderr, "Couldn't find desk such a profile.\n");
6523 fprintf(stderr, "Non-defined error\n");
6529 /* for supporting rotation */
6531 _policy_border_hook_rotation_list_add(E_Border *bd)
6536 rotation = bd->client.e.state.rot.curr;
6537 _policy_border_dependent_rotation(bd, rotation);
6541 _policy_border_dependent_rotation(E_Border *bd, int rotation)
6544 E_Border *dep_bd = NULL;
6547 if (!dep_rot.list) return;
6548 if (dep_rot.refer.active_win != bd->client.win) return;
6550 EINA_LIST_FOREACH(dep_rot.list, l, dep_bd)
6552 if (!dep_bd) continue;
6553 if (_policy_dependent_rotation_check(dep_bd, rotation))
6555 ELBF(ELBT_ROT, 0, dep_bd->client.win, "ROT_SET ANG [%d -> %d]",
6556 dep_bd->client.e.state.rot.curr, rotation);
6557 e_border_rotation_set(dep_bd, rotation);
6560 dep_rot.ang = rotation;
6564 _policy_dependent_rotation_check(E_Border *bd, int rotation)
6566 Eina_Bool ret = EINA_FALSE;
6568 if (!bd) return ret;
6569 if (!bd->visible) return ret;
6570 if (bd->client.e.state.rot.curr == rotation) return ret;
6577 _policy_property_indicator_cmd_win_change(Ecore_X_Event_Window_Property *event)
6579 Ecore_X_Window cmd_win;
6581 cmd_win = _policy_indicator_cmd_win_get(event->win);
6585 ELB(ELBT_ROT, "ERR! NO INDI_CMD_WIN", event->win);
6589 if (dep_rot.refer.cmd_win != cmd_win)
6591 ELBF(ELBT_ROT, 0, cmd_win,
6592 "INDICATOR COMMAND WIN: [0x%08x -> 0x%08x]",
6593 dep_rot.refer.cmd_win, cmd_win);
6594 dep_rot.refer.cmd_win = cmd_win;
6599 _policy_property_active_indicator_win_change(Ecore_X_Event_Window_Property *event)
6601 Ecore_X_Window active_win = 0;
6602 E_Border *bd = NULL;
6607 active_win = _policy_active_indicator_win_get(event->win);
6610 ELB(ELBT_ROT, "ERR! NO ACTIVE_INDI_WIN", event->win);
6614 if (dep_rot.refer.active_win != active_win)
6616 bd = e_border_find_by_client_window(active_win);
6619 ELB(ELBT_ROT, "ERR! NO BD ACTIVE_INDI_WIN", active_win);
6623 /* The normal application window is ok to rotate dependent rotation windows.
6624 * But if the notification window which doesn't have accepts_focus such as volume popup
6625 * is the active window, then the illume doesn't rotate dependent windows.
6627 Eina_Bool rot = EINA_FALSE;
6628 if (e_illume_border_is_notification(bd))
6630 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
6640 ELBF(ELBT_ROT, 0, bd->client.win,
6641 "ROT:%d NOTI:%d ACCEPT_FOCUS:%d TAKE_FOCUS:%d",
6643 e_illume_border_is_notification(bd),
6644 bd->client.icccm.accepts_focus,
6645 bd->client.icccm.take_focus);
6649 E_Border *prev_bd = e_border_find_by_client_window(dep_rot.refer.active_win);
6650 ELBF(ELBT_ROT, 0, active_win,
6651 "INDICATOR ACTIVE WIN: [%s(0x%08x) -> %s(0x%08x)]",
6652 prev_bd ? (prev_bd->client.icccm.name ? prev_bd->client.icccm.name : "") : "",
6653 dep_rot.refer.active_win,
6654 bd->client.icccm.name ? bd->client.icccm.name : "",
6656 dep_rot.refer.active_win = active_win;
6657 rotation = bd->client.e.state.rot.curr;
6659 _policy_border_dependent_rotation(bd, rotation);
6664 static Ecore_X_Window
6665 _policy_indicator_cmd_win_get(Ecore_X_Window win)
6667 Ecore_X_Window cmd_win = NULL;
6668 unsigned char* prop_data = NULL;
6669 int ret = 0, count = 0;
6671 if (win != dep_rot.root) return NULL;
6673 ret = ecore_x_window_prop_property_get(win, E_INDICATOR_CMD_WIN,
6674 ECORE_X_ATOM_WINDOW, 32,
6675 &prop_data, &count);
6677 memcpy (&cmd_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6679 if (prop_data) free(prop_data);
6684 static Ecore_X_Window
6685 _policy_active_indicator_win_get(Ecore_X_Window win)
6687 Ecore_X_Window active_win = NULL;
6688 unsigned char* prop_data = NULL;
6689 int ret = 0, count = 0;
6691 if (win != dep_rot.refer.cmd_win) return NULL;
6693 ret = ecore_x_window_prop_property_get(win, E_ACTIVE_INDICATOR_WIN,
6694 ECORE_X_ATOM_WINDOW, 32,
6695 &prop_data, &count);
6697 memcpy (&active_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6699 if (prop_data) free(prop_data);
6705 _prev_angle_get(Ecore_X_Window win)
6707 int ret, count = 0, ang = -1;
6708 unsigned char* data = NULL;
6710 ret = ecore_x_window_prop_property_get
6711 (win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
6712 ECORE_X_ATOM_CARDINAL, 32, &data, &count);
6714 if ((ret) && (data) && (count))
6715 ang = ((int *)data)[0];
6716 if (data) free(data);
6722 _policy_idle_enterer(void)
6724 _policy_calculate_visibility();