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
252 Ecore_X_Window cmd_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);
952 if (dep_rot.refer.active_bd == bd)
953 dep_rot.refer.active_bd = NULL;
957 _policy_border_focus_in(E_Border *bd __UNUSED__)
959 // printf("Border focus in: %s\n", bd->client.icccm.name);
963 _policy_border_focus_out(E_Border *bd)
965 // printf("Border focus out: %s\n", bd->client.icccm.name);
969 /* NB: if we got this focus_out event on a deleted border, we check if
970 * it is a transient (child) of another window. If it is, then we
971 * transfer focus back to the parent window */
972 if (e_object_is_del(E_OBJECT(bd)))
974 if (e_illume_border_is_dialog(bd))
978 if ((parent = e_illume_border_parent_get(bd)))
979 _policy_border_set_focus(parent);
985 _policy_border_activate(E_Border *bd)
987 // printf("Border Activate: %s\n", bd->client.icccm.name);
990 /* NB: stolen borders may or may not need focus call...have to test */
991 if (bd->stolen) return;
993 /* NB: We cannot use our set_focus function here because it does,
994 * occasionally fall through wrt E's focus policy, so cherry pick the good
995 * parts and use here :) */
997 /* if the border is iconified then uniconify if allowed */
998 if ((bd->iconic) && (!bd->lock_user_iconify))
999 e_border_uniconify(bd);
1001 ILLUME2_TRACE ("[ILLUME2] _policy_border_activate.. (%d) ACTIVE WIN = 0x%07x\n", __LINE__, bd->client.win);
1003 /* NB: since we skip needless border evals when container layout
1004 * is called (to save cpu cycles), we need to
1005 * signal this border that it's focused so that the edj gets
1008 * This is potentially useless as THIS policy
1009 * makes all windows borderless anyway, but it's in here for
1011 e_border_focus_latest_set(bd);
1013 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
1014 if (bd->icon_object)
1015 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
1016 e_focus_event_focus_in(bd);
1021 _policy_border_post_fetch(E_Border *bd)
1023 // printf("Border post fetch\n");
1027 /* NB: for this policy we disable all remembers set on a border */
1028 if (bd->remember) e_remember_del(bd->remember);
1029 bd->remember = NULL;
1031 /* set this border to borderless */
1032 #ifdef DIALOG_USES_PIXEL_BORDER
1033 if ((e_illume_border_is_dialog(bd)) && (e_illume_border_parent_get(bd)))
1034 eina_stringshare_replace(&bd->bordername, "pixel");
1038 /* for desktop mode */
1039 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1041 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1043 if (!bd->client.illume.win_state.state)
1050 // for supporting rotation such as quickpanel
1051 if (e_illume_border_is_quickpanel(bd) ||
1052 e_illume_border_is_miniapp_tray(bd) ||
1053 (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) ||
1054 e_illume_border_is_syspopup(bd) ||
1055 e_illume_border_is_app_selector(bd))
1057 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
1059 // TODO: what to do if rotation fetch is changed?
1060 if (!eina_list_data_find(dep_rot.list, bd))
1067 ang = _prev_angle_get(bd->client.win);
1069 bd->client.e.state.rot.curr = ang;
1071 dep_rot.list = eina_list_append(dep_rot.list, bd);
1073 if (dep_rot.refer.active_bd) next_ang = dep_rot.refer.active_bd->client.e.state.rot.curr;
1074 else next_ang = dep_rot.ang;
1076 if (next_ang != bd->client.e.state.rot.curr)
1078 // if this border's new_client flag is set,
1079 // this border's show time should be posted until done of rotation.
1080 // will call "e_border_rotation_set" in main eval of e17
1081 if (_policy_dependent_rotation_check(bd, next_ang))
1082 bd->client.e.state.rot.changes = next_ang;
1087 /* tell E the border has changed */
1088 bd->client.border.changed = 1;
1093 _policy_border_post_new_border(E_Border *bd)
1096 E_Illume_Border_Info* bd_info = NULL;
1100 bd_info = _policy_get_border_info(bd);
1101 if (!bd_info) return;
1103 bd_info->win_type = bd->client.netwm.type;
1105 if (e_illume_border_is_notification(bd))
1107 bd_info->level = _policy_border_get_notification_level(bd->client.win);
1108 layer = _policy_notification_level_map(bd_info->level);
1109 e_border_layer_set(bd, layer);
1110 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
1111 __func__, __LINE__, bd->client.win, bd_info->level);
1117 _check_parent_in_transient_for_tree(E_Border *bd, E_Border *parent_bd)
1121 if (!bd || !parent_bd) return EINA_FALSE;
1123 ancestor = parent_bd;
1124 while (ancestor->parent)
1126 if (ancestor->parent == bd)
1128 // This is very bad. bd and parent_bd are transient_for each other
1130 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);
1132 ELBF(ELBT_ILLUME, 0, bd->client.win, "BAD. Transient_for Error. Parent:0x%07x is descendant", parent_bd->client.win);
1135 ancestor = ancestor->parent;
1142 _policy_border_pre_fetch(E_Border *bd)
1144 #ifdef _F_DEICONIFY_APPROVE_
1145 Eina_Bool change_parent = EINA_TRUE;
1153 state = ecore_x_e_illume_window_state_get(bd->client.win);
1154 _policy_border_illume_window_state_change(bd, state);
1157 /* Below code are same to _e_border_eval0 in e_border.c.
1158 But we added code to handle notification window */
1159 if (bd->client.icccm.fetch.transient_for)
1161 /* TODO: What do to if the transient for isn't mapped yet? */
1162 E_Border *bd_parent = NULL;
1163 E_Illume_XWin_Info *xwin_info = NULL;
1164 Eina_Bool transient_each_other;
1165 Ecore_X_Window transient_for_win;
1167 if (_e_illume_cfg->use_force_iconify)
1168 xwin_info = _policy_xwin_info_find(bd->win);
1170 transient_for_win = ecore_x_icccm_transient_for_get(bd->client.win);
1171 if (bd->client.icccm.transient_for == transient_for_win)
1174 bd->parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
1175 ELBF(ELBT_ILLUME, 0, bd->client.win, "Same transient_for:0x%07x. SKIP...", transient_for_win);
1176 goto transient_fetch_done;
1179 bd->client.icccm.transient_for = transient_for_win;
1180 if (bd->client.icccm.transient_for)
1182 bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
1185 /* If we already have a parent, remove it */
1188 #ifdef _F_DEICONIFY_APPROVE_
1189 if (bd_parent == bd->parent) change_parent = EINA_FALSE;
1191 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
1192 if (bd->parent->modal == bd) bd->parent->modal = NULL;
1196 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);
1199 transient_each_other = _check_parent_in_transient_for_tree(bd, bd_parent);
1200 if (!transient_each_other)
1202 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);
1203 if (_e_illume_cfg->use_force_iconify)
1205 if (!bd_parent->iconic)
1207 if (xwin_info && xwin_info->iconify_by_wm)
1211 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, bd->client.win);
1212 _policy_border_force_uniconify(bd);
1218 if (bd_parent != bd)
1220 bd->parent = bd_parent;
1221 _policy_border_transient_for_layer_set(bd, bd->parent, bd->parent->layer);
1222 bd_parent->transients = eina_list_append(bd_parent->transients, bd);
1224 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
1225 bd->parent->modal = bd;
1227 if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
1228 (bd->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
1234 #ifdef _F_DEICONIFY_APPROVE_
1237 E_Border *ancestor_bd;
1238 bd->client.e.state.deiconify_approve.render_done = 0;
1240 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
1241 if ((ancestor_bd) &&
1242 (!e_object_is_del(E_OBJECT(ancestor_bd))))
1244 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
1245 bd->client.e.state.deiconify_approve.ancestor = NULL;
1247 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
1248 (ancestor_bd->client.e.state.deiconify_approve.render_done))
1250 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
1252 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
1253 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
1254 e_border_uniconify(ancestor_bd);
1261 transient_fetch_done:
1262 bd->client.icccm.fetch.transient_for = 0;
1267 _policy_border_new_border(E_Border *bd)
1272 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
1274 _policy_add_border_info_list(bd);
1277 #ifdef _F_BORDER_HOOK_PATCH_
1279 _policy_border_del_border(E_Border *bd)
1285 _policy_border_del(bd);
1291 _policy_border_post_assign(E_Border *bd)
1293 // printf("Border post assign\n");
1296 if (!bd->new_client) return;
1298 bd->internal_no_remember = 1;
1300 /* do not allow client to change these properties */
1301 bd->lock_client_shade = 1;
1303 if (e_illume_border_is_utility (bd))
1305 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... win(0x%07x) is UTILITY type.. SET REQUEST_POS!!!\n", __func__, __LINE__, bd->client.win);
1306 bd->client.icccm.request_pos = 1;
1309 /* do not allow the user to change these properties */
1310 /* for desktop mode */
1311 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1313 if (bd->client.illume.win_state.state)
1315 bd->lock_user_location = 0;
1316 bd->lock_user_size = 0;
1320 bd->lock_user_location = 1;
1321 bd->lock_user_size = 1;
1323 bd->lock_user_shade = 1;
1324 if (bd->client.icccm.request_pos == 0)
1327 bd->changes.pos = 1;
1331 bd->lock_user_shade = 1;
1333 /* clear any centered states */
1334 /* NB: this is mainly needed for E's main config dialog */
1335 bd->client.e.state.centered = 0;
1337 /* lock the border type so user/client cannot change */
1338 bd->lock_border = 1;
1342 _policy_border_show(E_Border *bd)
1346 /* make sure we have a name so that we don't handle windows like E's root */
1347 if (!bd->client.icccm.name) return;
1349 // printf("Border Show: %s\n", bd->client.icccm.class);
1351 /* trap for special windows so we can ignore hides below them */
1352 if (e_illume_border_is_indicator(bd)) return;
1353 if (e_illume_border_is_quickpanel(bd)) return;
1354 if (e_illume_border_is_quickpanel_popup(bd)) return;
1356 if (e_illume_border_is_keyboard(bd))
1359 angle = _policy_window_rotation_angle_get(bd->client.win);
1362 if (angle != g_root_angle)
1364 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);
1365 ecore_x_client_message32_send(bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
1366 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, g_root_angle, g_active_win, 0, 0, 0);
1373 if (e_illume_border_is_clipboard(bd))
1375 ecore_x_e_illume_clipboard_state_set(bd->zone->black_win, ECORE_X_ILLUME_CLIPBOARD_STATE_ON);
1376 ecore_x_e_illume_clipboard_geometry_set(bd->zone->black_win, bd->x, bd->y, bd->w, bd->h);
1380 if (eina_list_data_find(dep_rot.list, bd) == bd)
1384 if (dep_rot.refer.active_bd) next_ang = dep_rot.refer.active_bd->client.e.state.rot.curr;
1385 else next_ang = dep_rot.ang;
1387 if (bd->client.e.state.rot.curr != next_ang)
1388 e_border_rotation_set(bd, next_ang);
1393 _policy_border_cb_move(E_Border *bd)
1397 if (e_illume_border_is_app_tray(bd) ||
1398 e_illume_border_is_miniapp_tray(bd))
1400 _policy_border_focus_top_stack_set(bd);
1407 _policy_zone_layout(E_Zone *zone)
1409 E_Illume_Config_Zone *cz;
1413 // printf("Zone Layout: %d\n", zone->id);
1417 /* get the config for this zone */
1418 cz = e_illume_zone_config_get(zone->id);
1421 /* loop through border list and update layout */
1422 E_Illume_Border_Info* bd_info;
1423 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
1425 if (!bd_info) continue;
1427 bd = bd_info->border;
1429 /* skip borders that are being deleted */
1430 if (e_object_is_del(E_OBJECT(bd))) continue;
1432 /* skip borders not on this zone */
1433 if (bd->zone != zone) continue;
1435 /* only update layout for this border if it really needs it */
1436 if ((!bd->new_client) && (!bd->changes.pos) && (!bd->changes.size) &&
1437 (!bd->changes.visible) && (!bd->pending_move_resize) &&
1438 (!bd->need_shape_export) && (!bd->need_shape_merge)) continue;
1440 /* are we laying out an indicator ? */
1441 if (e_illume_border_is_indicator(bd))
1442 _policy_zone_layout_indicator(bd, cz);
1444 /* are we layout out a quickpanel ? */
1445 else if (e_illume_border_is_quickpanel(bd))
1446 _policy_zone_layout_quickpanel(bd);
1448 else if (e_illume_border_is_quickpanel_popup(bd))
1449 _policy_zone_layout_quickpanel_popup(bd);
1451 /* are we laying out a keyboard ? */
1452 else if (e_illume_border_is_keyboard(bd))
1453 _policy_zone_layout_keyboard(bd, cz);
1455 else if (e_illume_border_is_keyboard_sub(bd))
1456 _policy_zone_layout_keyboard(bd, cz);
1458 /* are we laying out a fullscreen window ? */
1459 /* NB: we could use the e_illume_border_is_fullscreen function here
1460 * but we save ourselves a function call this way. */
1461 else if ((bd->fullscreen) || (bd->need_fullscreen))
1462 _policy_zone_layout_fullscreen(bd);
1464 /* are we laying out a dialog ? */
1465 else if (e_illume_border_is_dialog(bd))
1466 _policy_zone_layout_dialog(bd, cz);
1468 else if (e_illume_border_is_splash(bd))
1469 _policy_zone_layout_splash(bd, cz);
1471 else if (e_illume_border_is_clipboard(bd))
1472 _policy_zone_layout_clipboard(bd, cz);
1474 else if (e_illume_border_is_app_tray(bd))
1475 _policy_zone_layout_apptray(bd);
1477 else if (e_illume_border_is_miniapp_tray(bd))
1478 _policy_zone_layout_miniapptray(bd);
1480 /* must be an app */
1483 /* are we in single mode ? */
1486 /* for desktop mode */
1487 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
1488 _policy_zone_layout_app_single_new(bd_info, cz);
1489 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
1490 _policy_zone_layout_app_single_monitor(bd_info, cz);
1492 _policy_zone_layout_app_single_new(bd_info, cz);
1496 /* we are in dual-mode, check orientation */
1497 if (cz->mode.side == 0)
1501 /* grab the indicator position so we can tell if it
1502 * is in a custom position or not (user dragged it) */
1503 e_illume_border_indicator_pos_get(bd->zone, NULL, &ty);
1504 if (ty <= bd->zone->y)
1505 _policy_zone_layout_app_dual_top_new (bd_info, cz);
1507 _policy_zone_layout_app_dual_custom_new (bd_info, cz);
1510 _policy_zone_layout_app_dual_left_new (bd_info, cz);
1517 _policy_zone_move_resize(E_Zone *zone)
1522 // printf("Zone move resize\n");
1526 ecore_x_window_size_get (zone->container->manager->root, &_g_root_width, &_g_root_height);
1528 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
1531 /* skip borders not on this zone */
1532 if (bd->zone != zone) continue;
1534 /* signal a changed pos here so layout gets updated */
1535 bd->changes.pos = 1;
1541 _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode)
1543 E_Illume_Config_Zone *cz;
1546 // printf("Zone mode change: %d\n", zone->id);
1550 /* get the config for this zone */
1551 cz = e_illume_zone_config_get(zone->id);
1554 /* update config with new mode */
1555 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
1560 if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
1562 else if (mode == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
1565 e_config_save_queue();
1567 /* lock indicator window from dragging if we need to */
1568 bd = e_illume_border_indicator_get(zone);
1571 /* only dual-top mode can drag */
1572 if ((cz->mode.dual == 1) && (cz->mode.side == 0))
1574 /* only set locked if we need to */
1575 if (bd->client.illume.drag.locked != 0)
1576 ecore_x_e_illume_drag_locked_set(bd->client.win, 0);
1580 /* only set locked if we need to */
1581 if (bd->client.illume.drag.locked != 1)
1582 ecore_x_e_illume_drag_locked_set(bd->client.win, 1);
1586 /* Need to trigger a layout update here */
1587 _policy_zone_layout_update(zone);
1591 _policy_zone_close(E_Zone *zone)
1595 // printf("Zone close\n");
1599 /* make sure we have a focused border */
1600 if (!(bd = e_border_focused_get())) return;
1602 /* make sure focused border is on this zone */
1603 if (bd->zone != zone) return;
1605 /* close this border */
1606 e_border_act_close_begin(bd);
1610 _policy_drag_start(E_Border *bd)
1612 // printf("Drag start\n");
1616 /* ignore stolen borders */
1617 if (bd->stolen) return;
1619 if (!bd->visible) return;
1621 /* set property on this border to say we are dragging */
1622 ecore_x_e_illume_drag_set(bd->client.win, 1);
1624 /* set property on zone window that a drag is happening */
1625 ecore_x_e_illume_drag_set(bd->zone->black_win, 1);
1629 _policy_drag_end(E_Border *bd)
1631 // printf("Drag end\n");
1635 /* ignore stolen borders */
1636 if (bd->stolen) return;
1638 /* set property on this border to say we are done dragging */
1639 ecore_x_e_illume_drag_set(bd->client.win, 0);
1641 /* set property on zone window that a drag is finished */
1642 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
1646 _policy_resize_start(E_Illume_Border_Info *bd_info)
1653 const char buf[PATH_MAX];
1655 bd = bd_info->border;
1658 if (bd->stolen) return;
1659 if (!bd->client.illume.win_state.state) return;
1660 if (!bd_info->resize_req.mouse.down) return;
1662 bd_info->resize_req.need_change = 0;
1663 bd_info->resize_req.mouse.locked = 1;
1664 bd_info->resize_req.mouse.resize = 1;
1665 int ang = _policy_window_rotation_angle_get(bd->client.win);
1666 if (ang == -1) ang = 0;
1667 bd_info->resize_req.angle = ang;
1669 m = e_manager_current_get();
1671 canvas = e_manager_comp_evas_get(m);
1672 if (!canvas) return;
1674 o = edje_object_add(canvas);
1675 snprintf(buf, sizeof(buf), "%s/e-module-illume2-tizen.edj", _e_illume_mod_dir);
1676 evas_object_image_border_center_fill_set(o, EVAS_BORDER_FILL_NONE);
1677 if(!(edje_object_file_set(o, buf, "new_shadow"))
1678 || !(bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
1680 o = evas_object_rectangle_add(canvas);
1681 evas_object_color_set(o, 100, 100, 100, 100);
1684 nx = bd->x - bd->zone->x;
1685 ny = bd->y - bd->zone->y;
1686 evas_object_move(o, nx, ny);
1687 evas_object_resize(o, bd->w, bd->h);
1688 e_object_data_set(E_OBJECT(bd), o);
1689 evas_object_show(o);
1693 _policy_resize_end(E_Illume_Border_Info *bd_info)
1696 bd = bd_info->border;
1700 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
1701 if (o) evas_object_del(o);
1703 if (bd->stolen) return;
1704 if (!bd->client.illume.win_state.state) return;
1705 if (!bd_info->resize_req.mouse.down) return;
1707 bd_info->resize_req.mouse.locked = 0;
1708 bd_info->resize_req.mouse.resize = 0;
1712 _policy_focus_back(E_Zone *zone)
1714 Eina_List *l, *fl = NULL;
1718 if (eina_list_count(_pol_focus_stack) < 1) return;
1720 // printf("Focus back\n");
1722 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1725 if (bd->zone != zone) continue;
1726 fl = eina_list_append(fl, bd);
1729 if (!(fbd = e_border_focused_get())) return;
1730 if (fbd->parent) return;
1732 EINA_LIST_REVERSE_FOREACH(fl, l, bd)
1734 if ((fbd) && (bd == fbd))
1738 if ((l->next) && (b = l->next->data))
1740 _policy_border_set_focus(b);
1745 /* we've reached the end of the list. Set focus to first */
1746 if ((b = eina_list_nth(fl, 0)))
1748 _policy_border_set_focus(b);
1758 _policy_focus_forward(E_Zone *zone)
1760 Eina_List *l, *fl = NULL;
1764 if (eina_list_count(_pol_focus_stack) < 1) return;
1766 // printf("Focus forward\n");
1768 EINA_LIST_FOREACH(_pol_focus_stack, l, bd)
1771 if (bd->zone != zone) continue;
1772 fl = eina_list_append(fl, bd);
1775 if (!(fbd = e_border_focused_get())) return;
1776 if (fbd->parent) return;
1778 EINA_LIST_FOREACH(fl, l, bd)
1780 if ((fbd) && (bd == fbd))
1784 if ((l->next) && (b = l->next->data))
1786 _policy_border_set_focus(b);
1791 /* we've reached the end of the list. Set focus to first */
1792 if ((b = eina_list_nth(fl, 0)))
1794 _policy_border_set_focus(b);
1803 /* enable/disable composite module - 100320 yigl */
1804 #ifdef COMP_MODULE_CONTROL
1806 _policy_property_composite_module_change(Ecore_X_Event_Window_Property *ev)
1810 int current_enabled = 0;
1811 unsigned char* prop_data = NULL;
1812 E_Module* comp = NULL;
1814 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_COMP_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1815 if( ret && prop_data )
1817 memcpy (&enable, prop_data, sizeof (int));
1818 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1820 comp = e_module_find ("comp-tizen");
1823 current_enabled = e_module_enabled_get(comp);
1824 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1826 if( current_enabled && !enable )
1828 fprintf( stdout, "e_module_disable(comp-tizen) " );
1829 e_module_disable(comp);
1831 else if( !current_enabled && enable )
1833 fprintf( stdout, "e_module_enable(comp-tizen) " );
1834 e_module_enable(comp);
1838 fprintf( stdout, "skip... " );
1841 fprintf( stdout, "\n" );
1845 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find comp module.\n", __func__, __LINE__ );
1849 if (prop_data) free (prop_data);
1854 /* enable/disable backkey module - 130610 seongwon1.cho */
1855 #ifdef BACKKEY_MODULE_CONTROL
1857 _policy_property_backkey_module_change(Ecore_X_Event_Window_Property *ev)
1861 int current_enabled = 0;
1862 unsigned char* prop_data = NULL;
1863 E_Module* backkey = NULL;
1865 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1866 if( ret && prop_data )
1868 memcpy (&enable, prop_data, sizeof (int));
1869 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1871 backkey = e_module_find ("backkey-tizen");
1874 current_enabled = e_module_enabled_get(backkey);
1875 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1877 if( current_enabled && !enable )
1879 fprintf( stdout, "e_module_disable(backkey-tizen) " );
1880 e_module_disable(backkey);
1882 else if( !current_enabled && enable )
1884 fprintf( stdout, "e_module_enable(backkey-tizen) " );
1885 e_module_enable(backkey);
1889 fprintf( stdout, "skip... " );
1892 fprintf( stdout, "\n" );
1896 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find backkey module.\n", __func__, __LINE__ );
1897 backkey = e_module_new("backkey-tizen");
1898 if (backkey) e_module_enable(backkey);
1902 if (prop_data) free (prop_data);
1908 /* enable/disable devmode module - 130610 seongwon1.cho */
1909 #ifdef DEVMODE_MODULE_CONTROL
1911 _policy_property_devmode_module_change(Ecore_X_Event_Window_Property *ev)
1915 int current_enabled = 0;
1916 unsigned char* prop_data = NULL;
1917 E_Module* devmode = NULL;
1919 ret = ecore_x_window_prop_property_get (ev->win, E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
1920 if( ret && prop_data )
1922 memcpy (&enable, prop_data, sizeof (int));
1923 fprintf( stdout, "[E17-illume2-tizen] %s(%d) enable: %s ", __func__, __LINE__, enable ? "true" : "false" );
1925 devmode = e_module_find ("devmode-tizen");
1928 current_enabled = e_module_enabled_get(devmode);
1929 fprintf( stdout, "current: %s ", current_enabled ? "true" : "false" );
1931 if( current_enabled && !enable )
1933 fprintf( stdout, "e_module_disable(devmode-tizen) " );
1934 e_module_disable(devmode);
1936 else if( !current_enabled && enable )
1938 fprintf( stdout, "e_module_enable(devmode-tizen) " );
1939 e_module_enable(devmode);
1943 fprintf( stdout, "skip... " );
1946 fprintf( stdout, "\n" );
1950 fprintf( stderr, "\n[E17-illume2-tizen] %s(%d) can't find devmode module.\n", __func__, __LINE__ );
1951 devmode = e_module_new("devmode-tizen");
1952 if (devmode) e_module_enable(devmode);
1956 if (prop_data) free (prop_data);
1962 static void _policy_property_window_state_change (Ecore_X_Event_Window_Property *event)
1964 E_Border *bd, *indi_bd;
1966 if (!(bd = e_border_find_by_client_window(event->win))) return;
1968 /* not interested in stolen or invisible borders */
1969 if ((bd->stolen) || (!bd->visible)) return;
1971 /* make sure the border has a name or class */
1972 /* NB: this check is here because some E borders get State Changes
1973 * but do not have a name/class associated with them. Not entirely sure
1974 * which ones they are, but I would guess Managers, Containers, or Zones.
1975 * At any rate, we're not interested in those types of borders */
1976 if ((!bd->client.icccm.name) || (!bd->client.icccm.class)) return;
1978 /* NB: If we have reached this point, then it should be a fullscreen
1979 * border that has toggled fullscreen on/off */
1981 /* if the window is not active window, then it doesn't need to hande indicator */
1982 if (g_active_win != bd->client.win) return;
1984 /* try to get the Indicator on this zone */
1985 if (!(indi_bd = e_illume_border_indicator_get(bd->zone))) return;
1987 /* if we are fullscreen, hide the indicator...else we show it */
1988 /* NB: we could use the e_illume_border_is_fullscreen function here
1989 * but we save ourselves a function call this way */
1990 if ((bd->fullscreen) || (bd->need_fullscreen))
1992 if (indi_bd->visible)
1994 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
1995 e_border_hide(indi_bd, 2);
2000 int indi_show = _policy_border_indicator_state_get(bd);
2003 if (!indi_bd->visible)
2005 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
2006 e_border_show(indi_bd);
2013 static void _policy_property_indicator_geometry_change (Ecore_X_Event_Window_Property *event)
2020 /* make sure this property changed on a zone */
2021 if (!(zone = e_util_zone_window_find(event->win))) return;
2023 /* get the geometry */
2024 if (!(bd = e_illume_border_indicator_get(zone))) return;
2030 /* look for conformant borders */
2031 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2034 if (bd->zone != zone) continue;
2035 if (!e_illume_border_is_conformant(bd)) continue;
2036 /* set indicator geometry on conformant window */
2037 /* NB: This is needed so that conformant apps get told about
2038 * the indicator size/position...else they have no way of
2039 * knowing that the geometry has been updated */
2040 ecore_x_e_illume_indicator_geometry_set(bd->client.win, x, y, w, h);
2044 static void _policy_property_clipboard_geometry_change (Ecore_X_Event_Window_Property *event)
2051 /* make sure this property changed on a zone */
2052 if (!(zone = e_util_zone_window_find(event->win))) return;
2054 ecore_x_e_illume_clipboard_geometry_get(zone->black_win, &x, &y, &w, &h);
2056 /* look for conformant borders */
2057 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2060 if (bd->zone != zone) continue;
2061 if (e_illume_border_is_indicator(bd)) continue;
2062 if (e_illume_border_is_keyboard(bd)) continue;
2063 if (e_illume_border_is_keyboard_sub(bd)) continue;
2064 if (e_illume_border_is_quickpanel(bd)) continue;
2065 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2068 SECURE_SLOGD("[WM] Clipboard geometry set. win:0x%07x, geo(%d,%d,%d,%d)", bd->client.win, x, y, w, h);
2070 ecore_x_e_illume_clipboard_geometry_set(bd->client.win, x, y, w, h);
2074 static void _policy_property_clipboard_state_change (Ecore_X_Event_Window_Property *event)
2079 Ecore_X_Illume_Clipboard_State state;
2081 /* make sure this property changed on a zone */
2082 if (!(zone = e_util_zone_window_find(event->win))) return;
2084 state = ecore_x_e_illume_clipboard_state_get(zone->black_win);
2086 /* look for conformant borders */
2087 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
2090 if (bd->zone != zone) continue;
2091 if (e_illume_border_is_indicator(bd)) continue;
2092 if (e_illume_border_is_keyboard(bd)) continue;
2093 if (e_illume_border_is_keyboard_sub(bd)) continue;
2094 if (e_illume_border_is_quickpanel(bd)) continue;
2095 if (e_illume_border_is_quickpanel_popup(bd)) continue;
2098 SECURE_SLOGD("[WM] Clipboard state set. win:0x%07x, state:%d", bd->client.win, state);
2100 ecore_x_e_illume_clipboard_state_set(bd->client.win, state);
2104 static void _policy_property_enlightenment_scale_change (Ecore_X_Event_Window_Property *event)
2109 EINA_LIST_FOREACH(e_manager_list(), ml, man)
2115 if (event->win != man->root) continue;
2116 EINA_LIST_FOREACH(man->containers, cl, con)
2122 EINA_LIST_FOREACH(con->zones, zl, zone)
2123 _policy_zone_layout_update(zone);
2128 static void _policy_property_rotate_win_angle_change (Ecore_X_Event_Window_Property *event)
2131 E_Illume_XWin_Info* xwin_info;
2133 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. win:0x%07x\n", __func__, __LINE__, event->win);
2135 if (!(bd = e_border_find_by_client_window(event->win))) return;
2137 xwin_info = _policy_xwin_info_find (bd->win);
2140 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
2142 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. CALL _policy_change_root_angle_by_border_angle!!! win:0x%07x\n", __func__, __LINE__, bd->client.win);
2143 _policy_change_root_angle_by_border_angle (bd);
2147 bd->changes.pos = 1;
2151 static void _policy_property_indicator_state_change (Ecore_X_Event_Window_Property *event)
2153 E_Border *bd, *indi_bd;
2155 if (!(bd = e_border_find_by_client_window(event->win))) return;
2157 indi_bd = e_illume_border_indicator_get(bd->zone);
2158 if (!indi_bd) return;
2160 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2161 _policy_border_indicator_control(indi_bd);
2164 static void _policy_property_indicator_opacity_change(Ecore_X_Event_Window_Property *event)
2166 E_Border *bd, *indi_bd;
2167 Ecore_X_Window active_win;
2168 Ecore_X_Illume_Indicator_Opacity_Mode mode;
2170 if (!(bd = e_border_find_by_client_window(event->win))) return;
2172 indi_bd = e_illume_border_indicator_get(bd->zone);
2173 if (!indi_bd) return;
2175 active_win = _policy_active_window_get(bd->zone->container->manager->root);
2176 if (active_win == bd->client.win)
2178 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
2179 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
2183 static void _policy_active_win_change(E_Illume_XWin_Info *xwin_info, Ecore_X_Window active_win)
2185 E_Border *active_bd = NULL;
2188 if (!xwin_info) return;
2189 if (!xwin_info->comp_vis) return;
2191 active_bd = e_border_find_by_client_window(active_win);
2193 /* for active/deactive message */
2194 if (active_win != g_active_win)
2197 active_pid = active_bd->client.netwm.pid;
2201 // 1. send deactive event to g_active_win
2202 ecore_x_client_message32_send(g_active_win, E_ILLUME_ATOM_DEACTIVATE_WINDOW,
2203 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2205 // 2. send active event to active_win
2206 ecore_x_client_message32_send(active_win, E_ILLUME_ATOM_ACTIVATE_WINDOW,
2207 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, active_win, active_pid, g_active_win, g_active_pid, 0);
2213 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2215 if ((E_ILLUME_BORDER_IS_IN_DESKTOP(active_bd)) ||
2216 (active_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING))
2218 e_border_raise(active_bd);
2224 SECURE_SLOGD("[WM] ACT WIN 0x%07x(%d) -> 0x%07x(%d)", g_active_win, g_active_pid, active_win, active_pid);
2227 g_active_win = active_win;
2228 g_active_pid = active_pid;
2233 if (_e_illume_cfg->use_indicator_widget)
2235 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
2236 _policy_border_root_angle_control(active_bd->zone);
2241 indi_bd = e_illume_border_indicator_get(active_bd->zone);
2244 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, active_bd->client.win);
2245 _policy_border_indicator_control(indi_bd);
2249 ILLUME2_TRACE ("[ILLUME2] ACTIVE WINDOW... (%d) active win = 0x%07x HIDE quickpanel\n", __LINE__, active_win);
2250 e_illume_quickpanel_hide(active_bd->zone, 0);
2254 static void _policy_property_active_win_change (Ecore_X_Event_Window_Property *event)
2256 Ecore_X_Window active_win;
2257 E_Border* active_bd;
2258 E_Illume_XWin_Info *xwin_info;
2260 active_win = _policy_active_window_get(event->win);
2261 active_bd = e_border_find_by_client_window(active_win);
2264 xwin_info = _policy_xwin_info_find(active_bd->win);
2268 xwin_info = _policy_xwin_info_find(active_win);
2271 _policy_active_win_change(xwin_info, active_win);
2274 static void _policy_property_win_type_change (Ecore_X_Event_Window_Property *event)
2278 E_Illume_Border_Info* bd_info = NULL;
2281 if (!(bd = e_border_find_by_client_window(event->win))) return;
2283 bd_info = _policy_get_border_info(bd);
2284 if (!bd_info) return;
2286 e_hints_window_type_get (bd);
2288 if (bd_info->win_type == bd->client.netwm.type) return;
2289 bd_info->win_type = bd->client.netwm.type;
2291 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2293 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NOTIFICATION!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2294 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2295 layer = _policy_notification_level_map(bd_info->level);
2296 e_border_layer_set(bd, layer);
2298 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n", __func__, __LINE__, bd->client.win, bd_info->level);
2300 indi_bd = e_illume_border_indicator_get(bd->zone);
2303 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2304 _policy_border_indicator_control(indi_bd);
2307 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2308 _policy_border_uniconify_top_border(bd);
2310 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL)
2312 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WINDOW TYPE is CHANGED to NORMAL!!!!! win = 0x%07x\n", __func__, __LINE__, bd->client.win);
2313 if (bd->layer != POL_APP_LAYER)
2315 if ( (!e_illume_border_is_quickpanel(bd)) &&
2316 (!e_illume_border_is_quickpanel_popup(bd)) &&
2317 (!e_illume_border_is_keyboard(bd)) &&
2318 (!e_illume_border_is_keyboard_sub(bd)))
2320 e_border_layer_set(bd, POL_APP_LAYER);
2324 indi_bd = e_illume_border_indicator_get(bd->zone);
2327 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2328 _policy_border_indicator_control(indi_bd);
2331 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2332 _policy_border_uniconify_top_border(bd);
2334 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY)
2336 bd->client.icccm.request_pos = 1;
2338 if (bd->layer != POL_APP_LAYER)
2339 e_border_layer_set(bd, POL_APP_LAYER);
2344 static void _policy_property_rotate_root_angle_change (Ecore_X_Event_Window_Property *event)
2351 unsigned char *prop_data = NULL;
2354 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);
2355 if( ret && prop_data )
2356 memcpy (&angle, prop_data, sizeof (int));
2358 if (prop_data) free (prop_data);
2360 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. ROOT ANGLE CHANGED... angle = %d. control_win:0x%07x\n", __func__, __LINE__, angle, g_indi_control_win);
2361 bd = e_border_find_by_client_window(g_indi_control_win);
2363 if (bd) zone = bd->zone;
2364 else zone = e_util_container_zone_number_get (0, 0);
2368 // send client message to all visible windows
2369 if (g_root_angle != angle)
2371 indi_bd = e_illume_border_indicator_get(zone);
2374 _policy_indicator_angle_change (indi_bd, angle);
2380 EINA_LIST_FOREACH(e_border_client_list(), l, bd_temp)
2382 if (!bd_temp) continue;
2383 if (!bd_temp->visible && !bd_temp->iconic)
2385 if (!e_illume_border_is_keyboard(bd_temp))
2389 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win = 0x%07x.. SEND client Event with angle = %d\n", __func__, __LINE__, bd_temp->client.win, angle);
2390 ecore_x_client_message32_send (bd_temp->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
2391 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, angle, g_indi_control_win, 0, 0, 0);
2394 if (_e_illume_cfg->use_indicator_widget)
2396 E_Illume_Quickpanel *qp;
2397 qp = e_illume_quickpanel_by_zone_get(zone);
2399 _policy_layout_quickpanel_rotate(qp, angle);
2402 e_illume_util_hdmi_rotation (event->win, angle);
2406 g_root_angle = angle;
2409 static void _policy_property_notification_level_change (Ecore_X_Event_Window_Property *event)
2412 0. Check if border is exist or not
2413 1. Check if a window is notification or not
2414 2. Get and Set level
2417 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... E_ILLUME_ATOM_NOTIFICATION_LEVEL property!!! win = 0x%07x\n", __func__, __LINE__, event->win);
2421 E_Illume_Border_Info *bd_info = NULL;
2425 if (!(bd = e_border_find_by_client_window(event->win)))
2427 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... Win (0x%07x) doesn't have border... So return..\n", __func__, __LINE__, event->win);
2431 bd_info = _policy_get_border_info(bd);
2432 if (!bd_info) return;
2435 if (!e_illume_border_is_notification (bd))
2437 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);
2442 bd_info->level = _policy_border_get_notification_level(bd->client.win);
2443 layer = _policy_notification_level_map(bd_info->level);
2446 e_border_layer_set(bd, layer);
2447 L (LT_NOTIFICATION, "[ILLUME2][NOTIFICATION] %s(%d)... win (0x%07x) is notification window... level = %d\n",
2448 __func__, __LINE__, bd->client.win, bd_info->level);
2451 indi_bd = e_illume_border_indicator_get(bd->zone);
2454 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2455 _policy_border_indicator_control(indi_bd);
2458 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
2459 _policy_border_uniconify_top_border(bd);
2462 static void _policy_property_overlay_win_change (Ecore_X_Event_Window_Property *event)
2466 unsigned char* prop_data = NULL;
2468 ret = ecore_x_window_prop_property_get (event->win, E_ILLUME_ATOM_OVERAY_WINDOW, ECORE_X_ATOM_WINDOW, 32, &prop_data, &count);
2469 if( ret && prop_data )
2470 memcpy (&_e_overlay_win, prop_data, sizeof (ECORE_X_ATOM_WINDOW));
2472 if (prop_data) free (prop_data);
2474 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d)... OVERAY_WINDOW:0x%07x\n", __func__, __LINE__, _e_overlay_win);
2475 _policy_xwin_info_delete (_e_overlay_win);
2478 static int _policy_property_window_opaque_get (Ecore_X_Window win)
2483 unsigned char* prop_data = NULL;
2485 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_WINDOW_OPAQUE, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
2486 if( ret && prop_data )
2487 memcpy (&is_opaque, prop_data, sizeof (ECORE_X_ATOM_CARDINAL));
2489 if (prop_data) free (prop_data);
2494 static void _policy_property_window_opaque_change (Ecore_X_Event_Window_Property *event)
2497 E_Illume_Border_Info* bd_info;
2499 if (!(bd = e_border_find_by_client_window(event->win))) return;
2502 bd_info = _policy_get_border_info (bd);
2503 if (!bd_info) return;
2505 // set current property
2506 bd_info->opaque = _policy_property_window_opaque_get (event->win);
2508 // visibility is changed
2509 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
2510 _g_visibility_changed = EINA_TRUE;
2514 _policy_property_illume_window_state_change(Ecore_X_Event_Window_Property *event)
2518 if (!(bd = e_border_find_by_client_window(event->win))) return;
2519 if (bd->stolen) return;
2521 unsigned int state = ecore_x_e_illume_window_state_get(event->win);
2522 _policy_border_illume_window_state_change(bd, state);
2526 _policy_border_illume_window_state_change(E_Border *bd, unsigned int state)
2531 if (bd->client.illume.win_state.state == state) return;
2533 ELBF(ELBT_ILLUME, 0, bd->client.win, "SET WIN_STATE %d->%d",
2534 bd->client.illume.win_state.state, state);
2536 bd->client.illume.win_state.state = state;
2539 case ECORE_X_ILLUME_WINDOW_STATE_FLOATING:
2540 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_ADD);
2542 if (_e_illume_cfg->use_force_iconify)
2543 _policy_border_uniconify_below_borders(bd);
2545 bd->client.icccm.request_pos = EINA_TRUE;
2546 bd->lock_user_size = 0;
2547 bd->lock_user_location = 0;
2551 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
2553 indi_bd = e_illume_border_indicator_get(bd->zone);
2556 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2557 _policy_border_indicator_control(indi_bd);
2560 // will be check below condition as new_client in post_fetch time,
2562 if ((!bd->new_client) &&
2563 (!eina_list_data_find(dep_rot.list, bd)))
2567 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_DEPENDENT;
2568 dep_rot.list = eina_list_append(dep_rot.list, bd);
2570 if (dep_rot.refer.active_bd) next_ang = dep_rot.refer.active_bd->client.e.state.rot.curr;
2571 else next_ang = dep_rot.ang;
2573 if (next_ang != bd->client.e.state.rot.curr)
2574 e_border_rotation_set(bd, next_ang);
2578 case ECORE_X_ILLUME_WINDOW_STATE_NORMAL:
2579 e_hints_window_state_update(bd, ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_ACTION_REMOVE);
2581 if (E_ILLUME_BORDER_IS_IN_MOBILE(bd))
2583 bd->lock_user_size = 1;
2584 bd->lock_user_location = 1;
2586 else if (E_ILLUME_BORDER_IS_IN_DESKTOP(bd))
2591 bd->client.icccm.request_pos = EINA_FALSE;
2593 indi_bd = e_illume_border_indicator_get(bd->zone);
2596 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, bd->client.win);
2597 _policy_border_indicator_control(indi_bd);
2600 if (eina_list_data_find(dep_rot.list, bd) == bd)
2602 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_NORMAL;
2603 dep_rot.list = eina_list_remove(dep_rot.list, bd);
2607 bd->changes.size = 1;
2608 bd->changes.pos = 1;
2613 _policy_border_illume_handlers_add(E_Illume_Border_Info *bd_info)
2615 if (!bd_info) return;
2616 if (bd_info->handlers) return;
2618 bd_info->handlers = eina_list_append(bd_info->handlers,
2619 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
2620 _policy_border_cb_mouse_up, bd_info));
2621 bd_info->handlers = eina_list_append(bd_info->handlers,
2622 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
2623 _policy_border_cb_mouse_move, bd_info));
2627 _policy_border_illume_handlers_remove(E_Illume_Border_Info *bd_info)
2629 Ecore_Event_Handler *hdl;
2631 if (!bd_info) return;
2632 if (!bd_info->handlers) return;
2634 EINA_LIST_FREE(bd_info->handlers, hdl)
2635 ecore_event_handler_del(hdl);
2639 _policy_border_cb_mouse_down(void *data,
2640 int type __UNUSED__,
2643 Ecore_Event_Mouse_Button *ev;
2644 E_Illume_Border_Info *bd_info;
2647 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2650 bd = bd_info->border;
2652 if (ev->window != bd->event_win &&
2653 ev->event_window != bd->event_win)
2654 return ECORE_CALLBACK_PASS_ON;
2656 if (bd_info->resize_req.mouse.down)
2657 return ECORE_CALLBACK_PASS_ON;
2659 bd_info->resize_req.mouse.down = 1;
2661 bd_info->resize_req.mouse.dx = bd->x - ev->root.x;
2662 bd_info->resize_req.mouse.dy = bd->y - ev->root.y;
2664 bd_info->resize_req.mouse.x = bd->x;
2665 bd_info->resize_req.mouse.y = bd->y;
2668 ecore_x_mouse_down_send(bd->client.win, ev->x, ev->y, ev->buttons);
2670 return ECORE_CALLBACK_PASS_ON;
2674 _resize_rect_geometry_get(E_Illume_Border_Info *bd_info,
2675 Evas_Coord_Rectangle *r,
2679 E_Resizable_Area_Info *area)
2682 int x = 0, y = 0, w = 0, h = 0;
2688 bd = bd_info->border;
2690 e_illume_border_min_get(bd, &mw, &mh);
2691 // min_size is workaround adjustement due to some window's wrong w h after rotation is changed.
2692 if(mw < min_size) mw = min_size;
2693 if(mh < min_size) mh = min_size;
2695 if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BR)
2697 switch (bd_info->resize_req.angle)
2700 cx = bd->x; cy = bd->y;
2701 x = bd->x; y = bd->y;
2702 w = ev_x - bd->x; h = ev_y - bd->y;
2705 cx = bd->x; cy = bd->y + bd->h;
2706 x = bd->x; y = ev_y;
2707 w = ev_x - x; h = (bd->y + bd->h) - y;
2710 cx = bd->x + bd->w; cy = bd->y + bd->h;
2712 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2715 cx = bd->x + bd->w; cy = bd->y;
2716 x = ev_x; y = bd->y;
2717 w = (bd->x + bd->w) - x; h = ev_y - y;
2723 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TL)
2725 switch (bd_info->resize_req.angle)
2728 cx = bd->x + bd->w; cy = bd->y + bd->h;
2730 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2733 cx = bd->x + bd->w; cy = bd->y;
2734 x = ev_x; y = bd->y;
2735 w = (bd->x + bd->w) - x; h = ev_y - y;
2738 cx = bd->x; cy = bd->y;
2739 x = bd->x; y = bd->y;
2740 w = ev_x - bd->x; h = ev_y - bd->y;
2743 cx = bd->x; cy = bd->y + bd->h;
2744 x = bd->x; y = ev_y;
2745 w = ev_x - x; h = (bd->y + bd->h) - y;
2751 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_TR)
2753 switch (bd_info->resize_req.angle)
2756 cx = bd->x; cy = bd->y + bd->h;
2757 x = bd->x; y = ev_y;
2758 w = ev_x - x; h = (bd->y + bd->h) - y;
2761 cx = bd->x + bd->w; cy = bd->y + bd->h;
2763 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2766 cx = bd->x + bd->w; cy = bd->y;
2767 x = ev_x; y = bd->y;
2768 w = (bd->x + bd->w) - x; h = ev_y - y;
2771 cx = bd->x; cy = bd->y;
2772 x = bd->x; y = bd->y;
2773 w = ev_x - bd->x; h = ev_y - bd->y;
2779 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_BL)
2781 switch (bd_info->resize_req.angle)
2784 cx = bd->x + bd->w; cy = bd->y;
2785 x = ev_x; y = bd->y;
2786 w = (bd->x + bd->w) - x; h = ev_y - y;
2789 cx = bd->x; cy = bd->y;
2790 x = bd->x; y = bd->y;
2791 w = ev_x - bd->x; h = ev_y - bd->y;
2794 cx = bd->x; cy = bd->y + bd->h;
2795 x = bd->x; y = ev_y;
2796 w = ev_x - x; h = (bd->y + bd->h) - y;
2799 cx = bd->x + bd->w; cy = bd->y + bd->h;
2801 w = (bd->x + bd->w) - x; h = (bd->y + bd->h) - y;
2807 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_R)
2809 switch (bd_info->resize_req.angle)
2812 cx = bd->x; cy = bd->y;
2813 x = bd->x; y = bd->y;
2814 w = ev_x - bd->x; h = bd->h;
2817 cx = bd->x; cy = bd->y + bd->h;
2818 x = bd->x; y = ev_y;
2819 w = bd->w; h = (bd->y + bd->h) - y;
2822 cx = bd->x + bd->w; cy = bd->y + bd->h;
2824 w = (bd->x + bd->w) - x; h = bd->h;
2827 cx = bd->x + bd->w; cy = bd->y;
2828 x = ev_x; y = bd->y;
2829 w = bd->w; h = ev_y - y;
2835 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_L)
2837 switch (bd_info->resize_req.angle)
2840 cx = bd->x + bd->w; cy = bd->y + bd->h;
2841 x = ev_x; y = bd->y;
2842 w = (bd->x + bd->w) - x; h = bd->h;
2845 cx = bd->x + bd->w; cy = bd->y;
2846 x = ev_x; y = bd->y;
2847 w = bd->w; h = ev_y - y;
2850 cx = bd->x; cy = bd->y;
2851 x = bd->x; y = bd->y;
2852 w = ev_x - bd->x; h = bd->h;
2855 cx = bd->x; cy = bd->y + bd->h;
2856 x = bd->x; y = ev_y;
2857 w = bd->w; h = (bd->y + bd->h) - y;
2863 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_T)
2865 switch (bd_info->resize_req.angle)
2868 cx = bd->x + bd->w; cy = bd->y + bd->h;
2869 x = bd->x; y = ev_y;
2870 w = bd->w; h = (bd->y + bd->h) - y;
2873 cx = bd->x + bd->w; cy = bd->y;
2874 x = ev_x; y = bd->y;
2875 w = (bd->x + bd->w) - x; h = bd->h;
2878 cx = bd->x; cy = bd->y;
2879 x = bd->x; y = bd->y;
2880 w = bd->w; h = ev_y - bd->y;
2883 cx = bd->x + bd->w; cy = bd->y;
2884 x = bd->x; y = bd->y;
2885 w = ev_x - bd->x; h = bd->h;
2891 else if (direction == ECORE_X_NETWM_DIRECTION_SIZE_B)
2893 switch (bd_info->resize_req.angle)
2896 cx = bd->x; cy = bd->y;
2897 x = bd->x; y = bd->y;
2898 w = bd->w; h = ev_y - bd->y;
2901 cx = bd->x + bd->w; cy = bd->y;
2902 x = bd->x; y = bd->y;
2903 w = ev_x - bd->x; h = bd->h;
2906 cx = bd->x + bd->w; cy = bd->y + bd->h;
2907 x = bd->x; y = ev_y;
2908 w = bd->w; h = (bd->y + bd->h) - y;
2911 cx = bd->x + bd->w; cy = bd->y;
2912 x = ev_x; y = bd->y;
2913 w = (bd->x + bd->w) - x; h = bd->h;
2922 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... ERROR... direction(%d) is not defined!!!\n", __func__, __LINE__, direction);
2926 if (bd->zone->w > bd->zone->h)
2927 max_size = bd->zone->h;
2929 max_size = bd->zone->w;
2935 area->min_width = mw;
2936 area->min_height = mh;
2937 area->max_width = max_size;
2938 area->max_height = max_size;
2943 if (w > max_size) w = max_size;
2944 if (h > max_size) h = max_size;
2946 if ((x + w) > (bd->x + w)) x = cx - w;
2947 if ((y + h) > (bd->y + h)) y = cy - h;
2949 if ((cx - x) > max_size)
2951 if ((cy - y) > max_size)
2954 x = x - bd->zone->x;
2955 y = y - bd->zone->y;
2964 _policy_border_cb_mouse_up(void *data,
2965 int type __UNUSED__,
2968 Ecore_Event_Mouse_Button *ev;
2969 E_Illume_Border_Info *bd_info;
2972 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2975 bd = bd_info->border;
2977 if (ev->window != bd->event_win &&
2978 ev->event_window != bd->event_win)
2979 return ECORE_CALLBACK_PASS_ON;
2981 if (!bd_info->resize_req.mouse.down)
2982 return ECORE_CALLBACK_PASS_ON;
2984 bd->lock_user_location = 0;
2985 e_grabinput_release(bd->event_win, bd->event_win);
2987 if (bd_info->resize_req.mouse.resize)
2989 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
2990 Evas_Coord_Rectangle r;
2991 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, NULL);
2993 bd_info->resize_req.direction = ECORE_X_NETWM_DIRECTION_CANCEL;
2994 bd_info->resize_req.mouse.x = r.x + bd->zone->x;
2995 bd_info->resize_req.mouse.y = r.y + bd->zone->y;
2996 bd_info->resize_req.mouse.w = r.w;
2997 bd_info->resize_req.mouse.h = r.h;
2998 bd_info->resize_req.need_change = 1;
2999 bd->changes.pos = 1;
3000 bd->changes.size = 1;
3002 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
3006 printf("[IL2] DEL OBJ in UP\n");
3011 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3012 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
3013 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
3016 bd_info->resize_req.mouse.down = 0;
3017 bd_info->resize_req.mouse.resize = 0;
3018 bd_info->resize_req.mouse.locked = 0;
3020 /* set property on this border to say we are done dragging */
3021 ecore_x_e_illume_drag_set(bd->client.win, 0);
3023 /* set property on zone window that a drag is finished */
3024 ecore_x_e_illume_drag_set(bd->zone->black_win, 0);
3026 ecore_x_window_raise(bd->client.shell_win);
3027 _policy_border_illume_handlers_remove(bd_info);
3029 return ECORE_CALLBACK_PASS_ON;
3033 _policy_border_cb_mouse_move(void *data,
3034 int type __UNUSED__,
3037 Ecore_Event_Mouse_Move *ev;
3038 E_Illume_Border_Info *bd_info;
3042 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3045 bd = bd_info->border;
3047 if (ev->window != bd->event_win &&
3048 ev->event_window != bd->event_win)
3049 return ECORE_CALLBACK_PASS_ON;
3051 if (!bd_info->resize_req.mouse.down)
3052 return ECORE_CALLBACK_PASS_ON;
3054 if (bd_info->resize_req.mouse.resize)
3056 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);
3057 Evas_Object *o = (Evas_Object *)e_object_data_get(E_OBJECT(bd));
3058 if (!o) return ECORE_CALLBACK_PASS_ON;
3060 Evas_Coord_Rectangle r;
3061 E_Resizable_Area_Info area;
3063 _resize_rect_geometry_get(bd_info, &r, ev->root.x, ev->root.y, bd_info->resize_req.direction, &area);
3064 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);
3066 rect = edje_object_part_object_get(o, "opacity_rect");
3068 if((r.w <= area.min_width && r.h <= area.min_height)
3069 || (r.w >= area.max_width && r.h >= area.max_height))
3071 edje_object_signal_emit(o, "resize,notavail", "illume2");
3072 evas_object_color_set(rect, 64, 64, 64, 64);
3076 edje_object_signal_emit(o, "resize,normal", "illume2");
3077 evas_object_color_set(rect, 255, 255, 255, 255);
3079 if(area.x_dist < area.min_width && area.y_dist < area.min_height)
3082 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;
3088 tmp = (int)(128*( (double)tmp/10 + 1));
3089 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3091 if (area.x_dist > area.max_width && area.y_dist > area.max_height)
3094 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;
3100 tmp = (int)(128*( (double)tmp/10 + 1));
3101 evas_object_color_set(rect, tmp, tmp, tmp, tmp);
3104 evas_object_move(o, r.x, r.y);
3105 evas_object_resize(o, r.w, r.h);
3109 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
3110 bd_info->resize_req.mouse.x = ev->root.x + bd_info->resize_req.mouse.dx;
3111 bd_info->resize_req.mouse.y = ev->root.y + bd_info->resize_req.mouse.dy;
3112 bd->changes.pos = 1;
3113 bd->changed = EINA_TRUE;
3116 return ECORE_CALLBACK_PASS_ON;
3120 _policy_property_change(Ecore_X_Event_Window_Property *event)
3122 // printf("Property Change\n");
3124 /* we are interested in state changes here */
3125 if (event->atom == ECORE_X_ATOM_NET_WM_STATE)
3127 _policy_property_window_state_change (event);
3129 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY)
3131 _policy_property_indicator_geometry_change (event);
3133 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
3135 _policy_property_clipboard_geometry_change (event);
3137 else if (event->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
3139 _policy_property_clipboard_state_change (event);
3141 else if (event->atom == ATM_ENLIGHTENMENT_SCALE)
3143 _policy_property_enlightenment_scale_change (event);
3145 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
3147 _policy_property_rotate_win_angle_change (event);
3149 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
3151 _policy_property_indicator_state_change (event);
3153 else if (event->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE)
3155 _policy_property_indicator_opacity_change(event);
3157 else if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
3159 _policy_property_active_win_change (event);
3161 else if (event->atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
3163 _policy_property_win_type_change (event);
3165 else if (event->atom == E_ILLUME_ATOM_STACK_DISPLAY)
3167 _policy_border_list_print (event->win);
3169 else if (event->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
3171 _policy_property_rotate_root_angle_change (event);
3173 else if (event->atom == E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3175 _policy_property_notification_level_change (event);
3177 /* for visibility */
3178 else if (event->atom == E_ILLUME_ATOM_OVERAY_WINDOW)
3180 _policy_property_overlay_win_change (event);
3182 else if (event->atom == E_ILLUME_ATOM_WINDOW_OPAQUE)
3184 _policy_property_window_opaque_change (event);
3186 else if (event->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
3188 _policy_property_illume_window_state_change(event);
3190 /* enable/disable composite module - 100320 yigl */
3191 #ifdef COMP_MODULE_CONTROL
3192 else if (event->atom == E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3194 _policy_property_composite_module_change (event);
3197 /* enable/disable backkey module - 130610 seongwon1.cho */
3198 #ifdef BACKKEY_MODULE_CONTROL
3199 else if (event->atom == E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3201 _policy_property_backkey_module_change (event);
3204 /* enable/disable devmode module - 130610 seongwon1.cho */
3205 #ifdef DEVMODE_MODULE_CONTROL
3206 else if (event->atom == E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3208 _policy_property_devmode_module_change (event);
3211 else if (event->atom == E_INDICATOR_CMD_WIN)
3213 _policy_property_indicator_cmd_win_change(event);
3215 else if (event->atom == E_ACTIVE_INDICATOR_WIN)
3217 _policy_property_active_indicator_win_change(event);
3223 _policy_border_list_print (Ecore_X_Window win)
3225 Eina_List* border_list;
3228 E_Border* temp_bd = NULL;
3230 E_Illume_Print_Info info;
3231 unsigned char* prop_data = NULL;
3235 memset (info.file_name, 0, 256);
3237 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_STACK_DISPLAY, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
3238 if( ret && prop_data )
3239 memcpy (&info, prop_data, sizeof (E_Illume_Print_Info));
3241 if (prop_data) free (prop_data);
3243 out = fopen (info.file_name, "w+");
3244 if (out == NULL) out = stderr;
3246 if ((info.type & PT_STACK) == PT_STACK)
3248 border_list = e_border_client_list();
3252 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3253 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3254 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3256 EINA_LIST_FOREACH(border_list, l, bd)
3259 if (temp_bd == NULL) temp_bd = bd;
3261 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3262 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3264 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3268 E_Illume_Border_Info* bd_info;
3269 if (e_border_info_list)
3272 fprintf (out, "--------------------------------ILLUME BORDER INFO------------------------------------------------------------------\n" );
3273 fprintf (out, " No Border ClientWin w h x y isKBD layer level desk WinName\n" );
3274 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3276 EINA_LIST_FOREACH(e_border_info_list, l, bd_info)
3281 int desk_x=0, desk_y=0;
3282 if (!bd_info) continue;
3284 bd = bd_info->border;
3287 for (x = 0; x < zone->desk_x_count; x++)
3289 for (y = 0; y < zone->desk_y_count; y++)
3291 if (bd->desk == zone->desks[x + zone->desk_x_count * y])
3299 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %3i %5i %5i (%d,%d) %-30s \n",
3300 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,
3301 bd_info->border->client.vkbd.vkbd, bd_info->border->layer, bd_info->level, desk_x, desk_y, bd_info->border->client.netwm.name);
3303 fprintf (out, "--------------------------------------------------------------------------------------------------------------------\n" );
3307 if (temp_bd == NULL) goto finish;
3311 fprintf (out, "-------------------------------- E17 STACK INFO--------------------------------------------\n" );
3312 fprintf (out, " No Border ClientWin w h x y layer visible WinName\n" );
3313 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3316 bl = e_container_border_list_last(temp_bd->zone->container);
3317 while ((bd = e_container_border_list_prev(bl)))
3319 fprintf (out, "%3i 0x%07x 0x%07x %4i %4i %6i %6i %5i %5i %-30s \n",
3320 i++, bd->win, bd->client.win, bd->w, bd->h, bd->x, bd->y, bd->layer, bd->visible, bd->client.netwm.name);
3322 e_container_border_list_free(bl);
3323 fprintf (out, "---------------------------------------------------------------------------------------------\n\n" );
3326 /* for visibility */
3327 if ((info.type & PT_VISIBILITY) == PT_VISIBILITY)
3329 Eina_Inlist* xwin_info_list;
3330 E_Illume_XWin_Info *xwin_info;
3332 xwin_info_list = _e_illume_xwin_info_list;
3336 fprintf (out, "--------------------------------BORDER INFO--------------------------------------------------\n" );
3337 fprintf (out, " No Win w h x y depth viewable visibility comp_vis iconify by_wm is_border(Client Win)\n" );
3338 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3340 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
3342 if (xwin_info->bd_info)
3344 if (xwin_info->bd_info->border)
3346 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i %5i %5i yes(0x%07x)\n",
3347 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3348 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);
3352 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3353 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3354 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3359 fprintf (out, "%3i 0x%07x %4i %4i %6i %6i %5i %5i %5i %5i 0 %3i no(NULL)\n",
3360 i++, xwin_info->id, xwin_info->attr.w, xwin_info->attr.h, xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.depth,
3361 xwin_info->viewable, xwin_info->visibility, xwin_info->comp_vis, xwin_info->iconify_by_wm);
3364 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3372 fprintf (out, "--------------------------------GLOBAL INFO--------------------------------------------------\n" );
3373 fprintf (out, "g_rotated_win:0x%07x (g_root_angle:%d)\n", g_rotated_win, g_root_angle);
3374 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));
3375 fprintf (out, "g_indi_control_win:0x%07x\n", g_indi_control_win);
3376 fprintf (out, "---------------------------------------------------------------------------------------------\n" );
3384 ecore_x_client_message32_send (ecore_x_window_root_first_get(), E_ILLUME_ATOM_STACK_DISPLAY_DONE,
3385 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3391 _policy_window_rotation_angle_get(Ecore_X_Window win)
3394 int ret, size_ret = 0;
3395 unsigned long num_ret = 0, bytes = 0;
3396 unsigned char *prop_ret = NULL;
3397 Ecore_X_Display *dpy;
3400 dpy = ecore_x_display_get();
3403 win = ecore_x_window_root_first_get();
3405 ret = XGetWindowProperty(dpy, win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, 0, LONG_MAX,
3406 False, ECORE_X_ATOM_CARDINAL, &type_ret, &size_ret,
3407 &num_ret, &bytes, &prop_ret);
3409 if (ret == ECORE_X_ERROR_CODE_SUCCESS)
3411 if (prop_ret && num_ret)
3413 angle = ((int *)prop_ret)[0];
3414 if (angle % 90) angle = -1;
3424 if (prop_ret) XFree(prop_ret);
3430 static Ecore_X_Window
3431 _policy_active_window_get(Ecore_X_Window root)
3436 ret = ecore_x_window_prop_xid_get(root,
3437 ECORE_X_ATOM_NET_ACTIVE_WINDOW,
3438 ECORE_X_ATOM_WINDOW,
3441 if ((ret == 1) && win)
3448 _policy_border_indicator_state_get(E_Border *bd)
3450 Ecore_X_Illume_Indicator_State state;
3453 state = ecore_x_e_illume_indicator_state_get(bd->client.win);
3454 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
3456 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
3464 static void _policy_layout_quickpanel_rotate (E_Illume_Quickpanel* qp, int angle)
3468 E_Illume_Quickpanel_Info *panel;
3474 // pass 1 - resize window
3475 // It caused abnormal size of quickpanel window and abnormal rotation state.
3476 // disable it for now.
3478 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3480 if (!panel) continue;
3481 if (panel->angle == angle) continue;
3483 if (panel->angle > angle) diff = panel->angle - angle;
3484 else diff = angle - panel->angle;
3488 if (angle == 0 || angle == 180)
3490 if (diff == 90 || diff == 270)
3493 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);
3494 _policy_border_resize (bd, bd->zone->w, temp);
3497 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Portrait quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3501 if (diff == 90 || diff == 270)
3504 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);
3505 _policy_border_resize (bd, temp, bd->zone->h);
3508 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] Landscape quick panel...(%d) quick win = 0x%07x.. But size is not change\n", __LINE__, bd->client.win);
3513 // pass 2 - send client message
3514 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
3516 if (!panel) continue;
3517 if (panel->angle == angle) continue;
3519 if (panel->angle > angle) diff = panel->angle - angle;
3520 else diff = angle - panel->angle;
3524 ILLUME2_TRACE ("[ILLUME2-QUICKPANEL] SEND CLIENT MESSAGE TO QUICKPANEL!!!!(%d) win:0x%07x, angle = %d\n", __LINE__, bd->client.win, angle);
3525 ecore_x_client_message32_send (bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
3526 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3529 panel->angle = angle;
3534 _policy_window_focus_in(Ecore_X_Event_Window_Focus_In *event)
3536 ILLUME2_TRACE("[ILLUME2-FOCUS] _policy_window_focus_in... win = 0x%07x\n", event->win);
3540 if (e_config->focus_policy == E_FOCUS_CLICK) return;
3542 if (!(bd = e_border_find_by_client_window(event->win))) return;
3544 if (e_illume_border_is_indicator (bd))
3550 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3553 EINA_LIST_FOREACH(man->containers, cl, con)
3558 // send focus to top-level window.
3559 bl = e_container_border_list_last(con);
3560 while ((temp_bd = e_container_border_list_prev(bl)))
3562 if (temp_bd->client.icccm.accepts_focus && temp_bd->visible)
3564 /* focus the border */
3565 e_border_focus_set(temp_bd, 1, 1);
3566 e_container_border_list_free(bl);
3570 e_container_border_list_free(bl);
3577 void _policy_border_stack_change (E_Border* bd, E_Border* sibling, int stack_mode)
3579 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);
3581 if (bd->layer != sibling->layer)
3583 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);
3587 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);
3588 if (stack_mode == E_ILLUME_STACK_ABOVE)
3590 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);
3591 e_border_stack_above (bd, sibling);
3593 else if (stack_mode == E_ILLUME_STACK_BELOW)
3595 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);
3596 e_border_stack_below (bd, sibling);
3601 int _policy_atom_init (void)
3603 /* Notification Level Atom */
3604 E_ILLUME_ATOM_NOTIFICATION_LEVEL = ecore_x_atom_get ("_E_ILLUME_NOTIFICATION_LEVEL");
3605 if (!E_ILLUME_ATOM_NOTIFICATION_LEVEL)
3607 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_NOTIFICATION_LEVEL Atom...\n");
3611 /* for active/deactive message */
3612 E_ILLUME_ATOM_ACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_ACTIVATE_WINDOW");
3613 if (!E_ILLUME_ATOM_ACTIVATE_WINDOW)
3615 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_ACTIVATE_WINDOW Atom...\n");
3619 E_ILLUME_ATOM_DEACTIVATE_WINDOW = ecore_x_atom_get ("_X_ILLUME_DEACTIVATE_WINDOW");
3620 if (!E_ILLUME_ATOM_DEACTIVATE_WINDOW)
3622 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _X_ILLUME_DEACTIVATE_WINDOW Atom...\n");
3626 /* for visibility */
3627 E_ILLUME_ATOM_OVERAY_WINDOW = ecore_x_atom_get ("_E_COMP_OVERAY_WINDOW");
3628 if (!E_ILLUME_ATOM_OVERAY_WINDOW)
3630 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_OVERAY_WINDOW Atom...\n");
3634 E_ILLUME_ATOM_STACK_DISPLAY = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK");
3635 if (!E_ILLUME_ATOM_STACK_DISPLAY)
3637 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK Atom...\n");
3641 E_ILLUME_ATOM_STACK_DISPLAY_DONE = ecore_x_atom_get ("_E_ILLUME_PRINT_BORDER_WIN_STACK_DONE");
3642 if (!E_ILLUME_ATOM_STACK_DISPLAY_DONE)
3644 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_PRINT_BORDER_WIN_STACK_DONE Atom...\n");
3648 E_ILLUME_ATOM_WINDOW_OPAQUE = ecore_x_atom_get ("_E_ILLUME_WINDOW_REGION_OPAQUE");
3649 if (!E_ILLUME_ATOM_WINDOW_OPAQUE)
3651 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ILLUME_WINDOW_REGION_OPAQUE Atom...\n");
3655 #ifdef COMP_MODULE_CONTROL
3656 E_ILLUME_ATOM_COMP_MODULE_ENABLED = ecore_x_atom_get ("_E_COMP_ENABLE");
3657 if(!E_ILLUME_ATOM_COMP_MODULE_ENABLED)
3659 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_COMP_ENABLE Atom...\n");
3664 #ifdef BACKKEY_MODULE_CONTROL
3665 E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED = ecore_x_atom_get ("_E_BACKKEY_ENABLE");
3666 if(!E_ILLUME_ATOM_BACKKEY_MODULE_ENABLED)
3668 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_BACKKEY_ENABLE Atom...\n");
3673 #ifdef DEVMODE_MODULE_CONTROL
3674 E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED = ecore_x_atom_get ("_E_DEVMODE_ENABLE");
3675 if(!E_ILLUME_ATOM_DEVMODE_MODULE_ENABLED)
3677 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_DEVMODE_ENABLE Atom...\n");
3682 E_INDICATOR_CMD_WIN = ecore_x_atom_get("_E_INDICATOR_CMD_WIN");
3683 if (!E_INDICATOR_CMD_WIN)
3685 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_INDICATOR_CMD_WIN Atom...\n");
3689 E_ACTIVE_INDICATOR_WIN = ecore_x_atom_get("_E_ACTIVE_INDICATOR_WIN");
3690 if (!E_ACTIVE_INDICATOR_WIN)
3692 fprintf (stderr, "[ILLUME2] Critical Error!!! Cannot create _E_ACTIVE_INDICATOR_WIN Atom...\n");
3700 int _policy_init (void)
3705 /* for visibility */
3706 _e_illume_xwin_info_hash = eina_hash_string_superfast_new(NULL);
3707 EINA_LIST_FOREACH(e_manager_list(), ml, man)
3709 _policy_manage_xwins (man);
3711 dep_rot.root = man->root;
3712 dep_rot.refer.cmd_win = _policy_indicator_cmd_win_get(dep_rot.root);
3713 if (dep_rot.refer.cmd_win)
3717 win = _policy_active_indicator_win_get(dep_rot.refer.cmd_win);
3718 dep_rot.refer.active_bd = e_border_find_by_client_window(win);
3723 if (!_policy_atom_init())
3725 eina_hash_free (_e_illume_xwin_info_hash);
3729 /* for visibility */
3730 _e_illume_msg_handler = e_msg_handler_add(_policy_msg_handler, NULL);
3736 void _policy_fin (void)
3738 /* for visibility */
3739 if (_e_illume_msg_handler) e_msg_handler_del(_e_illume_msg_handler);
3740 eina_hash_free (_e_illume_xwin_info_hash);
3744 _policy_compare_cb_border (E_Illume_Border_Info* data1, E_Illume_Border_Info* data2)
3748 if (data1->border == data2->border)
3756 static E_Illume_Border_Info*
3757 _policy_get_border_info (E_Border* bd)
3759 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3760 E_Illume_Border_Info tmp_win;
3761 tmp_win.border = bd;
3762 return (E_Illume_Border_Info*) eina_list_search_unsorted (
3763 e_border_info_list, EINA_COMPARE_CB(_policy_compare_cb_border), &tmp_win);
3767 static E_Illume_Border_Info* _policy_add_border_info_list (E_Border* bd)
3769 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3771 if (e_object_is_del(E_OBJECT(bd))) return NULL;
3773 E_Illume_Border_Info* bd_info = (E_Illume_Border_Info*) calloc (1, sizeof (E_Illume_Border_Info));
3776 fprintf (stderr, "[ILLUME2] Critical Error... Fail to create memory... (%s:%d)\n", __func__, __LINE__);
3779 bd_info->pid = bd->client.netwm.pid;
3780 bd_info->border = bd;
3782 bd_info->level = 50;
3784 bd_info->opaque = _policy_property_window_opaque_get(bd->client.win);
3786 // could find bd_info of ev->stack.. there is no bd_info yet...
3787 Eina_List *l = NULL;
3788 E_Illume_Border_Info *temp_bd_info = NULL;
3790 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
3792 if (!temp_bd_info) continue;
3793 if (bd_info->border->layer >= temp_bd_info->border->layer)
3799 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
3800 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);
3804 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
3805 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, bd->client.win);
3812 static void _policy_delete_border_info_list (E_Border* bd)
3814 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... bd = %x, bd's client = 0x%07x\n", __func__, __LINE__, bd, bd->client.win);
3815 E_Illume_Border_Info* bd_info = _policy_get_border_info (bd);
3817 if (bd_info == NULL)
3819 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);
3823 _policy_border_illume_handlers_remove(bd_info);
3825 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
3826 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... remove bd(win:0x%07x)\n", __func__, __LINE__, bd->client.win);
3832 _policy_zone_layout_app_layer_check (E_Border* bd)
3834 Ecore_X_Window_Type *types = NULL;
3835 E_Illume_Border_Info *bd_info;
3838 if (!bd) return POL_APP_LAYER;
3840 bd_info = _policy_get_border_info(bd);
3841 if (!bd_info) return POL_APP_LAYER;
3843 layer = POL_APP_LAYER;
3845 num = ecore_x_netwm_window_types_get(bd->client.win, &types);
3849 for (i=0; i< num; i++)
3851 if (types[i] == ECORE_X_WINDOW_TYPE_NOTIFICATION)
3852 layer = _policy_notification_level_map(bd_info->level);
3858 if (bd->client.netwm.state.stacking == E_STACKING_BELOW)
3860 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is BELOW state.. Change layer to 50\n", __func__, __LINE__, bd->client.win);
3861 layer = POL_STATE_BELOW_LAYER;
3863 else if (bd->client.netwm.state.stacking == E_STACKING_ABOVE)
3865 ILLUME2_TRACE ("[ILLUME2-NEW] %s(%d)... WIN:0x%07x is ABOVE state.. Change layer to 150\n", __func__, __LINE__, bd->client.win);
3866 layer = POL_STATE_ABOVE_LAYER;
3874 _policy_zone_layout_app_layer_set (E_Border* bd, int new_layer)
3878 /* if a window sets transient_for property, it sets same layer to parent window */
3879 if (bd->client.icccm.transient_for != 0)
3881 E_Border *bd_parent = NULL;
3882 bd_parent = e_border_find_by_client_window (bd->client.icccm.transient_for);
3885 if (bd->layer != bd_parent->layer)
3886 e_border_layer_set (bd, bd_parent->layer);
3891 if (bd->layer != new_layer)
3892 e_border_layer_set(bd, new_layer);
3897 _policy_zone_layout_app_single_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
3901 Eina_Bool resize = EINA_FALSE;
3902 Eina_Bool move = EINA_FALSE;
3904 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);
3906 bd = bd_info->border;
3909 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
3913 if (bd->moving && !bd->client.illume.win_state.state)
3915 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... Cancel moving... win:0x%07x, bd->moving:%d\n", __func__, __LINE__, bd->client.win, bd->moving);
3916 e_border_move_cancel();
3919 if ((!bd->new_client) && (!bd->visible)) return;
3921 layer = _policy_zone_layout_app_layer_check (bd);
3923 /* check if user defined position */
3924 if (bd->client.icccm.request_pos)
3926 if (bd->client.illume.win_state.state)
3928 if (bd_info->resize_req.need_change)
3930 if ((bd->x != bd_info->resize_req.mouse.x) ||
3931 (bd->y != bd_info->resize_req.mouse.y))
3934 if ((bd->w != bd_info->resize_req.mouse.w) ||
3935 (bd->h != bd_info->resize_req.mouse.h))
3940 e_border_move_resize(bd,
3941 bd_info->resize_req.mouse.x,
3942 bd_info->resize_req.mouse.y,
3943 bd_info->resize_req.mouse.w,
3944 bd_info->resize_req.mouse.h);
3948 _policy_border_move(bd,
3949 bd_info->resize_req.mouse.x,
3950 bd_info->resize_req.mouse.y);
3954 _policy_border_resize(bd,
3955 bd_info->resize_req.mouse.w,
3956 bd_info->resize_req.mouse.h);
3959 bd_info->resize_req.need_change = 0;
3960 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);
3963 if (bd_info->resize_req.mouse.down &&
3964 bd_info->resize_req.mouse.locked)
3966 if ((bd->x != bd_info->resize_req.mouse.x) ||
3967 (bd->y != bd_info->resize_req.mouse.y))
3968 _policy_border_move(bd,
3969 bd_info->resize_req.mouse.x,
3970 bd_info->resize_req.mouse.y);
3971 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);
3975 _policy_zone_layout_app_layer_set (bd, layer);
3979 /* resize & move if needed */
3980 if (bd->client.illume.win_state.state)
3982 if (bd_info->resize_req.need_change)
3984 if ((bd->x != bd_info->resize_req.mouse.x) ||
3985 (bd->y != bd_info->resize_req.mouse.y))
3988 if ((bd->w != bd_info->resize_req.mouse.w) ||
3989 (bd->h != bd_info->resize_req.mouse.h))
3994 e_border_move_resize(bd,
3995 bd_info->resize_req.mouse.x,
3996 bd_info->resize_req.mouse.y,
3997 bd_info->resize_req.mouse.w,
3998 bd_info->resize_req.mouse.h);
4002 _policy_border_move(bd,
4003 bd_info->resize_req.mouse.x,
4004 bd_info->resize_req.mouse.y);
4008 _policy_border_resize(bd,
4009 bd_info->resize_req.mouse.w,
4010 bd_info->resize_req.mouse.h);
4013 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);
4014 bd_info->resize_req.need_change = 0;
4017 if (bd_info->resize_req.mouse.down &&
4018 bd_info->resize_req.mouse.locked)
4020 if ((bd->x != bd_info->resize_req.mouse.x) ||
4021 (bd->y != bd_info->resize_req.mouse.y))
4022 _policy_border_move(bd,
4023 bd_info->resize_req.mouse.x,
4024 bd_info->resize_req.mouse.y);
4025 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);
4030 if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h))
4033 if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y))
4037 e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
4039 _policy_border_resize(bd, bd->zone->w, bd->zone->h);
4041 _policy_border_move(bd, bd->zone->x, bd->zone->y);
4044 /* set layer if needed */
4045 _policy_zone_layout_app_layer_set (bd, layer);
4050 _policy_zone_layout_app_dual_top_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4056 Eina_Bool resize = EINA_FALSE;
4057 Eina_Bool move = EINA_FALSE;
4059 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);
4061 bd = bd_info->border;
4063 if (!bd || !cz) return;
4064 if ((!bd->new_client) && (!bd->visible)) return;
4066 layer = _policy_zone_layout_app_layer_check (bd);
4068 // check if user defined position
4069 if (bd->client.icccm.request_pos)
4071 _policy_zone_layout_app_layer_set (bd, layer);
4075 /* set a default Y position */
4076 ny = (bd->zone->y + cz->indicator.size);
4077 nh = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2);
4079 /* see if there is a border already there. if so, check placement based on
4080 * virtual keyboard usage */
4081 temp_bd = e_illume_border_at_xy_get(bd->zone, bd->zone->x, ny);
4082 if ((temp_bd) && (temp_bd != bd)) ny = temp_bd->y + nh;
4084 /* resize if needed */
4085 if ((bd->w != bd->zone->w) || (bd->h != nh))
4088 /* move to correct position (relative to zone) if needed */
4089 if ((bd->x != bd->zone->x) || (bd->y != ny))
4093 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4095 _policy_border_resize(bd, bd->zone->w, nh);
4097 _policy_border_move(bd, bd->zone->x, ny);
4099 /* set layer if needed */
4100 _policy_zone_layout_app_layer_set (bd, layer);
4104 _policy_zone_layout_app_dual_left_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4110 Eina_Bool resize = EINA_FALSE;
4111 Eina_Bool move = EINA_FALSE;
4113 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);
4115 bd = bd_info->border;
4117 if (!bd || !cz) return;
4118 if ((!bd->new_client) && (!bd->visible)) return;
4120 layer = _policy_zone_layout_app_layer_check (bd);
4122 // check if user defined position
4123 if (bd->client.icccm.request_pos)
4125 _policy_zone_layout_app_layer_set (bd, layer);
4129 /* set some defaults */
4131 nw = (bd->zone->w / 2);
4133 ky = bd->zone->y + cz->indicator.size;
4134 kh = bd->zone->h - cz->indicator.size - cz->softkey.size;
4136 /* see if there is a border already there. if so, place at right */
4137 temp_bd = e_illume_border_at_xy_get(bd->zone, nx, (ky + bd->zone->h / 2));
4138 if ((temp_bd) && (bd != temp_bd)) nx = temp_bd->x + nw;
4140 /* resize if needed */
4141 if ((bd->w != nw) || (bd->h != kh))
4144 /* move to correct position (relative to zone) if needed */
4145 if ((bd->x != nx) || (bd->y != ky))
4149 e_border_move_resize(bd, nx, ky, nw, kh);
4151 _policy_border_resize(bd, nw, kh);
4153 _policy_border_move(bd, nx, ky);
4155 /* set layer if needed */
4156 _policy_zone_layout_app_layer_set (bd, layer);
4161 _policy_zone_layout_app_dual_custom_new (E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
4166 Eina_Bool resize = EINA_FALSE;
4167 Eina_Bool move = EINA_FALSE;
4169 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);
4171 bd = bd_info->border;
4174 fprintf (stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
4178 if ((!bd->new_client) && (!bd->visible)) return;
4180 /* grab indicator position */
4181 e_illume_border_indicator_pos_get(bd->zone, NULL, &iy);
4183 /* set a default position */
4187 app = e_illume_border_at_xy_get(bd->zone, bd->zone->x, bd->zone->y);
4192 ny = (iy + cz->indicator.size);
4193 nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size);
4197 /* make sure it's the required width & height */
4198 if ((bd->w != bd->zone->w) || (bd->h != nh))
4201 /* move to correct position (relative to zone) if needed */
4202 if ((bd->x != bd->zone->x) || (bd->y != ny))
4206 e_border_move_resize(bd, bd->zone->x, ny, bd->zone->w, nh);
4208 _policy_border_resize(bd, bd->zone->w, nh);
4210 _policy_border_move(bd, bd->zone->x, ny);
4212 /* set layer if needed */
4213 if (bd->layer != POL_APP_LAYER)
4214 e_border_layer_set(bd, POL_APP_LAYER);
4217 static int _policy_border_get_notification_level (Ecore_X_Window win)
4222 unsigned char* prop_data = NULL;
4224 ret = ecore_x_window_prop_property_get (win, E_ILLUME_ATOM_NOTIFICATION_LEVEL, ECORE_X_ATOM_CARDINAL, 32, &prop_data, &num);
4225 if( ret && prop_data )
4226 memcpy (&level, prop_data, sizeof (int));
4228 if (prop_data) free (prop_data);
4234 _policy_notification_level_map(int level)
4238 case E_ILLUME_NOTIFICATION_LEVEL_LOW: return POL_NOTIFICATION_LAYER_LOW;
4239 case E_ILLUME_NOTIFICATION_LEVEL_NORMAL: return POL_NOTIFICATION_LAYER_NORMAL;
4240 case E_ILLUME_NOTIFICATION_LEVEL_HIGH: return POL_NOTIFICATION_LAYER_HIGH;
4241 default: return POL_NOTIFICATION_LAYER_LOW;
4245 /* find new focus window */
4247 _policy_border_focus_top_stack_set (E_Border* bd)
4250 E_Border *cur_focus;
4254 root_w = bd->zone->w;
4255 root_h = bd->zone->h;
4257 cur_focus = e_border_focused_get();
4259 bl = e_container_border_list_last(bd->zone->container);
4260 while ((temp_bd = e_container_border_list_prev(bl)))
4262 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
4263 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
4265 if (temp_bd == cur_focus) break;
4267 if ((temp_bd != bd) &&
4268 (temp_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)) continue;
4270 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
4271 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
4272 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
4273 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
4274 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
4275 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
4276 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
4278 if (!temp_bd->focused)
4280 /* this border is the top of the latest stack */
4281 e_border_focus_set (temp_bd, 1, 1);
4286 e_container_border_list_free(bl);
4289 void _policy_border_stack (E_Event_Border_Stack *event)
4291 E_Event_Border_Stack* ev;
4292 E_Illume_Border_Info* bd_info;
4293 E_Illume_Border_Info* stack_bd_info;
4297 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);
4299 bd_info = _policy_get_border_info(ev->border);
4300 if (!bd_info) return;
4304 stack_bd_info = _policy_get_border_info(ev->stack);
4308 stack_bd_info = NULL;
4311 if (ev->type == E_STACKING_ABOVE)
4317 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4318 e_border_info_list = eina_list_prepend_relative (e_border_info_list, bd_info, stack_bd_info);
4319 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);
4323 // could find bd_info of ev->stack.. there is no bd_info yet...
4324 Eina_List *l = NULL;
4325 E_Illume_Border_Info *temp_bd_info;
4327 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4329 if (!temp_bd_info) continue;
4330 if (bd_info->border->layer >= temp_bd_info->border->layer)
4334 if (bd_info != temp_bd_info)
4336 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4337 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4338 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) -> other(win:0x%07x).. No stack(win:0x%07x) info ]\n", __func__, __LINE__, ev->border->client.win, temp_bd_info ? (unsigned int)temp_bd_info->border->client.win:(unsigned int)NULL, ev->stack->client.win);
4344 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4345 e_border_info_list = eina_list_append (e_border_info_list, bd_info);
4346 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ ---> bd(win:0x%07x) ]\n", __func__, __LINE__, ev->border->client.win);
4349 else if (ev->type == E_STACKING_BELOW)
4355 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4356 e_border_info_list = eina_list_append_relative (e_border_info_list, bd_info, stack_bd_info);
4357 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);
4361 // could find bd_info of ev->stack.. there is no bd_info yet...
4362 Eina_List *l = NULL;
4363 E_Illume_Border_Info *temp_bd_info;
4365 EINA_LIST_FOREACH(e_border_info_list, l, temp_bd_info)
4367 if (!temp_bd_info) continue;
4368 if (bd_info->border->layer >= temp_bd_info->border->layer)
4372 if (bd_info != temp_bd_info)
4374 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4375 e_border_info_list = eina_list_prepend_relative(e_border_info_list, bd_info, temp_bd_info);
4376 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);
4382 e_border_info_list = eina_list_remove (e_border_info_list, bd_info);
4383 e_border_info_list = eina_list_prepend (e_border_info_list, bd_info);
4384 L (LT_STACK, "[ILLUME2][STACK] %s(%d)... changed to [ bd(win:0x%07x) ---> ]\n", __func__, __LINE__, ev->border->client.win);
4389 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);
4392 /* restack indicator when a active window stack is changed */
4393 if ((ev->border->client.win == g_active_win) &&
4394 (ev->border->layer == POL_NOTIFICATION_LAYER))
4397 indi_bd = e_illume_border_indicator_get(ev->border->zone);
4400 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... win = 0x%07x.. Control Indicator.\n", __func__, __LINE__, ev->border->client.win);
4401 _policy_border_indicator_control(indi_bd);
4405 ev->border->changes.pos = 1;
4406 ev->border->changed = 1;
4411 void _policy_border_zone_set(E_Event_Border_Zone_Set *event)
4413 E_Event_Border_Zone_Set* ev;
4421 ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win);
4424 static void _policy_change_quickpanel_layer (E_Illume_Quickpanel* qp, E_Border* indi_bd, int layer, int level)
4427 E_Illume_Quickpanel_Info *panel;
4428 E_Illume_Border_Info* bd_info;
4434 bd_info = _policy_get_border_info(qp->popup->border);
4437 bd_info->level = level;
4438 e_border_stack_below (qp->popup->border, indi_bd);
4442 EINA_LIST_FOREACH(qp->hidden_mini_controllers, bd_list, panel)
4444 if (!panel) continue;
4445 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4447 bd_info = _policy_get_border_info(panel->bd);
4450 bd_info->level = level;
4451 e_border_stack_below (panel->bd, indi_bd);
4455 EINA_LIST_FOREACH(qp->borders, bd_list, panel)
4457 if (!panel) continue;
4458 if (e_object_is_del(E_OBJECT(panel->bd))) continue;
4460 bd_info = _policy_get_border_info(panel->bd);
4463 bd_info->level = level;
4464 e_border_stack_below (panel->bd, indi_bd);
4469 static void _policy_change_indicator_layer(E_Border *indi_bd, E_Border *bd, int layer, int level)
4471 // the indicator's layer is changed to layer with level
4472 E_Illume_Border_Info *indi_bd_info;
4473 E_Illume_Quickpanel *qp;
4474 int new_noti_layer = 0;
4476 indi_bd_info = _policy_get_border_info(indi_bd);
4479 indi_bd_info->level = level;
4482 if (layer == POL_NOTIFICATION_LAYER)
4484 new_noti_layer = _policy_notification_level_map(level);
4486 if (indi_bd->layer != new_noti_layer)
4487 e_border_layer_set(indi_bd, new_noti_layer);
4489 else if (indi_bd->layer != layer)
4490 e_border_layer_set(indi_bd, layer);
4495 E_Illume_Border_Info *top_bd_info;
4497 // check transient_for window
4498 top_bd = _policy_border_transient_for_border_top_get(bd);
4499 if (!top_bd) top_bd = bd;
4501 top_bd_info = _policy_get_border_info(top_bd);
4504 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4506 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4511 L (LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator's below win:0x%07x\n", __func__, __LINE__, top_bd->client.win);
4512 _policy_border_stack_change(indi_bd, top_bd, E_ILLUME_STACK_ABOVE);
4514 e_border_info_list = eina_list_remove(e_border_info_list, indi_bd_info);
4515 e_border_info_list = eina_list_prepend_relative(e_border_info_list, indi_bd_info, top_bd_info);
4516 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);
4519 if ((qp = e_illume_quickpanel_by_zone_get(indi_bd->zone)))
4521 _policy_change_quickpanel_layer(qp, indi_bd, layer, level);
4525 static Eina_Bool _policy_border_indicator_state_change(E_Border *indi_bd, E_Border *bd)
4527 E_Illume_Border_Info *bd_info;
4531 if (!indi_bd || !bd) return EINA_FALSE;
4533 indi_show = _policy_border_indicator_state_get(bd);
4536 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Show Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4537 e_border_show(indi_bd);
4539 if ((e_illume_border_is_notification(bd)) ||
4540 (bd->layer == POL_NOTIFICATION_LAYER))
4542 bd_info = _policy_get_border_info(bd);
4544 level = bd_info->level;
4548 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);
4549 _policy_change_indicator_layer(indi_bd, bd, POL_NOTIFICATION_LAYER, level);
4553 _policy_change_indicator_layer(indi_bd, NULL, POL_NOTIFICATION_LAYER, 50);
4558 else if (indi_show == 0)
4560 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Hide Indicator (by win: 0x%07x)\n", __func__, __LINE__, bd->client.win);
4561 e_border_hide(indi_bd, 2);
4571 _policy_border_indicator_control(E_Border *indi_bd)
4573 Eina_Inlist *xwin_info_list;
4574 E_Illume_XWin_Info *xwin_info;
4576 Ecore_X_Illume_Indicator_Opacity_Mode mode;
4578 if (!indi_bd) return;
4581 xwin_info_list = _e_illume_xwin_info_list;
4585 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4587 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4589 if (xwin_info->bd_info)
4591 bd = xwin_info->bd_info->border;
4594 if (!bd->visible) continue;
4595 if (indi_bd == bd) continue;
4596 if (indi_bd->zone != bd->zone) continue;
4597 if (e_illume_border_is_indicator(bd)) continue;
4598 if (e_illume_border_is_keyboard(bd)) continue;
4599 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
4601 if (!_policy_border_indicator_state_change(indi_bd, bd))
4604 mode = ecore_x_e_illume_indicator_opacity_get(bd->client.win);
4605 ecore_x_e_illume_indicator_opacity_send(indi_bd->client.win, mode);
4607 _policy_root_angle_set(bd);
4609 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, bd->client.win);
4610 g_indi_control_win = bd->client.win;
4618 /* for visibility */
4620 _policy_send_visibility_notify (Ecore_X_Window win, int visibility)
4624 event.type = VisibilityNotify;
4625 event.xvisibility.display = ecore_x_display_get();
4626 event.xvisibility.send_event = EINA_TRUE;
4627 event.xvisibility.state = visibility;
4628 event.xvisibility.window = win;
4630 XSendEvent(event.xvisibility.display
4631 , event.xvisibility.window
4633 , VisibilityChangeMask, &event);
4637 _policy_check_transient_child_visible(E_Border *bd)
4639 Eina_Bool ret = EINA_FALSE;
4640 E_Illume_XWin_Info *child_xwin_info = NULL;
4642 E_Border *child = NULL;
4644 EINA_LIST_FOREACH(bd->transients, l, child)
4646 if (!child) continue;
4647 if (ret) return ret;
4649 child_xwin_info = _policy_xwin_info_find(child->win);
4650 if ((child_xwin_info && (child_xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)) ||
4656 ret = _policy_check_transient_child_visible(child);
4663 _policy_calculate_visibility(void)
4665 // 1. CALCULATES window's region and decide it's visibility.
4666 // 2. DO (UN)ICONIFY if it's needed.
4667 // 3. SEND notify about visibility.
4669 E_Zone *zone = NULL;
4670 E_Border *bd = NULL, *indi_bd = NULL;
4671 Eina_Inlist *xwin_info_list = NULL;
4672 E_Illume_XWin_Info *xwin_info = NULL;
4673 E_Illume_Border_Info *bd_info = NULL;
4674 Ecore_X_XRegion *visible_region = NULL;
4675 Ecore_X_XRegion *win_region = NULL;
4676 Ecore_X_Rectangle visible_rect, win_rect;
4677 Eina_Bool is_fully_obscured = EINA_FALSE;
4678 Eina_Bool is_opaque_win = EINA_FALSE;
4679 Eina_Bool do_not_iconify = EINA_FALSE;
4680 Eina_Bool alpha_opaque = EINA_FALSE;
4681 Eina_Bool obscured_by_alpha_opaque = EINA_FALSE;
4683 int set_root_angle = 0;
4684 int control_indi = 0;
4685 E_Illume_XWin_Info *above_xwin_info = NULL;
4687 if (!_g_visibility_changed) return;
4688 _g_visibility_changed = EINA_FALSE;
4690 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. BEGIN calculate visibility ...\n", __func__, __LINE__);
4691 xwin_info_list = _e_illume_xwin_info_list;
4692 if (!xwin_info_list) return;
4694 // set the entire visible region as a root geometry
4697 visible_rect.width = _g_root_width;
4698 visible_rect.height = _g_root_height;
4700 visible_region = ecore_x_xregion_new();
4701 if (!visible_region)
4703 L (LT_VISIBILITY_DETAIL,
4704 "[ILLUME2][VISIBILITY] BAD.... Creating visible region is failed.\n");
4708 ecore_x_xregion_union_rect(visible_region, visible_region, &visible_rect);
4710 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
4712 // skip "input only" window
4713 if (xwin_info->attr.input_only) continue;
4715 // skip "unmap" window
4716 if ((xwin_info->viewable == 0) &&
4717 (xwin_info->iconify_by_wm == 0)) continue;
4719 if (xwin_info->iconic) continue;
4721 if (!xwin_info->is_drawed) continue;
4723 // initializing variable
4726 is_opaque_win = EINA_TRUE;
4727 do_not_iconify = EINA_FALSE;
4728 old_vis = xwin_info->visibility;
4730 bd_info = xwin_info->bd_info;
4731 if (bd_info) bd = bd_info->border;
4733 // 1. calculates window's region and decide it's visibility.
4734 if (is_fully_obscured == EINA_FALSE)
4736 win_rect.x = xwin_info->attr.x;
4737 win_rect.y = xwin_info->attr.y;
4738 win_rect.width = xwin_info->attr.w;
4739 win_rect.height = xwin_info->attr.h;
4741 // if it stick out or is bigger than the entire visible region,
4742 // clip it by the entire visible's geometry.
4743 E_RECTS_CLIP_TO_RECT(win_rect.x, win_rect.y,
4744 win_rect.width, win_rect.height,
4745 visible_rect.x, visible_rect.y,
4746 (int)(visible_rect.width), (int)(visible_rect.height));
4748 if (ecore_x_xregion_rect_contain(visible_region, &win_rect))
4750 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Un-OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4751 xwin_info->visibility = E_ILLUME_VISIBILITY_UNOBSCURED;
4755 if (bd->client.argb)
4757 if (bd_info && bd_info->opaque)
4759 alpha_opaque = EINA_TRUE;
4763 is_opaque_win = EINA_FALSE;
4767 if (bd->client.illume.win_state.state ==
4768 ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
4770 is_opaque_win = EINA_FALSE;
4775 if (xwin_info->argb)
4776 is_opaque_win = EINA_FALSE;
4781 win_region = ecore_x_xregion_new();
4784 ecore_x_xregion_union_rect(win_region, win_region, &win_rect);
4785 ecore_x_xregion_subtract(visible_region, visible_region, win_region);
4786 ecore_x_xregion_free(win_region);
4789 if (ecore_x_xregion_is_empty(visible_region))
4791 is_fully_obscured = EINA_TRUE;
4794 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... OBSCURED by alpha opaque win:0x%07x\n", __func__, __LINE__, xwin_info->id);
4795 obscured_by_alpha_opaque = EINA_TRUE;
4796 alpha_opaque = EINA_FALSE;
4804 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. place on OUTSIDE\n", __func__, __LINE__, xwin_info->id);
4805 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4810 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... win:0x%07x Fully OBSCURED.. \n", __func__, __LINE__, xwin_info->id);
4811 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
4815 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) continue;
4817 // decide if it's the border that DO NOT iconify.
4818 if (obscured_by_alpha_opaque)
4820 do_not_iconify = EINA_TRUE;
4821 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. win:0x%07x. Do_not_iconify:%d\n", __func__, __LINE__, xwin_info->bd_info->border->client.win, do_not_iconify);
4823 // when this border has transient windows,
4824 // check out this child's visibility.
4825 // if there is any child window that is UNOBSCURED,
4826 // DO NOT iconify this border.
4827 else if (bd->transients)
4829 do_not_iconify = _policy_check_transient_child_visible(bd);
4830 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. win:0x%07x. Do_not_iconify:%d\n", __func__, __LINE__, xwin_info->bd_info->border->client.win, do_not_iconify);
4833 // 2. DO (UN)ICONIFY and send visibility notify if it's needed.
4834 if (old_vis != xwin_info->visibility)
4837 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
4839 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);
4840 _policy_send_visibility_notify(bd->client.win, xwin_info->visibility);
4842 if (xwin_info->visibility == E_ILLUME_VISIBILITY_UNOBSCURED)
4844 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);
4847 if (_e_illume_cfg->use_force_iconify)
4851 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);
4852 _policy_border_force_uniconify(bd);
4856 else if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4858 if (bd->client.win == g_rotated_win)
4860 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. g_rotated_win(0x%07x) is obscured.\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4864 if (_e_illume_cfg->use_force_iconify)
4866 if ((!bd->iconic) && (!do_not_iconify))
4868 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);
4869 _policy_border_iconify_by_illume(xwin_info);
4875 zone = xwin_info->bd_info->border->zone;
4879 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4881 if (_e_illume_cfg->use_force_iconify)
4883 if (bd->parent && bd->parent->iconic)
4885 if ((!bd->iconic) && (!do_not_iconify))
4887 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);
4888 _policy_border_iconify_by_illume(xwin_info);
4891 else if (bd->iconic && do_not_iconify)
4893 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Uniconify by illume.. win:0x%07x\n", __func__, __LINE__, xwin_info->bd_info->border->client.win);
4894 _policy_border_force_uniconify(bd);
4896 else if (bd->transients)
4898 if (!bd->iconic && !do_not_iconify)
4900 if (above_xwin_info && above_xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4902 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);
4903 _policy_border_iconify_by_illume(xwin_info);
4911 // 3. check if opaque window is ocupied the screen.
4912 // then we reset the obscured_by_alpha_opaque flag
4913 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED)
4915 if (obscured_by_alpha_opaque && is_opaque_win)
4917 if (E_CONTAINS(xwin_info->attr.x, xwin_info->attr.y, xwin_info->attr.w, xwin_info->attr.h,
4918 0, 0, _g_root_width, _g_root_height))
4920 L(LT_VISIBILITY_DETAIL, "[ILLUME2][VISIBILITY] %s(%d)... unset obscured_by_alpha_opaque win:%x\n", __func__, __LINE__, xwin_info->id);
4921 obscured_by_alpha_opaque = EINA_FALSE;
4926 above_xwin_info = xwin_info;
4931 if (_e_illume_cfg->use_indicator_widget)
4933 L(LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... Control Root Angle.\n", __func__, __LINE__);
4934 _policy_border_root_angle_control(zone);
4938 indi_bd = e_illume_border_indicator_get(zone);
4941 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... Control Indicator.\n", __func__, __LINE__);
4942 _policy_border_indicator_control(indi_bd);
4947 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. END calculate visibility ...\n", __func__, __LINE__);
4949 if (visible_region) ecore_x_xregion_free(visible_region);
4952 static E_Illume_XWin_Info*
4953 _policy_xwin_info_find (Ecore_X_Window win)
4955 return eina_hash_find(_e_illume_xwin_info_hash, e_util_winid_str_get(win));
4960 _policy_manage_xwins (E_Manager* man)
4962 Ecore_X_Window *windows;
4966 windows = ecore_x_window_children_get(man->root, &wnum);
4969 for (i = 0; i < wnum; i++)
4970 _policy_xwin_info_add(windows[i]);
4975 ecore_x_window_size_get (man->root, &_g_root_width, &_g_root_height);
4980 _policy_xwin_info_add (Ecore_X_Window win)
4984 if (win == _e_overlay_win) return EINA_FALSE;
4986 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
4989 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x EXIST in the list...\n", __func__, __LINE__, win);
4993 xwin_info = (E_Illume_XWin_Info*) calloc (1, sizeof (E_Illume_XWin_Info));
4996 L (LT_XWIN, "[ILLUME2][XWIN] (%s:%d).. Critical Error... Fail to create memory... \n", __func__, __LINE__);
5000 xwin_info->id = win;
5001 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
5003 if (!ecore_x_window_attributes_get(win, &xwin_info->attr))
5009 xwin_info->viewable = xwin_info->attr.viewable;
5011 bd = e_border_find_by_window (win);
5012 xwin_info->bd_info = _policy_get_border_info(bd);
5013 xwin_info->argb = ecore_x_window_argb_get (win);
5015 if (_e_use_comp) xwin_info->comp_vis = 0;
5016 else xwin_info->comp_vis = 1;
5018 eina_hash_add(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
5019 _e_illume_xwin_info_list = eina_inlist_append(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5026 _policy_xwin_info_delete (Ecore_X_Window win)
5028 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (win);
5029 if (xwin_info == NULL)
5031 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, win);
5035 _e_illume_xwin_info_list = eina_inlist_remove(_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5036 eina_hash_del(_e_illume_xwin_info_hash, e_util_winid_str_get(xwin_info->id), xwin_info);
5044 void _policy_window_create (Ecore_X_Event_Window_Create *event)
5046 Ecore_X_Window parent;
5048 parent = ecore_x_window_parent_get(event->win);
5049 if (parent != ecore_x_window_root_get(event->win))
5052 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5054 _policy_xwin_info_add (event->win);
5058 void _policy_window_destroy (Ecore_X_Event_Window_Destroy *event)
5060 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5062 _policy_xwin_info_delete (event->win);
5064 // for supporting dependent rotation
5065 if (dep_rot.refer.cmd_win == event->win)
5066 dep_rot.refer.cmd_win = NULL;
5070 void _policy_window_reparent (Ecore_X_Event_Window_Reparent *event)
5072 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5074 if (event->parent == ecore_x_window_root_first_get())
5075 _policy_xwin_info_add (event->win);
5077 _policy_xwin_info_delete (event->win);
5081 void _policy_window_show (Ecore_X_Event_Window_Show *event)
5083 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5085 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5086 if (xwin_info == NULL)
5088 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5092 xwin_info->viewable = EINA_TRUE;
5094 if (xwin_info->comp_vis)
5096 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5097 _g_visibility_changed = EINA_TRUE;
5102 void _policy_window_hide (Ecore_X_Event_Window_Hide *event)
5104 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5106 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find (event->win);
5107 if (xwin_info == NULL)
5109 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5113 xwin_info->viewable = EINA_FALSE;
5115 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5116 _g_visibility_changed = EINA_TRUE;
5120 void _policy_window_configure (Ecore_X_Event_Window_Configure *event)
5123 E_Illume_XWin_Info* xwin_info;
5124 E_Illume_XWin_Info* old_above_xwin_info;
5125 E_Illume_XWin_Info* new_above_xwin_info;
5126 E_Illume_XWin_Info* temp_xwin_info;
5127 E_Illume_XWin_Info* target_xwin_info;
5128 int check_visibility;
5130 Ecore_X_Window target_win;
5132 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. win:0x%07x...\n", __func__, __LINE__, event->win);
5135 old_above_xwin_info = NULL;
5136 new_above_xwin_info = NULL;
5137 check_visibility = 0;
5139 target_win = event->win;
5141 xwin_info = _policy_xwin_info_find (event->win);
5142 if (xwin_info == NULL)
5144 L (LT_XWIN, "[ILLUME2][XWIN] %s(%d).. No win:0x%07x in the list...\n", __func__, __LINE__, event->win);
5147 target_xwin_info = xwin_info;
5149 if ((xwin_info->attr.x != event->x) ||
5150 (xwin_info->attr.y != event->y))
5152 check_visibility = 1;
5155 if ((xwin_info->attr.w != event->w) ||
5156 (xwin_info->attr.h != event->h))
5159 check_visibility = 1;
5162 xwin_info->attr.x = event->x;
5163 xwin_info->attr.y = event->y;
5164 xwin_info->attr.w = event->w;
5165 xwin_info->attr.h = event->h;
5167 if ((l = EINA_INLIST_GET(xwin_info)->prev) != NULL)
5169 old_above_xwin_info = EINA_INLIST_CONTAINER_GET (l, E_Illume_XWin_Info);
5172 new_above_xwin_info = _policy_xwin_info_find (event->abovewin);
5174 if (old_above_xwin_info != new_above_xwin_info)
5177 if (old_above_xwin_info)
5179 temp_xwin_info = old_above_xwin_info;
5180 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))
5182 if (temp_xwin_info == new_above_xwin_info)
5184 target_win = old_above_xwin_info->id;
5185 target_xwin_info = old_above_xwin_info;
5190 check_visibility = 1;
5193 _e_illume_xwin_info_list = eina_inlist_remove (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5194 if (new_above_xwin_info)
5195 _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));
5197 _e_illume_xwin_info_list = eina_inlist_prepend (_e_illume_xwin_info_list, EINA_INLIST_GET(xwin_info));
5199 if (check_visibility == 1)
5201 if (target_xwin_info->viewable)
5203 if (target_xwin_info->comp_vis)
5207 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. SIZE is changed... target win:0x%07x\n", __func__, __LINE__, target_xwin_info->id);
5208 target_xwin_info->is_drawed = EINA_FALSE;
5212 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5213 _g_visibility_changed = EINA_TRUE;
5215 else if (target_xwin_info->iconify_by_wm)
5217 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5218 _g_visibility_changed = EINA_TRUE;
5225 void _policy_window_configure_request (Ecore_X_Event_Window_Configure_Request *event)
5228 Ecore_X_Event_Window_Configure_Request *e;
5231 bd = e_border_find_by_client_window(e->win);
5234 if (!bd->lock_client_stacking)
5236 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
5237 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
5239 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5241 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5242 _policy_border_focus_top_stack_set (bd);
5245 else if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
5247 if (_e_illume_cfg->use_force_iconify)
5249 if (e->detail == ECORE_X_WINDOW_STACK_BELOW && !e->abovewin)
5251 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. Request Lower window... win:0x%07x\n", __func__, __LINE__, e->win);
5252 E_Illume_XWin_Info *xwin_info = _policy_xwin_info_find(bd->win);
5255 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. ICONIFY win:0x%07x And UN-ICONIFY Top win...\n", __func__, __LINE__, bd->client.win);
5256 _policy_border_uniconify_top_border(bd);
5261 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
5263 if (bd->visible && (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus))
5264 _policy_border_focus_top_stack_set(bd);
5270 void _policy_window_sync_draw_done(Ecore_X_Event_Client_Message* event)
5273 E_Illume_XWin_Info *xwin_info;
5276 win = event->data.l[0];
5277 bd = e_border_find_by_client_window(win);
5280 xwin_info = _policy_xwin_info_find(bd->win);
5281 if (!xwin_info) return;
5283 if (!xwin_info->is_drawed)
5285 if (xwin_info->comp_vis)
5287 xwin_info->is_drawed = EINA_TRUE;
5288 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5289 _g_visibility_changed = EINA_TRUE;
5291 else if (xwin_info->iconify_by_wm)
5293 xwin_info->is_drawed = EINA_TRUE;
5294 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, event->win);
5295 _g_visibility_changed = EINA_TRUE;
5300 /* Setting window mode requires window stack change and window geometry
5301 * change. But now, the WM can't control these sequential operations
5302 * using x property set API which whould be able to overwrite previous
5303 * value before getting x property by the WM.
5304 * So we changed ecore_x_e_illume_window_state_set function to use x send
5305 * message and x sync counter. When the WM receives this message,
5306 * the WM sets window mode and then increases x sync counter.
5308 * TODO: We need to make a new protocol to set the window mode!!
5310 void _policy_illume_win_state_change_request (Ecore_X_Event_Client_Message *event)
5312 E_Border *bd = NULL;
5313 Ecore_X_Atom atom = 0, set = 0;
5314 unsigned int state = 0;
5315 Ecore_X_Sync_Counter counter = 0;
5320 bd = e_border_find_by_client_window(event->win);
5321 atom = event->data.l[0];
5322 counter = event->data.l[1];
5323 val = event->data.l[2];
5325 if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL)
5327 state = ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
5330 else if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING)
5332 state = ECORE_X_ILLUME_WINDOW_STATE_FLOATING;
5336 ELBF(ELBT_ILLUME, 0, event->win,
5337 "GET WIN_STATE_CHANGE_REQ bd:0x%08x(%d->%d) counter:0x%08x val:%d",
5338 bd ? bd->client.win : (unsigned int)NULL,
5339 bd ? bd->client.illume.win_state.state : 0,
5344 _policy_border_illume_window_state_change(bd, state);
5348 ecore_x_window_prop_atom_set(event->win, ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
5350 ELB(ELBT_ILLUME, "SET WIN_STATE", event->win);
5353 if (counter) ecore_x_sync_counter_inc(counter, 1);
5356 void _policy_quickpanel_state_change (Ecore_X_Event_Client_Message* event)
5359 E_Illume_Quickpanel *qp;
5361 if ((zone = e_util_zone_window_find(event->win)))
5363 if ((qp = e_illume_quickpanel_by_zone_get(zone)))
5365 if (event->data.l[0] == (int)ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
5367 _policy_layout_quickpanel_rotate (qp, g_root_angle);
5374 _policy_root_angle_set(E_Border *bd)
5377 Ecore_X_Window root;
5381 angle = _policy_window_rotation_angle_get(bd->client.win);
5382 if (angle == -1) return EINA_FALSE;
5383 if (!(((bd->w == bd->zone->w) && (bd->h == bd->zone->h)) ||
5384 ((bd->w == bd->zone->h) && (bd->h == bd->zone->w))))
5387 g_rotated_win = bd->client.win;
5388 root = bd->zone->container->manager->root;
5392 angle = g_root_angle;
5397 if (_e_illume_cfg->use_indicator_widget)
5399 L(LT_INDICATOR, "[ILLUME2][INDICATOR] %s(%d)... indicator_control_win = 0x%07x...\n", __func__, __LINE__, g_rotated_win);
5400 g_indi_control_win = g_rotated_win;
5403 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);
5404 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d).. SET ROOT ANGLE... angle:%d\n\n", __func__, __LINE__, angle);
5405 // set root window property
5406 ecore_x_window_prop_property_set(root, ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, ECORE_X_ATOM_CARDINAL, 32, &angle, 1);
5412 e_illume_border_is_camera(E_Border *bd)
5414 const char *name = NULL;
5415 const char *clas = NULL;
5417 if (!bd) return EINA_FALSE;
5419 name = bd->client.icccm.name;
5420 clas = bd->client.icccm.class;
5422 if (clas == NULL) return EINA_FALSE;
5423 if (strncmp(clas,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5424 if (name == NULL) return EINA_FALSE;
5425 if (strncmp(name,"camera",strlen("camera"))!= 0) return EINA_FALSE;
5431 _policy_change_root_angle_by_border_angle (E_Border* bd)
5433 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... win:0x%07x\n", __func__, __LINE__, bd ? (unsigned int)bd->client.win:(unsigned int)NULL);
5436 // ignore the angle of special borders - like indicator, keyboard, quickpanel, etc.
5437 if (e_illume_border_is_indicator(bd)) return;
5438 if (e_illume_border_is_keyboard(bd)) return;
5439 if (e_illume_border_is_quickpanel(bd)) return;
5440 if (e_illume_border_is_quickpanel_popup(bd)) return;
5442 if (e_illume_border_is_camera(bd))
5444 if (dep_rot.refer.active_bd == bd)
5446 // make rotation request for the dependent windows such as quickpanel
5447 int ang = _policy_window_rotation_angle_get(bd->client.win);
5448 if (ang == -1) ang = 0;
5450 if (dep_rot.ang != ang)
5451 _policy_border_dependent_rotation(bd, ang);
5455 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... CALL _policy_root_angle_set.. win:0x%07x\n", __func__, __LINE__, bd->client.win);
5456 _policy_root_angle_set(bd);
5460 _policy_indicator_angle_change (E_Border* indi_bd, int angle)
5462 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... indicator:0x%07x\n", __func__, __LINE__, indi_bd ? (unsigned int)indi_bd->client.win:(unsigned int)NULL);
5463 if (!indi_bd) return;
5465 int old_angle = _policy_window_rotation_angle_get (indi_bd->client.win);
5466 if(old_angle == -1) return;
5468 L (LT_ANGLE, "[ILLUME2][ANGLE] %s(%d)... old_angle:%d, new_angle:%d\n", __func__, __LINE__, old_angle, angle);
5469 if (old_angle != angle)
5473 angles[1] = old_angle;
5474 ecore_x_window_prop_property_set(indi_bd->client.win,
5475 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5476 ECORE_X_ATOM_CARDINAL,
5481 ecore_x_client_message32_send (indi_bd->client.win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
5482 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
5485 E_Illume_Quickpanel *qp;
5486 qp = e_illume_quickpanel_by_zone_get (indi_bd->zone);
5489 _policy_layout_quickpanel_rotate (qp, angle);
5495 _policy_border_transient_for_group_make(E_Border *bd,
5504 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5506 if (e_config->transient.raise)
5508 EINA_LIST_FOREACH(bd->transients, l, child)
5510 if (!child) continue;
5513 *list = eina_list_prepend(*list, child);
5514 _policy_border_transient_for_group_make(child, list);
5521 _policy_border_transient_for_border_top_get(E_Border *bd)
5523 E_Border *top_border = NULL;
5524 Eina_List *transient_list = NULL;
5526 _policy_border_transient_for_group_make(bd, &transient_list);
5530 Eina_List *l = NULL;
5535 bl = e_container_border_list_last(bd->zone->container);
5536 while ((temp_bd = e_container_border_list_prev(bl)))
5538 if (top_border) break;
5539 if (temp_bd == bd) break;
5541 EINA_LIST_FOREACH(transient_list, l, temp_bd2)
5543 if (temp_bd == temp_bd2)
5545 top_border = temp_bd2;
5550 e_container_border_list_free(bl);
5553 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);
5555 eina_list_free(transient_list);
5561 _policy_border_transient_for_layer_set(E_Border *bd,
5562 E_Border *parent_bd,
5566 E_Border *top_border;
5569 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5571 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);
5573 ecore_x_window_shadow_tree_flush();
5575 raise = e_config->transient.raise;
5577 bd->saved.layer = bd->layer;
5579 if (e_config->transient.layer)
5584 /* We need to set raise to one, else the child wont
5585 * follow to the new layer. It should be like this,
5586 * even if the user usually doesn't want to raise
5589 e_config->transient.raise = 1;
5590 EINA_LIST_FOREACH(bd->transients, l, child)
5592 if (!child) continue;
5593 child->layer = layer;
5597 top_border = _policy_border_transient_for_border_top_get(parent_bd);
5600 if (top_border != bd)
5602 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);
5603 e_border_stack_above(bd, top_border);
5608 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);
5609 e_border_stack_above(bd, parent_bd);
5612 e_config->transient.raise = raise;
5615 /* for desktop mode */
5617 _policy_zone_layout_app_single_monitor(E_Illume_Border_Info* bd_info, E_Illume_Config_Zone *cz)
5621 Eina_Bool resize = EINA_FALSE;
5622 Eina_Bool move = EINA_FALSE;
5624 bd = bd_info->border;
5627 fprintf(stderr, "[ILLUME2] fatal error! (%s) There is no border!\n", __func__);
5631 if ((!bd->new_client) && (!bd->visible)) return;
5633 layer = _policy_zone_layout_app_layer_check(bd);
5637 int zx = 0, zy = 0, zw = 0, zh = 0;
5638 int new_x, new_y, new_w, new_h;
5640 if (!bd->client.icccm.request_pos)
5643 Eina_List *skiplist = NULL;
5646 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5648 // calculate width & height
5654 delta = delta * 0.66;
5656 new_w = delta * 9.0;
5657 new_h = delta * 16.0;
5660 new_x = zx + (rand() % (zw - new_w));
5664 new_y = zy + (rand() % (zh - new_h));
5668 skiplist = eina_list_append(skiplist, bd);
5670 e_place_zone_region_smart(bd->zone, skiplist,
5671 bd->x, bd->y, new_w, new_h,
5674 eina_list_free(skiplist);
5679 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
5681 if (zx > bd->x) new_x = zx;
5684 if (zy > bd->y) new_y = zy;
5687 if (zw < bd->w) new_w = zw;
5690 if (zh < bd->h) new_h = zh;
5694 if ((bd->x != new_x) || (bd->y != new_y))
5697 if ((bd->w != new_w) || (bd->h != new_h))
5701 e_border_move_resize(bd, new_x, new_y, new_w, new_h);
5703 _policy_border_move(bd, new_x, new_y);
5705 _policy_border_resize(bd, new_w, new_h);
5709 /* check if user defined position */
5710 if (bd->client.icccm.request_pos)
5712 if (bd->client.illume.win_state.state)
5714 if (bd_info->resize_req.need_change)
5716 if ((bd->x != bd_info->resize_req.mouse.x) ||
5717 (bd->y != bd_info->resize_req.mouse.y))
5720 if ((bd->w != bd_info->resize_req.mouse.w) ||
5721 (bd->h != bd_info->resize_req.mouse.h))
5726 e_border_move_resize(bd,
5727 bd_info->resize_req.mouse.x,
5728 bd_info->resize_req.mouse.y,
5729 bd_info->resize_req.mouse.w,
5730 bd_info->resize_req.mouse.h);
5734 _policy_border_move(bd,
5735 bd_info->resize_req.mouse.x,
5736 bd_info->resize_req.mouse.y);
5740 _policy_border_resize(bd,
5741 bd_info->resize_req.mouse.w,
5742 bd_info->resize_req.mouse.h);
5745 bd_info->resize_req.need_change = 0;
5746 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);
5749 if (bd_info->resize_req.mouse.down &&
5750 bd_info->resize_req.mouse.locked)
5752 if ((bd->x != bd_info->resize_req.mouse.x) ||
5753 (bd->y != bd_info->resize_req.mouse.y))
5754 _policy_border_move(bd,
5755 bd_info->resize_req.mouse.x,
5756 bd_info->resize_req.mouse.y);
5757 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);
5760 _policy_zone_layout_app_layer_set(bd, layer);
5764 /* resize & move if needed */
5765 if (bd->client.illume.win_state.state)
5767 if (bd_info->resize_req.need_change)
5769 if ((bd->x != bd_info->resize_req.mouse.x) ||
5770 (bd->y != bd_info->resize_req.mouse.y))
5773 if ((bd->w != bd_info->resize_req.mouse.w) ||
5774 (bd->h != bd_info->resize_req.mouse.h))
5779 e_border_move_resize(bd,
5780 bd_info->resize_req.mouse.x,
5781 bd_info->resize_req.mouse.y,
5782 bd_info->resize_req.mouse.w,
5783 bd_info->resize_req.mouse.h);
5787 _policy_border_move(bd,
5788 bd_info->resize_req.mouse.x,
5789 bd_info->resize_req.mouse.y);
5793 _policy_border_resize(bd,
5794 bd_info->resize_req.mouse.w,
5795 bd_info->resize_req.mouse.h);
5798 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);
5799 bd_info->resize_req.need_change = 0;
5802 if (bd_info->resize_req.mouse.down &&
5803 bd_info->resize_req.mouse.locked)
5805 if ((bd->x != bd_info->resize_req.mouse.x) ||
5806 (bd->y != bd_info->resize_req.mouse.y))
5807 _policy_border_move(bd,
5808 bd_info->resize_req.mouse.x,
5809 bd_info->resize_req.mouse.y);
5810 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);
5815 /* set layer if needed */
5816 _policy_zone_layout_app_layer_set(bd, layer);
5819 void _policy_window_move_resize_request(Ecore_X_Event_Window_Move_Resize_Request *event)
5822 E_Illume_Border_Info *bd_info;
5823 Ecore_X_Event_Window_Move_Resize_Request *e;
5826 bd = e_border_find_by_client_window(e->win);
5828 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);
5830 if (e->direction == ECORE_X_NETWM_DIRECTION_MOVE ||
5831 e->direction == ECORE_X_NETWM_DIRECTION_CANCEL)
5834 if (bd->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
5837 bd_info = _policy_get_border_info(bd);
5838 if (!bd_info) return;
5840 e_border_resize_cancel();
5842 if (bd_info->resize_req.mouse.down)
5845 L(LT_AIA, "[ILLUME2][AIA] %s(%d)... \n", __func__, __LINE__);
5847 bd_info->resize_req.mouse.down = 1;
5848 bd_info->resize_req.mouse.dx = bd->x - e->x;
5849 bd_info->resize_req.mouse.dy = bd->y - e->y;
5850 bd_info->resize_req.mouse.x = bd->x;
5851 bd_info->resize_req.mouse.y = bd->y;
5853 bd->lock_user_location = 1;
5855 _policy_border_illume_handlers_add(bd_info);
5856 ecore_x_window_raise(bd->event_win);
5857 if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
5858 e_grabinput_get(bd->event_win, 0, bd->event_win);
5860 e_grabinput_get(bd->event_win, 0, 0);
5862 bd_info->resize_req.direction = e->direction;
5863 _policy_resize_start(bd_info);
5866 void _policy_window_state_request(Ecore_X_Event_Window_State_Request *event)
5869 Ecore_X_Event_Window_State_Request *e;
5871 E_Maximize maximize = 0;
5874 bd = e_border_find_by_client_window(e->win);
5877 for (i = 0; i < 2; i++)
5879 switch (e->state[i])
5881 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
5882 if (bd->lock_client_maximize) break;
5883 maximize |= E_MAXIMIZE_VERTICAL;
5886 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
5887 if (bd->lock_client_maximize) break;
5888 maximize |= E_MAXIMIZE_HORIZONTAL;
5896 if (maximize &= E_MAXIMIZE_BOTH)
5898 if (e->action == ECORE_X_WINDOW_STATE_ACTION_ADD)
5900 if (bd->pointer && bd->pointer->type)
5901 e_pointer_type_pop(bd->pointer, bd, bd->pointer->type);
5906 static void _policy_border_root_angle_control(E_Zone *zone)
5908 Eina_Inlist *xwin_info_list;
5909 E_Illume_XWin_Info *xwin_info;
5913 xwin_info_list = _e_illume_xwin_info_list;
5917 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
5919 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
5921 if (xwin_info->bd_info)
5923 bd = xwin_info->bd_info->border;
5926 if (!bd->visible) continue;
5927 if (bd->zone != zone) continue;
5928 if (e_illume_border_is_indicator(bd)) continue;
5929 if (e_illume_border_is_keyboard(bd)) continue;
5930 if (e_illume_border_is_quickpanel(bd)) continue;
5931 if (e_illume_border_is_quickpanel_popup(bd)) continue;
5932 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
5934 if (_policy_root_angle_set(bd)) break;
5941 static int _policy_border_layer_map(int layer)
5945 if (layer < 0) layer = 0;
5946 pos = 1 + (layer / 50);
5947 if (pos > POL_NUM_OF_LAYER) pos = POL_NUM_OF_LAYER;
5952 _policy_msg_handler(void *data, const char *name, const char *info, int val, E_Object *obj, void *msgdata)
5954 E_Manager *man = (E_Manager *)obj;
5955 E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
5957 // handle only comp.manager msg
5958 if (strncmp(name, "comp.manager", sizeof("comp.manager"))) return;
5960 if (!strncmp(info, "visibility.src", sizeof("visibility.src")))
5962 E_Illume_XWin_Info *xwin_info;
5964 Ecore_X_Window active_win;
5965 Ecore_X_Window client_win;
5968 win = e_manager_comp_src_window_get(man, src);
5970 xwin_info = _policy_xwin_info_find(win);
5971 if (!xwin_info) return;
5973 visible = e_manager_comp_src_visible_get(man, src);
5976 xwin_info->is_drawed = EINA_TRUE;
5977 xwin_info->comp_vis = 1;
5978 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, win);
5979 _g_visibility_changed = EINA_TRUE;
5981 if (xwin_info->bd_info && xwin_info->bd_info->border)
5982 client_win = xwin_info->bd_info->border->client.win;
5986 active_win = _policy_active_window_get(ecore_x_window_root_get(win));
5987 if (active_win == client_win)
5989 _policy_active_win_change(xwin_info, active_win);
5994 xwin_info->comp_vis = 0;
5999 void _policy_module_update(E_Event_Module_Update *event)
6001 if ((!strncmp(event->name, "comp-tizen", sizeof("comp-tizen"))) ||
6002 (!strncmp(event->name, "comp", sizeof("comp"))))
6007 _e_use_comp = EINA_TRUE;
6012 _e_use_comp = EINA_FALSE;
6014 // change all variable to 1
6015 Eina_Inlist* xwin_info_list;
6016 E_Illume_XWin_Info *xwin_info;
6018 xwin_info_list = _e_illume_xwin_info_list;
6021 EINA_INLIST_REVERSE_FOREACH (xwin_info_list, xwin_info)
6023 xwin_info->comp_vis = EINA_TRUE;
6030 void _policy_border_iconify_cb(E_Border *bd)
6032 if (!_e_illume_cfg->use_force_iconify) return;
6035 if (e_object_is_del(E_OBJECT(bd))) return;
6037 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
6038 if (xwin_info == NULL) return;
6040 _policy_border_uniconify_below_borders_by_illume(xwin_info);
6042 if (xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED)
6044 int old_vis = xwin_info->visibility;
6045 xwin_info->visibility = E_ILLUME_VISIBILITY_FULLY_OBSCURED;
6046 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);
6048 SECURE_SLOGD("[WM] SEND VISIBILITY. win:0x%07x (old:%d -> new:%d)", xwin_info->bd_info->border->client.win, old_vis, xwin_info->visibility);
6050 _policy_send_visibility_notify (xwin_info->bd_info->border->client.win, xwin_info->visibility);
6053 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);
6054 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
6055 _g_visibility_changed = EINA_TRUE;
6057 xwin_info->attr.visible = 0;
6058 xwin_info->iconic = EINA_TRUE;
6060 _policy_border_focus_top_stack_set(bd);
6063 void _policy_border_uniconify_cb(E_Border *bd)
6065 if (!_e_illume_cfg->use_force_iconify) return;
6068 if (e_object_is_del(E_OBJECT(bd))) return;
6070 E_Illume_XWin_Info* xwin_info = _policy_xwin_info_find(bd->win);
6071 if (xwin_info == NULL) return;
6073 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);
6075 xwin_info->iconify_by_wm = 0;
6076 xwin_info->attr.visible = 1;
6077 xwin_info->iconic = EINA_FALSE;
6079 L(LT_VISIBILITY, "[ILLUME2][VISIBILITY] %s(%d).. visibility is changed... win:0x%07x\n", __func__, __LINE__, bd->client.win);
6080 _g_visibility_changed = EINA_TRUE;
6082 _policy_border_focus_top_stack_set(bd);
6086 _policy_border_event_border_iconify_free(void *data __UNUSED__,
6089 E_Event_Border_Iconify *e;
6092 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_iconify_event");
6093 e_object_unref(E_OBJECT(e->border));
6099 _policy_border_force_iconify(E_Border *bd)
6101 E_Event_Border_Iconify *ev;
6102 unsigned int iconic;
6103 E_Illume_XWin_Info* xwin_info;
6106 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6107 if (bd->shading) return;
6108 ecore_x_window_shadow_tree_flush();
6112 e_border_hide(bd, 0);
6113 if (bd->fullscreen) bd->desk->fullscreen_borders--;
6114 edje_object_signal_emit(bd->bg_object, "e,action,iconify", "e");
6117 e_hints_window_iconic_set(bd);
6118 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6120 ev = E_NEW(E_Event_Border_Iconify, 1);
6122 e_object_ref(E_OBJECT(bd));
6123 // e_object_breadcrumb_add(E_OBJECT(bd), "border_iconify_event");
6124 ecore_event_add(E_EVENT_BORDER_ICONIFY, ev, _policy_border_event_border_iconify_free, NULL);
6126 xwin_info = _policy_xwin_info_find(bd->win);
6129 xwin_info->iconify_by_wm = 1;
6132 if (e_config->transient.iconify)
6136 E_Illume_XWin_Info* child_xwin_info;
6138 EINA_LIST_FOREACH(bd->transients, l, child)
6140 if (!e_object_is_del(E_OBJECT(child)))
6144 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... Iconify by illume.. child:0x%07x\n", __func__, __LINE__, child->client.win);
6145 child_xwin_info = _policy_xwin_info_find(child->win);
6146 if (child_xwin_info)
6148 _policy_border_iconify_by_illume(child_xwin_info);
6154 e_remember_update(bd);
6158 _policy_border_iconify_by_illume(E_Illume_XWin_Info *xwin_info)
6162 if (!xwin_info) return;
6163 if (!xwin_info->bd_info) return;
6164 if (!xwin_info->bd_info->border) return;
6166 bd = xwin_info->bd_info->border;
6167 if (!E_ILLUME_BORDER_IS_IN_MOBILE(bd)) return;
6168 if (e_object_is_del(E_OBJECT(bd))) return;
6170 if ((xwin_info->visibility != E_ILLUME_VISIBILITY_FULLY_OBSCURED) &&
6171 (bd->parent && (!bd->parent->iconic)))
6174 if (e_illume_border_is_indicator(bd)) return;
6175 // if (e_illume_border_is_keyboard(bd)) return;
6176 // if (e_illume_border_is_keyboard_sub(bd)) return;
6177 if (e_illume_border_is_quickpanel(bd)) return;
6178 if (e_illume_border_is_quickpanel_popup(bd)) return;
6179 if (e_illume_border_is_clipboard(bd)) return;
6180 if (e_illume_border_is_app_tray(bd)) return;
6181 if (e_illume_border_is_miniapp_tray(bd)) return;
6182 // if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) return;
6184 xwin_info->iconify_by_wm = 1;
6188 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... FORCE_ICONIFY win:0x%07x\n", __func__, __LINE__, bd->client.win);
6189 _policy_border_force_iconify(bd);
6194 _policy_border_event_border_uniconify_free(void *data, void *ev)
6196 E_Event_Border_Uniconify *e;
6199 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_uniconify_event");
6200 e_object_unref(E_OBJECT(e->border));
6204 static void _policy_border_force_uniconify(E_Border *bd)
6207 E_Event_Border_Uniconify *ev;
6208 unsigned int iconic;
6209 E_Illume_XWin_Info* xwin_info;
6212 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
6214 xwin_info = _policy_xwin_info_find(bd->win);
6215 if (!(xwin_info && xwin_info->iconify_by_wm)) return;
6217 if (bd->shading) return;
6218 ecore_x_window_shadow_tree_flush();
6223 if (bd->fullscreen) bd->desk->fullscreen_borders++;
6224 if (e_manager_comp_evas_get(bd->zone->container->manager))
6226 if (bd->await_hide_event > 0)
6227 bd->await_hide_event--;
6229 desk = e_desk_current_get(bd->desk->zone);
6230 e_border_desk_set(bd, desk);
6231 edje_object_signal_emit(bd->bg_object, "e,action,uniconify", "e");
6234 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
6236 ev = E_NEW(E_Event_Border_Uniconify, 1);
6238 e_object_ref(E_OBJECT(bd));
6239 // e_object_breadcrumb_add(E_OBJECT(bd), "border_uniconify_event");
6240 ecore_event_add(E_EVENT_BORDER_UNICONIFY, ev, _policy_border_event_border_uniconify_free, NULL);
6242 if (e_config->transient.iconify)
6246 E_Illume_XWin_Info* child_xwin_info;
6248 EINA_LIST_FOREACH(bd->transients, l, child)
6250 if (!e_object_is_del(E_OBJECT(child)))
6254 child_xwin_info = _policy_xwin_info_find(child->win);
6255 if (child_xwin_info) child_xwin_info->iconify_by_wm = 1;
6257 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, child->client.win);
6258 _policy_border_force_uniconify(child);
6263 e_remember_update(bd);
6267 _policy_border_uniconify_below_borders_by_illume(E_Illume_XWin_Info *xwin_info)
6271 if (!xwin_info) return;
6272 if (!xwin_info->bd_info) return;
6274 bd = xwin_info->bd_info->border;
6276 // 1. check if iconify is caused by visibility change or not
6277 if (xwin_info->iconify_by_wm) return;
6279 // 2. check if current bd's visibility is fully-obscured or not
6280 if (xwin_info->visibility == E_ILLUME_VISIBILITY_FULLY_OBSCURED) return;
6282 // 3-1. find bd's below window and un-iconify it
6283 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d)... UNICONIFY Below Windows of win:0x%07x\n", __func__, __LINE__, bd->client.win);
6284 _policy_border_uniconify_below_borders(bd);
6286 if (!e_object_is_del(E_OBJECT(bd)))
6292 static E_Border* _policy_border_find_below(E_Border *bd)
6297 E_Illume_XWin_Info* xwin_info;
6299 passed = EINA_FALSE;
6301 /* determine layering position */
6302 pos = _policy_border_layer_map(bd->layer);
6304 /* Find the windows below this one */
6305 for (i = pos; i >= 2; i--)
6309 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6313 /* skip if it's the same border */
6320 if ((b->x == b->zone->x) &&
6321 (b->y == b->zone->y) &&
6322 (b->w == b->zone->w) &&
6323 (b->h == b->zone->h) &&
6324 (b->h == b->zone->h) &&
6325 (b->client.illume.win_state.state != ECORE_X_ILLUME_WINDOW_STATE_FLOATING) &&
6328 xwin_info = _policy_xwin_info_find(b->win);
6331 if ((!xwin_info->argb) ||
6332 (xwin_info->argb && xwin_info->bd_info->opaque))
6334 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);
6340 if (!passed) continue;
6342 /* skip if it's not on this zone */
6343 if (b->zone != bd->zone) continue;
6345 /* skip special borders */
6346 if (e_illume_border_is_indicator(b)) continue;
6347 if (e_illume_border_is_keyboard(b)) continue;
6348 if (e_illume_border_is_keyboard_sub(b)) continue;
6349 if (e_illume_border_is_quickpanel(b)) continue;
6350 if (e_illume_border_is_quickpanel_popup(b)) continue;
6351 if (e_illume_border_is_clipboard(b)) continue;
6352 if (e_illume_border_is_app_tray(b)) continue;
6353 if (e_illume_border_is_miniapp_tray(b)) continue;
6362 static void _policy_border_uniconify_below_borders(E_Border *bd)
6366 below_bd = _policy_border_find_below(bd);
6367 if (!below_bd) return;
6369 E_Illume_XWin_Info* below_xwin_info = _policy_xwin_info_find(below_bd->win);
6370 if (below_xwin_info == NULL) return;
6372 if ((below_bd->w != below_bd->zone->w) ||
6373 (below_bd->h != below_bd->zone->h) ||
6374 (below_xwin_info->argb))
6376 if (!(below_xwin_info->bd_info && below_xwin_info->bd_info->opaque))
6377 _policy_border_uniconify_below_borders(below_bd);
6381 if (below_bd->iconic)
6383 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, below_bd->client.win);
6384 _policy_border_force_uniconify(below_bd);
6388 static void _policy_border_uniconify_top_border(E_Border *bd)
6393 E_Illume_XWin_Info* xwin_info;
6395 if (!_e_illume_cfg->use_force_iconify) return;
6397 zone_w = bd->zone->w;
6398 zone_h = bd->zone->h;
6399 /* determine layering position */
6401 /* Find the windows below this one */
6402 for (i = POL_NUM_OF_LAYER; i >= 2; i--)
6406 EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b)
6410 if ((b->x >= zone_w) || (b->y >= zone_h)) continue;
6411 if (((b->x + b->w) <= 0) || ((b->y + b->h) <= 0)) continue;
6413 /* skip if it's not on this zone */
6414 if (b->zone != bd->zone) continue;
6416 /* skip special borders */
6417 if (e_illume_border_is_indicator(b)) continue;
6418 if (e_illume_border_is_keyboard(b)) continue;
6419 if (e_illume_border_is_keyboard_sub(b)) continue;
6420 if (e_illume_border_is_quickpanel(b)) continue;
6421 if (e_illume_border_is_quickpanel_popup(b)) continue;
6422 if (e_illume_border_is_clipboard(b)) continue;
6423 if (e_illume_border_is_app_tray(b)) continue;
6424 if (e_illume_border_is_miniapp_tray(b)) continue;
6428 L(LT_ICONIFY, "[ILLUME2][ICONIFY] %s(%d).. FORCE UNICONIFY... win:0x%07x\n", __func__, __LINE__, b->client.win);
6429 _policy_border_force_uniconify(b);
6432 if ((b->x == b->zone->x) &&
6433 (b->y == b->zone->y) &&
6434 (b->w == b->zone->w) &&
6435 (b->h == b->zone->h))
6437 xwin_info = _policy_xwin_info_find(b->win);
6440 if (xwin_info->argb && !xwin_info->bd_info->opaque)
6455 /* change the desk of window for popsync.
6456 * if there is no window in data read from ev->l[0],
6457 * window that is latest above stack will be changed.
6458 * - event->data.l[0] : window ID
6459 * - event->data.l[1]
6460 * 1(default): mobile
6464 _policy_window_desk_set(Ecore_X_Event_Client_Message *event)
6466 Ecore_X_Event_Client_Message *ev = event;
6470 E_Desk *desk = NULL;
6473 Eina_Bool one_time = EINA_FALSE;
6474 char *profile = NULL, *new_profile = NULL;
6475 unsigned int desk_num;
6479 EINA_SAFETY_ON_NULL_RETURN(ev);
6481 win = ev->data.l[0];
6482 desk_num = ev->data.l[1];
6483 if (win) one_time = EINA_TRUE;
6485 // decide new desk's profile from received data.
6489 new_profile = _e_illume_cfg->display_name.popsync;
6493 new_profile = _e_illume_cfg->display_name.mobile;
6497 con = e_container_current_get(e_manager_current_get());
6498 bl = e_container_border_list_last(con);
6500 // if there exists a ID of window read from data ev->data.l[0],
6501 // find and set this window's border window, or set latest above border.
6502 bd = win ? e_border_find_by_client_window(win) :
6503 e_container_border_list_prev(bl);
6504 if (!bd) bd = e_border_find_by_window(win);
6509 // skip special window.
6510 if ((e_illume_border_is_indicator(bd)) ||
6511 (e_illume_border_is_keyboard(bd)) ||
6512 (e_illume_border_is_keyboard_sub(bd)) ||
6513 (e_illume_border_is_quickpanel(bd)) ||
6514 (e_illume_border_is_quickpanel_popup(bd)) ||
6515 (e_illume_border_is_clipboard(bd)))
6517 if (one_time) goto fin;
6521 if ((bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) &&
6522 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
6523 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
6524 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
6525 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
6526 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP) &&
6527 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NOTIFICATION))
6532 // terminated this function if there is only one desk.
6533 if ((zone->desk_x_count < 2) && (zone->desk_y_count < 2))
6537 // find the corresponsive desk.
6538 for (x = 0; x < zone->desk_x_count; x++)
6540 for (y = 0; y < zone->desk_y_count; y++)
6542 int index = x + (y * zone->desk_x_count);
6543 profile = zone->desks[index]->window_profile;
6545 if (!strcmp(new_profile, profile))
6546 desk = zone->desks[index];
6550 if (!desk) goto fin;
6552 e_border_desk_set(bd, desk);
6554 // we have to receive the DAMAGE notify from this window.
6555 // for this, the window has to have visible state as a its property.
6556 // if not, can not receive DAMAGE notify.
6557 e_hints_window_visible_set(bd);
6558 e_hints_window_desktop_set(bd);
6559 _policy_border_uniconify_below_borders(bd);
6562 } while((!one_time) && (bd = e_container_border_list_prev(bl)));
6565 e_container_border_list_free(bl);
6569 "[POPSYNC] ERROR: ");
6573 fprintf(stderr, "Couldn't find border.\n");
6576 fprintf(stderr, "Couldn't change desk. No border, or special window.\n");
6579 fprintf(stderr, "NO desk to change \n");
6582 fprintf(stderr, "Couldn't find desk such a profile.\n");
6585 fprintf(stderr, "Non-defined error\n");
6591 /* for supporting rotation */
6593 _policy_border_hook_rotation_list_add(E_Border *bd)
6598 rotation = bd->client.e.state.rot.curr;
6599 _policy_border_dependent_rotation(bd, rotation);
6603 _policy_border_dependent_rotation(E_Border *bd, int rotation)
6606 E_Border *dep_bd = NULL;
6609 if (!dep_rot.list) return;
6610 if (dep_rot.refer.active_bd != bd) return;
6612 EINA_LIST_FOREACH(dep_rot.list, l, dep_bd)
6614 if (!dep_bd) continue;
6615 if (!dep_bd->visible) continue;
6616 if (_policy_dependent_rotation_check(dep_bd, rotation))
6618 ELBF(ELBT_ROT, 0, dep_bd->client.win, "ROT_SET ANG [%d -> %d]",
6619 dep_bd->client.e.state.rot.curr, rotation);
6620 e_border_rotation_set(dep_bd, rotation);
6623 dep_rot.ang = rotation;
6627 _policy_dependent_rotation_check(E_Border *bd, int rotation)
6629 Eina_Bool ret = EINA_FALSE;
6632 if (rotation < 0) goto end;
6633 if ((!bd->client.e.state.rot.support) && (!bd->client.e.state.rot.app_set)) goto end;
6634 if (bd->client.e.state.rot.curr == rotation) goto end;
6636 if (bd->client.e.state.rot.preferred_rot == -1)
6640 if (bd->client.e.state.rot.app_set)
6642 if (bd->client.e.state.rot.available_rots &&
6643 bd->client.e.state.rot.count)
6645 Eina_Bool found = EINA_FALSE;
6646 for (i = 0; i < bd->client.e.state.rot.count; i++)
6648 if (bd->client.e.state.rot.available_rots[i] == rotation)
6653 if (found) ret = EINA_TRUE;
6658 ELB(ELBT_ROT, "DO ROT", 0);
6662 else if (bd->client.e.state.rot.preferred_rot == rotation) ret = EINA_TRUE;
6666 ELBF(ELBT_ROT, 0, bd ? bd->client.win : NULL,
6667 "[DEPENDENT] Couldn't or don't need to rotate it as given angle:%d", rotation);
6672 _policy_property_indicator_cmd_win_change(Ecore_X_Event_Window_Property *event)
6674 Ecore_X_Window cmd_win;
6676 cmd_win = _policy_indicator_cmd_win_get(event->win);
6680 ELB(ELBT_ROT, "ERR! NO INDI_CMD_WIN", event->win);
6684 if (dep_rot.refer.cmd_win != cmd_win)
6686 ELBF(ELBT_ROT, 0, cmd_win,
6687 "INDICATOR COMMAND WIN: [0x%08x -> 0x%08x]",
6688 dep_rot.refer.cmd_win, cmd_win);
6689 dep_rot.refer.cmd_win = cmd_win;
6694 _policy_property_active_indicator_win_change(Ecore_X_Event_Window_Property *event)
6696 Ecore_X_Window active_win = 0;
6697 E_Border *bd = NULL;
6702 active_win = _policy_active_indicator_win_get(event->win);
6705 ELB(ELBT_ROT, "ERR! NO ACTIVE_INDI_WIN", event->win);
6709 if ((!dep_rot.refer.active_bd) ||
6710 (dep_rot.refer.active_bd->client.win != active_win))
6712 bd = e_border_find_by_client_window(active_win);
6715 ELB(ELBT_ROT, "ERR! NO BD ACTIVE_INDI_WIN", active_win);
6719 /* The normal application window is ok to rotate dependent rotation windows.
6720 * But if the notification window which doesn't have accepts_focus such as volume popup
6721 * is the active window, then the illume doesn't rotate dependent windows.
6723 Eina_Bool rot = EINA_FALSE;
6724 if (e_illume_border_is_notification(bd))
6726 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
6736 ELBF(ELBT_ROT, 0, bd->client.win,
6737 "ROT:%d NOTI:%d ACCEPT_FOCUS:%d TAKE_FOCUS:%d",
6739 e_illume_border_is_notification(bd),
6740 bd->client.icccm.accepts_focus,
6741 bd->client.icccm.take_focus);
6745 ELBF(ELBT_ROT, 0, active_win,
6746 "INDICATOR ACTIVE WIN CHANGED:0x%08x", active_win);
6747 dep_rot.refer.active_bd = bd;
6748 rotation = bd->client.e.state.rot.curr;
6750 _policy_border_dependent_rotation(bd, rotation);
6755 static Ecore_X_Window
6756 _policy_indicator_cmd_win_get(Ecore_X_Window win)
6758 Ecore_X_Window cmd_win = NULL;
6759 unsigned char* prop_data = NULL;
6760 int ret = 0, count = 0;
6762 if (win != dep_rot.root) return NULL;
6764 ret = ecore_x_window_prop_property_get(win, E_INDICATOR_CMD_WIN,
6765 ECORE_X_ATOM_WINDOW, 32,
6766 &prop_data, &count);
6768 memcpy (&cmd_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6770 if (prop_data) free(prop_data);
6775 static Ecore_X_Window
6776 _policy_active_indicator_win_get(Ecore_X_Window win)
6778 Ecore_X_Window active_win = NULL;
6779 unsigned char* prop_data = NULL;
6780 int ret = 0, count = 0;
6782 if (win != dep_rot.refer.cmd_win) return NULL;
6784 ret = ecore_x_window_prop_property_get(win, E_ACTIVE_INDICATOR_WIN,
6785 ECORE_X_ATOM_WINDOW, 32,
6786 &prop_data, &count);
6788 memcpy (&active_win, prop_data, sizeof(ECORE_X_ATOM_WINDOW));
6790 if (prop_data) free(prop_data);
6796 _prev_angle_get(Ecore_X_Window win)
6798 int ret, count = 0, ang = -1;
6799 unsigned char* data = NULL;
6801 ret = ecore_x_window_prop_property_get
6802 (win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
6803 ECORE_X_ATOM_CARDINAL, 32, &data, &count);
6805 if ((ret) && (data) && (count))
6806 ang = ((int *)data)[0];
6807 if (data) free(data);
6813 _policy_idle_enterer(void)
6815 _policy_calculate_visibility();