2 #include "e_client_intern.h"
4 #define PRI(ec) ((E_Client_Private *)e_object_data_get(E_OBJECT(ec)))
7 EINA_SAFETY_ON_NULL_RETURN(ec); \
8 E_Client_Private *priv = PRI(ec)
10 #define API_ENTRY_VAL(ret) \
11 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ret); \
12 E_Client_Private *priv = PRI(ec)
14 typedef struct _E_Client_Private E_Client_Private;
16 struct _E_Client_Private
20 struct wl_signal eval_pre_fetch;
21 struct wl_signal eval_fetch;
22 struct wl_signal eval_pre_post_fetch;
23 struct wl_signal eval_post_fetch;
24 struct wl_signal eval_pre_frame_assign;
25 struct wl_signal eval_post_frame_assign;
26 struct wl_signal eval_pre_new_client;
27 struct wl_signal eval_post_new_client;
28 struct wl_signal eval_visibility;
29 struct wl_signal eval_visibility_end;
30 struct wl_signal eval_end;
32 struct wl_signal move_begin;
33 struct wl_signal move_update;
34 struct wl_signal move_end;
35 struct wl_signal move_resize_begin;
36 struct wl_signal move_resize_update;
37 struct wl_signal move_resize_end;
39 struct wl_signal destroy;
40 struct wl_signal new_client;
41 struct wl_signal new_client_post;
43 struct wl_signal unredirect;
44 struct wl_signal redirect;
46 struct wl_signal aux_hint_change;
47 struct wl_signal window_role_change;
48 struct wl_signal transform_change;
49 struct wl_signal activate_done;
51 struct wl_signal mouse_in;
52 struct wl_signal mouse_out;
53 struct wl_signal mouse_down;
55 struct wl_signal focus_set;
56 struct wl_signal focus_unset;
57 struct wl_signal focus_defer_set;
58 struct wl_signal focus_latest_set;
60 struct wl_signal iconify;
61 struct wl_signal uniconify;
62 struct wl_signal maximize;
63 struct wl_signal unmaximize;
64 struct wl_signal fullscreen_pre;
65 struct wl_signal fullscreen;
66 struct wl_signal unfullscreen;
68 struct wl_signal move;
70 struct wl_signal layer_set;
71 struct wl_signal raise;
72 struct wl_signal lower;
73 struct wl_signal stack_below;
74 struct wl_signal stack_above;
75 struct wl_signal stack_transient_for_done;
77 struct wl_signal stick;
78 struct wl_signal unstick;
82 static int _e_client_hooks_delete = 0;
83 static int _e_client_hooks_walking = 0;
85 static int _e_client_intercept_hooks_delete = 0;
86 static int _e_client_intercept_hooks_walking = 0;
88 E_API int E_EVENT_CLIENT_ADD = -1;
89 E_API int E_EVENT_CLIENT_REMOVE = -1;
90 E_API int E_EVENT_CLIENT_ZONE_SET = -1;
91 E_API int E_EVENT_CLIENT_DESK_SET = -1;
92 E_API int E_EVENT_CLIENT_RESIZE = -1;
93 E_API int E_EVENT_CLIENT_MOVE = -1;
94 E_API int E_EVENT_CLIENT_SHOW = -1;
95 E_API int E_EVENT_CLIENT_HIDE = -1;
96 E_API int E_EVENT_CLIENT_ICONIFY = -1;
97 E_API int E_EVENT_CLIENT_UNICONIFY = -1;
98 E_API int E_EVENT_CLIENT_STACK = -1;
99 E_API int E_EVENT_CLIENT_FOCUS_IN = -1;
100 E_API int E_EVENT_CLIENT_FOCUS_OUT = -1;
101 E_API int E_EVENT_CLIENT_PROPERTY = -1;
102 E_API int E_EVENT_CLIENT_FULLSCREEN = -1;
103 E_API int E_EVENT_CLIENT_UNFULLSCREEN = -1;
104 #ifdef _F_ZONE_WINDOW_ROTATION_
105 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = -1;
106 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = -1;
107 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1;
108 E_API int E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = -1;
110 E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1;
111 E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1;
112 E_API int E_EVENT_CLIENT_FOCUS_SKIP_SET = -1;
113 E_API int E_EVENT_CLIENT_FOCUS_SKIP_UNSET = -1;
115 static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client
117 #ifdef REFACTOR_FOCUS_POLICY
119 static E_Client *focused = NULL;
121 static E_Client *ecmove = NULL;
122 static E_Client *ecresize = NULL;
123 static E_Client *action_client = NULL;
125 #ifdef REFACTOR_FOCUS_POLICY
127 static Eina_List *focus_stack = NULL;
128 static Eina_List *defer_focus_stack = NULL;
131 static Eina_Bool comp_grabbed = EINA_FALSE;
133 static Eina_List *handlers = NULL;
134 static Eina_List *hooks = NULL;
136 static Ecore_Event_Handler *action_handler_mouse = NULL;
137 static Ecore_Timer *action_timer = NULL;
138 static Eina_Rectangle action_orig = {0, 0, 0, 0};
140 static E_Client_Resize_Object_Create_Cb _e_client_resize_object_create_cb = NULL;
142 #ifdef REFACTOR_FOCUS_POLICY
144 static GMutex focused_ec_mutex;
147 EINTERN void e_client_focused_set(E_Client *ec);
148 static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list);
149 static Evas_Object *_e_client_resize_object_create(E_Client *ec);
150 static void _e_client_resize_object_del(E_Client *ec);
151 static void _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y);
152 static void _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y);
154 static Eina_Inlist *_e_client_hooks[] =
156 [E_CLIENT_HOOK_EVAL_PRE_FETCH] = NULL,
157 [E_CLIENT_HOOK_EVAL_FETCH] = NULL,
158 [E_CLIENT_HOOK_EVAL_PRE_POST_FETCH] = NULL,
159 [E_CLIENT_HOOK_EVAL_POST_FETCH] = NULL,
160 [E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN] = NULL,
161 [E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN] = NULL,
162 [E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT] = NULL,
163 [E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT] = NULL,
164 [E_CLIENT_HOOK_EVAL_END] = NULL,
165 [E_CLIENT_HOOK_FOCUS_SET] = NULL,
166 [E_CLIENT_HOOK_FOCUS_UNSET] = NULL,
167 [E_CLIENT_HOOK_NEW_CLIENT] = NULL,
168 //#ifdef REFACTOR_ZONE_DESK
170 [E_CLIENT_HOOK_DESK_SET] = NULL,
172 [E_CLIENT_HOOK_MOVE_BEGIN] = NULL,
173 [E_CLIENT_HOOK_MOVE_UPDATE] = NULL,
174 [E_CLIENT_HOOK_MOVE_END] = NULL,
175 [E_CLIENT_HOOK_RESIZE_BEGIN] = NULL,
176 [E_CLIENT_HOOK_RESIZE_UPDATE] = NULL,
177 [E_CLIENT_HOOK_RESIZE_END] = NULL,
178 [E_CLIENT_HOOK_FULLSCREEN_PRE] = NULL,
179 [E_CLIENT_HOOK_DEL] = NULL,
180 [E_CLIENT_HOOK_UNREDIRECT] = NULL,
181 [E_CLIENT_HOOK_REDIRECT] = NULL,
182 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
183 [E_CLIENT_HOOK_NEW_CLIENT_POST] = NULL,
185 [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL,
186 [E_CLIENT_HOOK_ICONIFY] = NULL,
187 [E_CLIENT_HOOK_UNICONIFY] = NULL,
188 [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL,
189 [E_CLIENT_HOOK_WINDOW_ROLE_CHANGE] = NULL,
190 [E_CLIENT_HOOK_TRANSFORM_CHANGE] = NULL,
191 [E_CLIENT_HOOK_ACTIVATE_DONE] = NULL,
192 [E_CLIENT_HOOK_EVAL_VISIBILITY_END] = NULL,
195 static Eina_Inlist *_e_client_intercept_hooks[] =
197 [E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT] = NULL,
198 [E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT] = NULL,
201 ///////////////////////////////////////////
204 _e_client_hooks_clean(void)
210 for (x = 0; x < E_CLIENT_HOOK_LAST; x++)
211 EINA_INLIST_FOREACH_SAFE(_e_client_hooks[x], l, ch)
213 if (!ch->delete_me) continue;
214 _e_client_hooks[x] = eina_inlist_remove(_e_client_hooks[x], EINA_INLIST_GET(ch));
220 _e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
224 e_object_ref(E_OBJECT(ec));
225 _e_client_hooks_walking++;
226 EINA_INLIST_FOREACH(_e_client_hooks[hookpoint], ch)
228 if (ch->delete_me) continue;
229 ch->func(ch->data, ec);
230 if ((hookpoint != E_CLIENT_HOOK_DEL) &&
231 (hookpoint != E_CLIENT_HOOK_MOVE_END) &&
232 (hookpoint != E_CLIENT_HOOK_RESIZE_END) &&
233 (hookpoint != E_CLIENT_HOOK_FOCUS_UNSET) &&
234 e_object_is_del(E_OBJECT(ec)))
237 _e_client_hooks_walking--;
238 if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
239 _e_client_hooks_clean();
240 return !!e_object_unref(E_OBJECT(ec));
243 ///////////////////////////////////////////
246 _e_client_intercept_hooks_clean(void)
249 E_Client_Intercept_Hook *ch;
252 for (x = 0; x < E_CLIENT_INTERCEPT_HOOK_LAST; x++)
253 EINA_INLIST_FOREACH_SAFE(_e_client_intercept_hooks[x], l, ch)
255 if (!ch->delete_me) continue;
256 _e_client_intercept_hooks[x] =
257 eina_inlist_remove(_e_client_intercept_hooks[x], EINA_INLIST_GET(ch));
263 _e_client_intercept_hook_call(E_Client_Intercept_Hook_Point hookpoint, E_Client *ec)
265 E_Client_Intercept_Hook *ch;
266 Eina_Bool ret = EINA_TRUE;
268 if (e_object_is_del(E_OBJECT(ec)))
270 if (hookpoint != E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT)
276 e_object_ref(E_OBJECT(ec));
277 _e_client_intercept_hooks_walking++;
278 EINA_INLIST_FOREACH(_e_client_intercept_hooks[hookpoint], ch)
280 if (ch->delete_me) continue;
281 if (!(ch->func(ch->data, ec)))
287 _e_client_intercept_hooks_walking--;
288 if ((_e_client_intercept_hooks_walking == 0) &&
289 (_e_client_intercept_hooks_delete > 0))
290 _e_client_intercept_hooks_clean();
292 e_object_unref(E_OBJECT(ec));
297 _e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
300 e_object_unref(E_OBJECT(ev->ec));
305 _e_client_event_simple(E_Client *ec, int type)
309 ev = E_NEW(E_Event_Client, 1);
313 e_object_ref(E_OBJECT(ec));
314 ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
318 _e_client_event_add(E_Client *ec)
323 ec->reg_ev.add = EINA_TRUE;
324 ELOGF("COMP", "SEND E_EVENT_CLIENT_ADD event", ec);
325 _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
329 _e_client_event_remove(E_Client *ec)
334 ec->reg_ev.add = EINA_FALSE;
335 ELOGF("COMP", "SEND E_EVENT_CLIENT_REMOVE event", ec);
336 _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
340 _e_client_event_show(E_Client *ec)
345 ec->reg_ev.show = EINA_TRUE;
346 _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
350 _e_client_event_hide(E_Client *ec)
352 if (!ec->reg_ev.show)
355 ec->reg_ev.show = EINA_FALSE;
356 _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
360 _e_client_event_property(E_Client *ec, int prop)
362 E_Event_Client_Property *ev;
364 ev = E_NEW(E_Event_Client_Property, 1);
369 e_object_ref(E_OBJECT(ec));
370 ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
373 #ifdef REFACTOR_ZONE_DESK
376 _e_client_event_desk_set_free(void *d EINA_UNUSED, E_Event_Client_Desk_Set *ev)
379 e_object_unref(E_OBJECT(ev->ec));
380 e_object_unref(E_OBJECT(ev->desk));
385 _e_client_event_zone_set_free(void *d EINA_UNUSED, E_Event_Client_Zone_Set *ev)
388 e_object_unref(E_OBJECT(ev->ec));
389 e_object_unref(E_OBJECT(ev->zone));
393 ////////////////////////////////////////////////
396 _e_client_action_input_win_del(void)
398 if (!comp_grabbed) return 0;
400 e_comp_ungrab_input(1, 1);
406 _e_client_action_finish(void)
409 _e_client_action_input_win_del();
411 E_FREE_FUNC(action_timer, ecore_timer_del);
412 E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
415 action_client->keyboard_resizing = 0;
417 action_client = NULL;
421 _e_client_transform_point_transform(int cx, int cy, double angle, int x, int y, int *tx, int *ty)
423 double s = sin(angle * M_PI / 180);
424 double c = cos(angle * M_PI / 180);
431 ry = - x * s + y * c;
441 _e_client_transform_geometry_save(E_Client *ec, E_Map *map)
447 for (i = 0; i < 4; i ++)
449 e_map_point_precise_coord_get(map, i,
450 &ec->transform.saved[i].x,
451 &ec->transform.saved[i].y,
452 &ec->transform.saved[i].z);
457 _e_client_transform_resize(E_Client *ec)
461 double dx = 0, dy = 0;
466 if (!ec->transformed) return;
468 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
474 cx = ec->client.x + pw / 2;
475 cy = ec->client.y + ph / 2;
477 /* step 1: Rotate resized object and get map points */
478 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
479 e_map_util_points_populate_from_geometry(map,
480 ec->client.x, ec->client.y,
483 e_map_util_rotate(map, ec->transform.angle, cx, cy);
484 e_map_util_zoom(map, ec->transform.zoom, ec->transform.zoom, cx, cy);
486 for (i = 0; i < 4; i++)
487 e_map_point_precise_coord_get(map, i, &px[i], &py[i], NULL);
491 /* step 2: get adjusted values to keep up fixed position according
493 switch (ec->resize_mode)
495 case E_POINTER_RESIZE_R:
496 case E_POINTER_RESIZE_BR:
497 dx = ec->transform.saved[0].x - px[0];
498 dy = ec->transform.saved[0].y - py[0];
500 case E_POINTER_RESIZE_BL:
501 case E_POINTER_RESIZE_B:
502 dx = ec->transform.saved[1].x - px[1];
503 dy = ec->transform.saved[1].y - py[1];
505 case E_POINTER_RESIZE_TL:
506 case E_POINTER_RESIZE_L:
507 dx = ec->transform.saved[2].x - px[2];
508 dy = ec->transform.saved[2].y - py[2];
510 case E_POINTER_RESIZE_T:
511 case E_POINTER_RESIZE_TR:
512 dx = ec->transform.saved[3].x - px[3];
513 dy = ec->transform.saved[3].y - py[3];
519 ec->transform.adjusted.x = dx;
520 ec->transform.adjusted.y = dy;
522 /* step 3: set each points of the quadrangle */
523 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
524 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
526 for (i = 0; i < 4; i++)
527 e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0);
529 e_client_map_set(ec, map);
530 e_client_map_enable_set(ec, EINA_TRUE);
535 _e_client_transform_resize_handle(E_Client *ec)
538 int new_x, new_y, new_w, new_h;
542 Evas_Point current, moveinfo;
545 if (e_object_is_del(E_OBJECT(ec))) return;
546 if (e_client_util_ignored_get(ec)) return;
547 if (!ec->transformed) return;
549 zone = e_comp_zone_find_by_ec(ec);
552 button_id = ec->moveinfo.down.button;
554 org_w = ec->mouse.last_down[button_id - 1].w;
555 org_h = ec->mouse.last_down[button_id - 1].h;
557 new_w = ec->client.w;
558 new_h = ec->client.h;
559 new_x = ec->client.x;
560 new_y = ec->client.y;
562 /* step 1: get center coordinate its' based on original object geometry*/
563 cx = ec->client.x + org_w / 2;
564 cy = ec->client.y + org_h / 2;
566 /* step 2: transform coordinates of mouse position
567 * subtract adjusted value from mouse position is needed */
568 current.x = ec->mouse.current.mx - ec->transform.adjusted.x;
569 current.y = ec->mouse.current.my - ec->transform.adjusted.y;
570 moveinfo.x = ec->moveinfo.down.mx - ec->transform.adjusted.x;
571 moveinfo.y = ec->moveinfo.down.my - ec->transform.adjusted.y;
573 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
574 current.x, current.y,
575 ¤t.x, ¤t.y);
576 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
577 moveinfo.x, moveinfo.y,
578 &moveinfo.x, &moveinfo.y);
580 /* step 3: calculate new size */
581 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
582 (ec->resize_mode == E_POINTER_RESIZE_R) ||
583 (ec->resize_mode == E_POINTER_RESIZE_BR))
585 if ((button_id >= 1) && (button_id <= 3))
586 new_w = org_w + (current.x - moveinfo.x);
588 new_w = ec->moveinfo.down.w + (current.x - moveinfo.x);
590 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
591 (ec->resize_mode == E_POINTER_RESIZE_L) ||
592 (ec->resize_mode == E_POINTER_RESIZE_BL))
594 if ((button_id >= 1) && (button_id <= 3))
595 new_w = org_w - (current.x - moveinfo.x);
597 new_w = ec->moveinfo.down.w - (current.x - moveinfo.x);
600 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
601 (ec->resize_mode == E_POINTER_RESIZE_T) ||
602 (ec->resize_mode == E_POINTER_RESIZE_TR))
604 if ((button_id >= 1) && (button_id <= 3))
605 new_h = org_h - (current.y - moveinfo.y);
607 new_h = ec->moveinfo.down.h - (current.y - moveinfo.y);
609 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
610 (ec->resize_mode == E_POINTER_RESIZE_B) ||
611 (ec->resize_mode == E_POINTER_RESIZE_BR))
613 if ((button_id >= 1) && (button_id <= 3))
614 new_h = org_h + (current.y - moveinfo.y);
616 new_h = ec->moveinfo.down.h + (current.y - moveinfo.y);
619 new_w = MIN(new_w, zone->w);
620 new_h = MIN(new_h, zone->h);
622 /* step 4: move to new position */
623 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
624 (ec->resize_mode == E_POINTER_RESIZE_L) ||
625 (ec->resize_mode == E_POINTER_RESIZE_BL))
626 new_x += (new_w - org_w);
627 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
628 (ec->resize_mode == E_POINTER_RESIZE_T) ||
629 (ec->resize_mode == E_POINTER_RESIZE_TR))
630 new_y += (new_h - org_h);
632 /* step 5: set geometry to new value */
633 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
637 _e_client_transform_resize_begin(E_Client *ec)
640 if (!ec->transformed) return;
642 map = e_client_map_get(ec);
643 _e_client_transform_geometry_save(ec, map);
648 _e_client_transform_resize_end(E_Client *ec)
651 int new_x = 0, new_y = 0;
654 if (!ec->transformed) return;
656 map = e_client_map_get(ec);
659 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
665 cx = ec->client.x + pw / 2 + ec->transform.adjusted.x;
666 cy = ec->client.y + ph / 2 + ec->transform.adjusted.y;
668 if (ec->transform.zoom != 1.0)
672 tmp_map = e_map_dup(map);
673 e_map_util_zoom(tmp_map,
674 1 / ec->transform.zoom,
675 1 / ec->transform.zoom,
678 _e_client_transform_geometry_save(ec, tmp_map);
683 _e_client_transform_geometry_save(ec, map);
686 /* move original object to adjusted position after resizing */
687 _e_client_transform_point_transform(cx, cy,
689 ec->transform.saved[0].x,
690 ec->transform.saved[0].y,
692 e_client_util_move_without_frame(ec, new_x, new_y);
693 e_map_util_object_move_sync_set(map, EINA_TRUE);
698 _e_client_transform_move_end(E_Client *ec)
702 double dx, dy, px, py;
705 if (!ec->transformed) return;
707 map = e_client_map_get(ec);
710 if (ec->transform.zoom != 1.0)
712 e_map_point_precise_coord_get(map, 0, &px, &py, NULL);
714 dx = px - ec->transform.saved[0].x;
715 dy = py - ec->transform.saved[0].y;
717 for (i = 0; i < 4; i++)
719 ec->transform.saved[i].x += dx;
720 ec->transform.saved[i].y += dy;
724 _e_client_transform_geometry_save(ec, map);
729 e_client_intercept_hook_focus_revert_call(E_Client *ec)
731 // no need to call the intercept hook if ec is NULL.
732 if (!ec) return EINA_FALSE;
734 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
736 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT Intercepted.", ec);
744 e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
746 E_Client *above = NULL;
748 int x = 0, y = 0, w = 0, h = 0;
749 int ax = 0, ay = 0, aw = 0, ah = 0;
751 if (!ec) return NULL;
753 e_client_geometry_get(ec, &x, &y, &w, &h);
755 zone = e_comp_zone_find_by_ec(ec);
757 E_RECTS_CLIP_TO_RECT(x, y, w, h, zone->x, zone->y, zone->w, zone->h);
759 above = e_client_above_get(ec);
763 (above->layer <= ec->layer))
765 above = e_client_above_get(above);
769 if ((!e_object_is_del(E_OBJECT(above))) &&
770 (!e_client_util_ignored_get(above)) &&
772 (!above->iconic || e_policy_visibility_client_is_uniconic(above)) &&
773 (!above->bg_state) &&
775 (!above->visibility.force_obscured) &&
778 e_client_geometry_get(above, &ax, &ay, &aw, &ah);
779 if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h))
782 above = e_client_above_get(above);
789 e_client_check_obscured_by_children_group(E_Client *ec)
791 E_Client *cec = NULL;
792 Eina_List *transients = NULL, *l = NULL;
794 _e_client_transient_for_group_make(ec, &transients);
795 if (!transients) return NULL;
797 EINA_LIST_FOREACH(transients, l, cec)
799 if (E_CONTAINS(cec->x, cec->y, cec->w, cec->h, ec->x, ec->y, ec->w, ec->h))
801 if (!cec->argb) break;
802 if (cec->visibility.opaque > 0) break;
806 eina_list_free(transients);
812 e_client_check_really_iconified(E_Client *ec)
814 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
816 if (!ec->iconic) return EINA_FALSE;
818 return ((!e_policy_visibility_client_is_uniconic(ec) &&
819 !e_policy_visibility_client_is_uniconify_render_running(ec)) ||
820 (e_client_is_iconified_by_client(ec)));
823 #ifdef REFACTOR_FOCUS_POLICY
826 _e_client_focus_can_take_by_vis_obscured(E_Client *ec)
828 switch (ec->visibility.obscured)
830 case E_VISIBILITY_UNKNOWN:
831 if (e_client_check_really_iconified(ec))
834 if (!evas_object_visible_get(ec->frame) &&
835 !eina_list_data_find(defer_focus_stack, ec))
839 case E_VISIBILITY_FULLY_OBSCURED:
840 if (e_client_check_really_iconified(ec))
843 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
845 if (!evas_object_visible_get(ec->frame))
847 ELOGF("FOCUS", "client is hidden, skip focus", ec);
853 case E_VISIBILITY_UNOBSCURED:
854 case E_VISIBILITY_PARTIALLY_OBSCURED:
855 case E_VISIBILITY_PRE_UNOBSCURED:
863 _e_client_focus_can_take(E_Client *ec)
866 E_Client *child_ec = NULL;
867 E_Client *above_ec = NULL;
868 int x = 0, y = 0, w = 0, h = 0;
870 if (!ec) return EINA_FALSE;
871 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
872 if (e_client_util_ignored_get(ec)) return EINA_FALSE;
874 if (!(ec->icccm.accepts_focus || ec->icccm.take_focus)) return EINA_FALSE;
875 if (ec->lock_focus_in || ec->lock_focus_out) return EINA_FALSE;
877 if (!ec->visible) return EINA_FALSE;
878 if (ec->bg_state) return EINA_FALSE;
879 if (ec->visibility.force_obscured) return EINA_FALSE;
880 if (!_e_client_focus_can_take_by_vis_obscured(ec)) return EINA_FALSE;
882 zone = e_comp_zone_find_by_ec(ec);
885 e_client_geometry_get(ec, &x, &y, &w, &h);
886 if (!E_INTERSECTS(zone->x, zone->y, zone->w, zone->h, x, y, w, h))
890 above_ec = e_client_check_fully_contain_by_above(ec, EINA_FALSE);
893 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
895 if (!evas_object_visible_get(above_ec->frame))
899 child_ec = e_client_check_obscured_by_children_group(ec);
900 if (!child_ec) return EINA_FALSE;
901 if (above_ec != child_ec) return EINA_FALSE;
903 if (_e_client_focus_can_take(child_ec))
905 else if (e_client_check_fully_contain_by_above(child_ec, EINA_FALSE))
913 e_client_focus_can_take(E_Client *ec)
915 return _e_client_focus_can_take(ec);
919 _e_client_focus_topmost_focusable_get(void)
923 E_CLIENT_REVERSE_FOREACH(ec)
925 if (_e_client_focus_can_take(ec))
932 _e_client_find_next_focus(E_Client *ec)
935 E_Client *temp_ec = NULL;
937 // call the intercept hook of the revert focus
938 if (e_client_intercept_hook_focus_revert_call(ec))
941 EINA_LIST_FOREACH(focus_stack, l, temp_ec)
943 if (_e_client_focus_can_take(temp_ec))
951 _e_client_revert_focus_get(E_Client *ec)
953 E_Client *pec = NULL, *focus_ec = NULL;
957 if (stopping) return NULL;
959 return _e_client_find_next_focus(NULL);
961 zone = e_comp_zone_find_by_ec(ec);
962 if (!zone) return NULL;
963 desk = e_desk_current_get(zone);
964 if (!desk) return NULL;
965 if (!e_comp_client_zone_is_displaying(ec)) return NULL;
967 if (e_config->focus_policy == E_FOCUS_MOUSE)
969 // set mouse over focus
970 pec = e_client_under_pointer_get(desk, ec);
973 /* no autoraise/revert here because it's probably annoying */
976 focus_ec = _e_client_find_next_focus(ec);
983 _e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client)
985 E_Event_Client_Focus_Skip_Set *ev;
987 ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1);
991 ev->by_client = by_client;
992 e_object_ref(E_OBJECT(ec));
994 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
998 _e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client)
1000 E_Event_Client_Focus_Skip_Unset *ev;
1002 ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1);
1006 ev->by_client = by_client;
1007 e_object_ref(E_OBJECT(ec));
1009 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
1013 e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client)
1019 if (ec->icccm.accepts_focus)
1021 ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client);
1022 ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
1023 ec->changes.accepts_focus = 1;
1026 _e_client_event_focus_skip_set(ec, by_client);
1031 if (!ec->icccm.accepts_focus)
1033 ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client);
1034 ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
1035 ec->changes.accepts_focus = 1;
1038 _e_client_event_focus_skip_unset(ec, by_client);
1043 #ifdef REFACTOR_FOCUS_POLICY
1046 e_client_revert_focus(E_Client *ec)
1048 E_Client *focus_ec = NULL;
1050 // check topmost focus policy
1051 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
1053 focus_ec = _e_client_focus_topmost_focusable_get();
1054 if (focused == focus_ec) return;
1058 if (!focus_ec->iconic || focus_ec->exp_iconify.buffer_flush)
1060 ELOGF("FOCUS", "focus set | topmost_focus", focus_ec);
1061 if (focused) e_client_frame_focus_set(focused, EINA_FALSE);
1062 e_client_frame_focus_set(focus_ec, EINA_TRUE);
1067 ELOGF("FOCUS", "focus unset | No focusable ec", focused);
1068 e_client_frame_focus_set(focused, EINA_FALSE);
1074 focus_ec = _e_client_revert_focus_get(ec);
1075 if (!focus_ec) return;
1079 e_client_focus_defer_unset(ec);
1080 ELOGF("FOCUS", "focus unset | revert_focus", ec);
1081 e_client_frame_focus_set(ec, EINA_FALSE);
1084 if (!focus_ec->iconic || focus_ec->exp_iconify.buffer_flush)
1086 ELOGF("FOCUS", "focus set | revert_focus", focus_ec);
1087 e_client_frame_focus_set(focus_ec, EINA_TRUE);
1093 e_client_check_above_focused(E_Client *ec)
1095 E_Client *focus = NULL;
1096 E_Client *above = NULL;
1098 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
1100 focus = e_client_focused_get();
1101 if (!focus) return EINA_FALSE;
1103 above = e_client_above_get(ec);
1109 above = e_client_above_get(above);
1116 _e_client_private_init(E_Client *ec)
1118 E_Client_Private *priv;
1120 priv = E_NEW(E_Client_Private, 1);
1124 wl_signal_init(&priv->events.eval_pre_fetch);
1125 wl_signal_init(&priv->events.eval_fetch);
1126 wl_signal_init(&priv->events.eval_pre_post_fetch);
1127 wl_signal_init(&priv->events.eval_post_fetch);
1128 wl_signal_init(&priv->events.eval_pre_frame_assign);
1129 wl_signal_init(&priv->events.eval_post_frame_assign);
1130 wl_signal_init(&priv->events.eval_pre_new_client);
1131 wl_signal_init(&priv->events.eval_post_new_client);
1132 wl_signal_init(&priv->events.eval_visibility);
1133 wl_signal_init(&priv->events.eval_visibility_end);
1134 wl_signal_init(&priv->events.eval_end);
1135 wl_signal_init(&priv->events.move_begin);
1136 wl_signal_init(&priv->events.move_update);
1137 wl_signal_init(&priv->events.move_end);
1138 wl_signal_init(&priv->events.move_resize_begin);
1139 wl_signal_init(&priv->events.move_resize_update);
1140 wl_signal_init(&priv->events.move_resize_end);
1141 wl_signal_init(&priv->events.destroy);
1142 wl_signal_init(&priv->events.new_client);
1143 wl_signal_init(&priv->events.new_client_post);
1144 wl_signal_init(&priv->events.unredirect);
1145 wl_signal_init(&priv->events.redirect);
1146 wl_signal_init(&priv->events.aux_hint_change);
1147 wl_signal_init(&priv->events.window_role_change);
1148 wl_signal_init(&priv->events.transform_change);
1149 wl_signal_init(&priv->events.activate_done);
1150 wl_signal_init(&priv->events.mouse_in);
1151 wl_signal_init(&priv->events.mouse_out);
1152 wl_signal_init(&priv->events.mouse_down);
1153 wl_signal_init(&priv->events.focus_set);
1154 wl_signal_init(&priv->events.focus_unset);
1155 wl_signal_init(&priv->events.focus_defer_set);
1156 wl_signal_init(&priv->events.focus_latest_set);
1157 wl_signal_init(&priv->events.iconify);
1158 wl_signal_init(&priv->events.uniconify);
1159 wl_signal_init(&priv->events.maximize);
1160 wl_signal_init(&priv->events.unmaximize);
1161 wl_signal_init(&priv->events.fullscreen_pre);
1162 wl_signal_init(&priv->events.fullscreen);
1163 wl_signal_init(&priv->events.unfullscreen);
1164 wl_signal_init(&priv->events.move);
1165 wl_signal_init(&priv->events.layer_set);
1166 wl_signal_init(&priv->events.raise);
1167 wl_signal_init(&priv->events.lower);
1168 wl_signal_init(&priv->events.stack_below);
1169 wl_signal_init(&priv->events.stack_above);
1170 wl_signal_init(&priv->events.stack_transient_for_done);
1171 wl_signal_init(&priv->events.stick);
1172 wl_signal_init(&priv->events.unstick);
1174 e_object_data_set(E_OBJECT(ec), priv);
1180 _e_client_private_finish(E_Client *ec)
1182 E_Client_Private *priv;
1185 e_object_data_set(E_OBJECT(ec), NULL);
1191 _e_client_free(E_Client *ec)
1193 e_comp_object_redirected_set(ec->frame, 0);
1194 e_comp_object_render_update_del(ec->frame);
1196 E_OBJECT(ec)->references++;
1197 #ifdef REFACTOR_ZONE_DESK
1201 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
1202 if (!ec->desk->fullscreen_clients)
1203 e_comp_render_queue();
1207 e_comp->new_clients--;
1209 if (ec->e.state.video_parent && ec->e.state.video_parent_client)
1211 ec->e.state.video_parent_client->e.state.video_child =
1212 eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
1214 if (ec->e.state.video_child)
1218 EINA_LIST_FREE(ec->e.state.video_child, tmp)
1219 tmp->e.state.video_parent_client = NULL;
1221 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1222 E_FREE_LIST(ec->pending_resize, free);
1224 E_FREE_FUNC(ec->map_timer, ecore_timer_del);
1226 ec->transients = eina_list_free(ec->transients);
1227 if (ec->netwm.icons)
1230 for (i = 0; i < ec->netwm.num_icons; i++)
1231 free(ec->netwm.icons[i].data);
1232 E_FREE(ec->netwm.icons);
1234 E_FREE(ec->netwm.extra_types);
1235 eina_stringshare_replace(&ec->border.name, NULL);
1236 eina_stringshare_replace(&ec->bordername, NULL);
1237 eina_stringshare_replace(&ec->icccm.name, NULL);
1238 #if defined(__cplusplus) || defined(c_plusplus)
1239 eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
1241 eina_stringshare_replace(&ec->icccm.class, NULL);
1243 eina_stringshare_replace(&ec->icccm.title, NULL);
1244 eina_stringshare_replace(&ec->icccm.icon_name, NULL);
1245 eina_stringshare_replace(&ec->icccm.machine, NULL);
1246 eina_stringshare_replace(&ec->icccm.window_role, NULL);
1247 if ((ec->icccm.command.argc > 0) && (ec->icccm.command.argv))
1251 for (i = 0; i < ec->icccm.command.argc; i++)
1252 free(ec->icccm.command.argv[i]);
1253 E_FREE(ec->icccm.command.argv);
1255 eina_stringshare_replace(&ec->netwm.name, NULL);
1256 eina_stringshare_replace(&ec->netwm.icon_name, NULL);
1257 eina_stringshare_replace(&ec->internal_icon, NULL);
1258 eina_stringshare_replace(&ec->internal_icon_key, NULL);
1260 #ifdef REFACTOR_FOCUS_POLICY
1261 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1263 focus_stack = eina_list_remove(focus_stack, ec);
1264 e_client_focus_defer_unset(ec);
1267 E_FREE_FUNC(ec->frame, evas_object_del);
1269 #ifdef REFACTOR_FOCUS_POLICY
1270 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_topmost.c and e_focus_policy_history.c
1274 ELOGF("COMP", "CRITICAL. focused is deleted ec.", ec);
1275 ELOGF("FOCUS", "CLIENT FOCUS_SET", NULL);
1276 g_mutex_lock(&focused_ec_mutex);
1278 g_mutex_unlock(&focused_ec_mutex);
1282 E_OBJECT(ec)->references--;
1283 ELOGF("COMP", "CLIENT FREE", ec);
1285 e_uuid_store_entry_del(ec->uuid);
1286 #ifdef REFACTOR_ZONE_DESK
1288 e_desk_client_del(ec->desk, ec);
1291 _e_client_private_finish(ec);
1296 _e_client_del(E_Client *ec)
1303 #ifdef REFACTOR_FOCUS_POLICY
1304 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1306 focus_stack = eina_list_remove(focus_stack, ec);
1307 e_client_focus_defer_unset(ec);
1309 #ifdef REFACTOR_ZONE_DESK
1311 e_desk_visible_client_iconified_list_remove(ec->desk, ec);
1313 if (ec == e_comp_object_dim_client_get())
1315 INF("[DIM] client deleted\n");
1316 e_comp_object_dim_client_set(NULL);
1319 if (ec->cur_mouse_action)
1321 if (ec->cur_mouse_action->func.end)
1322 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1324 if (action_client == ec) _e_client_action_finish();
1328 e_client_comp_hidden_set(ec, 1);
1329 evas_object_pass_events_set(ec->frame, 1);
1331 #ifdef REFACTOR_FOCUS_POLICY
1332 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1335 e_client_revert_focus(ec);
1338 E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
1340 wl_signal_emit_mutable(&PRI(ec)->events.destroy, NULL);
1342 /* must be called before parent/child clear */
1343 _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
1345 _e_client_event_remove(ec);
1347 ELOGF("COMP", "CLIENT DEL", ec);
1351 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
1354 EINA_LIST_FREE(ec->transients, child)
1355 child->parent = NULL;
1357 type = e_pixmap_type_get(ec->pixmap);
1358 if (type < E_PIXMAP_TYPE_MAX)
1359 eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
1360 e_comp->clients = eina_list_remove(e_comp->clients, ec);
1361 e_comp_object_render_update_del(ec->frame);
1362 e_comp_post_update_purge(ec);
1363 if (e_pixmap_free(ec->pixmap))
1364 e_pixmap_client_set(ec->pixmap, NULL);
1367 // base_output_resolution
1368 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
1369 e_util_transform_del(ec->base_output_resolution.transform);
1370 ec->base_output_resolution.transform = NULL;
1371 E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
1373 #ifdef REFACTOR_ZONE_DESK
1376 e_client_transform_core_remove(ec, ec->desk_zoom.transform);
1377 e_util_transform_del(ec->desk_zoom.transform);
1378 ec->desk_zoom.transform = NULL;
1379 E_FREE_FUNC(ec->desk_zoom.hook_subsurf_create, e_comp_wl_hook_del);
1382 if (ec->transform_core.transform_list)
1384 E_Util_Transform *transform;
1386 EINA_LIST_FREE(ec->transform_core.transform_list, transform)
1388 e_util_transform_unref(transform);
1392 ec->transform_core.result.enable = EINA_FALSE;
1394 #ifdef REFACTOR_ZONE_DESK
1396 e_client_desk_area_set(ec, NULL);
1397 e_util_transform_del(ec->desk_area.transform);
1398 ec->desk_area.transform = NULL;
1401 _e_client_resize_object_del(ec);
1403 e_comp_visibility_calculation_set(EINA_TRUE);
1406 ///////////////////////////////////////////
1409 _e_client_cb_kill_timer(void *data)
1411 E_Client *ec = data;
1413 // dont wait until it's hung -
1416 if (ec->netwm.pid > 1)
1417 kill(ec->netwm.pid, SIGKILL);
1419 ec->kill_timer = NULL;
1420 return ECORE_CALLBACK_CANCEL;
1424 _e_client_cb_ping_poller(void *data)
1429 if (e_object_is_del(E_OBJECT(ec)))
1431 ec->ping_poller = NULL;
1432 return ECORE_CALLBACK_CANCEL;
1440 evas_object_smart_callback_call(ec->frame, "unhung", NULL);
1441 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1446 /* if time between last ping and now is greater
1447 * than half the ping interval... */
1448 if ((ecore_loop_time_get() - ec->ping) >
1449 ((e_config->ping_clients_interval *
1450 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
1455 evas_object_smart_callback_call(ec->frame, "hung", NULL);
1456 /* FIXME: if below dialog is up - hide it now */
1458 if (ec->delete_requested)
1460 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
1461 e_client_act_kill_begin(ec);
1465 ec->ping_poller = NULL;
1467 return ECORE_CALLBACK_CANCEL;
1470 ///////////////////////////////////////////
1473 _e_client_action_input_win_new(void)
1477 CRI("DOUBLE COMP GRAB! ACK!!!!");
1480 comp_grabbed = e_comp_grab_input(1, 1);
1481 if (!comp_grabbed) _e_client_action_input_win_del();
1482 return comp_grabbed;
1486 _e_client_action_init(E_Client *ec)
1488 action_orig.x = ec->x;
1489 action_orig.y = ec->y;
1490 action_orig.w = ec->w;
1491 action_orig.h = ec->h;
1495 action_client->keyboard_resizing = 0;
1501 _e_client_move_begin(E_Client *ec)
1503 if ((ec->fullscreen) || (ec->lock_user_location))
1506 if (!_e_client_action_input_win_new()) return 0;
1510 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
1511 _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
1514 if (ecmove == ec) ecmove = NULL;
1515 _e_client_action_input_win_del();
1518 if (!ec->lock_user_stacking)
1520 if (e_config->border_raise_on_mouse_action)
1525 e_comp_client_override_add(ec);
1531 _e_client_move_end(E_Client *ec)
1534 _e_client_action_input_win_del();
1536 wl_signal_emit_mutable(&PRI(ec)->events.move_end, NULL);
1537 _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
1539 if (ec->transformed)
1540 _e_client_transform_move_end(ec);
1543 e_comp_client_override_del(ec);
1550 _e_client_action_move_timeout(void *data EINA_UNUSED)
1552 _e_client_move_end(action_client);
1553 _e_client_action_finish();
1554 return ECORE_CALLBACK_CANCEL;
1558 _e_client_action_move_timeout_add(void)
1560 E_FREE_FUNC(action_timer, ecore_timer_del);
1561 if (e_config->border_keyboard.timeout)
1562 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
1566 _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1568 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1571 ERR("no action_client!");
1573 if (action_client) _e_client_move_end(action_client);
1574 _e_client_action_finish();
1575 return ECORE_CALLBACK_DONE;
1579 _e_client_moveinfo_gather(E_Client *ec, const char *source)
1581 if (e_util_glob_match(source, "mouse,*,1"))
1582 ec->moveinfo.down.button = 1;
1583 else if (e_util_glob_match(source, "mouse,*,2"))
1584 ec->moveinfo.down.button = 2;
1585 else if (e_util_glob_match(source, "mouse,*,3"))
1586 ec->moveinfo.down.button = 3;
1588 ec->moveinfo.down.button = 0;
1589 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1591 ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
1592 ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
1596 ec->moveinfo.down.mx = ec->mouse.current.mx;
1597 ec->moveinfo.down.my = ec->mouse.current.my;
1602 _e_client_move_handle(E_Client *ec)
1606 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1608 x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
1609 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1610 y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
1611 (ec->mouse.current.my - ec->moveinfo.down.my);
1615 x = ec->moveinfo.down.x +
1616 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1617 y = ec->moveinfo.down.y +
1618 (ec->mouse.current.my - ec->moveinfo.down.my);
1621 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1622 _e_client_stay_within_canvas(ec, x, y, &x, &y);
1625 _e_client_stay_within_canvas_margin(ec, x, y, &x, &y);
1627 evas_object_move(ec->frame, x, y);
1629 if (e_client_transform_core_enable_get(ec))
1631 e_client_transform_core_update(ec);
1635 static Evas_Object *
1636 _e_client_resize_object_rectangle_get(E_Client *ec)
1638 Evas_Object *resize_obj = NULL;
1640 resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame));
1641 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1643 if (e_config->resize_object.customize)
1645 evas_object_color_set(resize_obj,
1646 e_config->resize_object.r,
1647 e_config->resize_object.g,
1648 e_config->resize_object.b,
1649 e_config->resize_object.a);
1652 evas_object_color_set(resize_obj, 128, 128, 128, 100);
1657 static Evas_Object *
1658 _e_client_resize_object_image_get(E_Client *ec)
1661 Evas_Object *resize_obj = NULL;
1663 if (!e_config->resize_object.image_path)
1665 ELOGF("COMP", "NO resize_object image! Make default resize_object", ec);
1669 resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame));
1670 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1672 evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL);
1673 err = evas_object_image_load_error_get(resize_obj);
1674 if (err != EVAS_LOAD_ERROR_NONE)
1676 ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object",
1677 ec, e_config->resize_object.image_path, err);
1678 evas_object_del(resize_obj);
1683 evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h);
1684 evas_object_image_filled_set(resize_obj, EINA_TRUE);
1686 evas_object_image_border_set(resize_obj,
1687 e_config->resize_object.border_width.l,
1688 e_config->resize_object.border_width.r,
1689 e_config->resize_object.border_width.t,
1690 e_config->resize_object.border_width.b);
1695 return _e_client_resize_object_rectangle_get(ec);
1698 static Evas_Object *
1699 _e_client_resize_object_create(E_Client *ec)
1701 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL);
1703 Evas_Object *resize_obj = NULL;
1705 if (_e_client_resize_object_create_cb)
1706 resize_obj = _e_client_resize_object_create_cb(ec);
1709 if (e_config->resize_object.type == 1) // image object
1711 resize_obj = _e_client_resize_object_image_get(ec);
1715 resize_obj = _e_client_resize_object_rectangle_get(ec);
1718 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1720 evas_object_pass_events_set(resize_obj, EINA_TRUE);
1721 evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame));
1722 evas_object_stack_above(resize_obj, ec->frame);
1723 evas_object_name_set(resize_obj, "resize_object");
1729 _e_client_resize_object_del(E_Client *ec)
1731 if (ec == NULL) return;
1732 if (ec->manage_resize.resize_obj == NULL) return;
1734 evas_object_hide(ec->manage_resize.resize_obj);
1735 evas_object_del(ec->manage_resize.resize_obj);
1736 ec->manage_resize.resize_obj = NULL;
1740 _e_client_resize_handle(E_Client *ec)
1743 int new_x, new_y, new_w, new_h;
1745 int trans_x = 0, trans_y = 0;
1746 int trans_w = 0, trans_h = 0;
1748 if (ec->transformed)
1750 _e_client_transform_resize_handle(ec);
1759 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
1760 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1761 (ec->resize_mode == E_POINTER_RESIZE_BR))
1763 if ((ec->moveinfo.down.button >= 1) &&
1764 (ec->moveinfo.down.button <= 3))
1765 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
1766 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1768 w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
1770 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1771 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1772 (ec->resize_mode == E_POINTER_RESIZE_BL))
1774 if ((ec->moveinfo.down.button >= 1) &&
1775 (ec->moveinfo.down.button <= 3))
1776 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
1777 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1779 w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
1782 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1783 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1784 (ec->resize_mode == E_POINTER_RESIZE_TR))
1786 if ((ec->moveinfo.down.button >= 1) &&
1787 (ec->moveinfo.down.button <= 3))
1788 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
1789 (ec->mouse.current.my - ec->moveinfo.down.my);
1791 h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
1793 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
1794 (ec->resize_mode == E_POINTER_RESIZE_B) ||
1795 (ec->resize_mode == E_POINTER_RESIZE_BR))
1797 if ((ec->moveinfo.down.button >= 1) &&
1798 (ec->moveinfo.down.button <= 3))
1799 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
1800 (ec->mouse.current.my - ec->moveinfo.down.my);
1802 h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
1807 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1808 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1809 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1810 (ec->resize_mode == E_POINTER_RESIZE_BL))
1812 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1813 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1814 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1815 (ec->resize_mode == E_POINTER_RESIZE_TR))
1822 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1825 zone = e_comp_zone_find_by_ec(ec);
1828 w = MIN(w, zone->w);
1829 h = MIN(h, zone->h);
1832 e_client_resize_limit(ec, &new_w, &new_h);
1834 if (ec->manage_resize.enable_aspect_ratio)
1836 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1837 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1838 (ec->resize_mode == E_POINTER_RESIZE_BL) ||
1839 (ec->resize_mode == E_POINTER_RESIZE_TR) ||
1840 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1841 (ec->resize_mode == E_POINTER_RESIZE_BR))
1843 new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w;
1845 else if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1846 (ec->resize_mode == E_POINTER_RESIZE_B))
1848 new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h;
1850 new_h += ec->manage_resize.header_h;
1851 new_h += ec->manage_resize.footer_h;
1854 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1855 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1856 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1857 (ec->resize_mode == E_POINTER_RESIZE_BL))
1858 new_x += (w - new_w);
1859 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1860 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1861 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1862 (ec->resize_mode == E_POINTER_RESIZE_TR))
1863 new_y += (h - new_h);
1865 if (e_config->interactive_resize)
1867 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
1871 if (ec->manage_resize.resize_obj == NULL)
1873 ec->manage_resize.resize_obj = _e_client_resize_object_create(ec);
1874 EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj);
1877 if (e_client_transform_core_enable_get(ec))
1879 e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y);
1880 e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h);
1881 evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h);
1884 evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h);
1885 evas_object_show(ec->manage_resize.resize_obj);
1887 ec->manage_resize.x = new_x;
1888 ec->manage_resize.y = new_y;
1889 ec->manage_resize.w = new_w;
1890 ec->manage_resize.h = new_h;
1895 _e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
1897 if (ppu <= 1) return size;
1899 unsigned int remainder = size % ppu;
1900 if (remainder == 0) return size;
1902 int gap = size - start_size;
1903 int new_size = size;
1905 new_size = size + (ppu - remainder);
1907 new_size = size - remainder;
1913 _e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
1917 if (prev_pos == pos)
1920 new_pos = (prev_pos + prev_size) - size;
1926 _e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
1928 if (ec->manage_resize.unit_size <= 1) return;
1930 ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
1931 ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
1933 ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
1934 ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
1938 _e_client_resize_end(E_Client *ec)
1940 ec->resize_mode = E_POINTER_RESIZE_NONE;
1941 _e_client_action_input_win_del();
1943 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_end, NULL);
1944 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
1946 if (ec->transformed)
1947 _e_client_transform_resize_end(ec);
1950 e_comp_client_override_del(ec);
1954 if (!e_config->interactive_resize)
1956 if (ec->manage_resize.resize_obj)
1958 if (ec->manage_resize.unit_size > 1)
1959 _e_client_adjust_geometry_by_resize_ppu(ec);
1961 e_client_frame_geometry_set(ec,
1962 ec->manage_resize.x,
1963 ec->manage_resize.y,
1964 ec->manage_resize.w,
1965 ec->manage_resize.h);
1966 _e_client_resize_object_del(ec);
1974 _e_client_action_resize_timeout(void *data EINA_UNUSED)
1976 _e_client_resize_end(action_client);
1977 _e_client_action_finish();
1978 return ECORE_CALLBACK_CANCEL;
1982 _e_client_action_resize_timeout_add(void)
1984 E_FREE_FUNC(action_timer, ecore_timer_del);
1985 if (e_config->border_keyboard.timeout)
1986 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
1990 _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1992 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1995 ERR("no action_client!");
1997 if (action_client) _e_client_resize_end(action_client);
1998 _e_client_action_finish();
1999 return ECORE_CALLBACK_DONE;
2002 ////////////////////////////////////////////////
2005 _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty)
2008 Eina_Bool res = EINA_FALSE;
2009 Eina_List *list = NULL, *l;
2010 Eina_Rectangle *data;
2012 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
2014 e_client_geometry_get(ec, &x, &y, &w, &h);
2015 e_comp_object_input_rect_get(ec->frame, &list);
2018 EINA_LIST_FOREACH(list, l, data)
2020 if ((tx >= x + data->x) && (tx <= x + data->x + data->w) &&
2021 (ty >= y + data->y) && (ty <= y + data->y + data->h))
2027 list = eina_list_free(list);
2031 if ((tx >= x) && (tx <= x + w) &&
2032 (ty >= y) && (ty <= y + h))
2042 _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *client)
2044 /* If a border was specified which should be excluded from the list
2045 * (because it will be closed shortly for example), skip */
2046 if (e_client_util_ignored_get(client) || (!e_desk_has_ec(desk, client))) return EINA_TRUE;
2047 if (!evas_object_visible_get(client->frame)) return EINA_TRUE;
2048 if (e_policy_client_is_cursor(client)) return EINA_TRUE;
2054 _e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
2056 E_Client *ec = NULL, *cec;
2058 E_CLIENT_REVERSE_FOREACH(cec)
2060 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
2061 if ((exclude) && (cec == exclude)) continue;
2062 if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
2064 /* If the layer is higher, the position of the window is higher
2065 * (always on top vs always below) */
2066 if (!ec || (cec->layer > ec->layer))
2073 _e_client_input_rect_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
2075 E_Client *ec = NULL, *cec;
2078 E_CLIENT_REVERSE_FOREACH(cec)
2080 /* If a border was specified which should be excluded from the list
2081 * (because it will be closed shortly for example), skip */
2082 if (e_client_util_ignored_get(cec) || (!e_desk_has_ec(desk, cec))) continue;
2083 if (!evas_object_visible_get(cec->frame)) continue;
2084 if (e_policy_client_is_cursor(cec)) continue;
2085 if ((exclude) && (cec == exclude)) continue;
2086 e_client_geometry_get(cec, &cx, &cy, &cw, &ch);
2087 if (!E_INSIDE(x, y, cx, cy, cw, ch))
2089 /* If the layer is higher, the position of the window is higher
2090 * (always on top vs always below) */
2091 if (ec && (cec->layer <= ec->layer)) continue;
2092 if (_e_client_position_inside_input_rect(cec, x, y))
2100 _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
2102 E_Client *ec = NULL, *cec;
2104 E_CLIENT_REVERSE_FOREACH(cec)
2106 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
2108 Eina_List *list = NULL;
2109 Eina_Rectangle *rect;
2110 Eina_Bool inside = EINA_FALSE;
2111 e_comp_object_input_rect_get(cec->frame, &list);
2114 EINA_LIST_FREE(list, rect)
2116 if (E_INSIDE(x, y, rect->x, rect->y, rect->w, rect->h))
2120 else if (E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
2125 if (!inside) continue;
2126 /* If the layer is higher, the position of the window is higher
2127 * (always on top vs always below) */
2128 if (!ec || (cec->layer > ec->layer))
2135 ////////////////////////////////////////////////
2138 _e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
2141 E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
2144 zone = e_comp_zone_find_by_ec(ec);
2151 if (eina_list_count(e_comp->zones) == 1)
2160 zone_left = e_comp_zone_xy_get((x - w + 5), y);
2161 zone_right = e_comp_zone_xy_get((x + w + 5), y);
2162 zone_above = e_comp_zone_xy_get(x, (y - h + 5));
2163 zone_below = e_comp_zone_xy_get(x, (y + h + 5));
2165 if (!(zone_above) && (y))
2166 zone_above = e_comp_zone_xy_get(x, (h - 5));
2168 if (!(zone_left) && (x))
2169 zone_left = e_comp_zone_xy_get((x - 5), y);
2172 w = zone_right->x + zone_right->w;
2175 w = zone->x + zone->w;
2178 h = zone_below->y + zone_below->h;
2181 h = zone->y + zone->h;
2183 if ((zone_left) && (zone_right))
2184 w = zone->w + zone_right->x;
2186 if ((zone_above) && (zone_below))
2187 h = zone->h + zone_below->y;
2189 if (x) x -= zone->w;
2190 if (y) y -= zone->h;
2192 if (zx) *zx = x > 0 ? x : 0;
2193 if (zy) *zy = y > 0 ? y : 0;
2199 _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
2201 int new_x_max, new_y_max;
2206 zone = e_comp_zone_find_by_ec(ec);
2209 if (new_x) *new_x = x;
2210 if (new_y) *new_y = y;
2214 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
2216 new_x_max = zw - ec->w;
2217 new_y_max = zh - ec->h;
2218 lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
2219 lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
2253 _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
2255 int new_x_max, new_y_max, new_x_min, new_y_min;
2256 int margin_w, margin_h;
2261 zone = e_comp_zone_find_by_ec(ec);
2264 if (new_x) *new_x = x;
2265 if (new_y) *new_y = y;
2272 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
2277 new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
2278 new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
2279 new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
2280 new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
2284 else if (x <= new_x_min)
2289 else if (y <= new_y_min)
2294 ////////////////////////////////////////////////
2295 #ifdef REFACTOR_ZONE_DESK
2298 _e_client_zone_update(E_Client *ec)
2303 /* still within old zone - leave it there */
2304 zone = e_comp_zone_find_by_ec(ec);
2305 if (zone && E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2306 zone->x, zone->y, zone->w, zone->h))
2309 /* find a new zone */
2310 EINA_LIST_FOREACH(e_comp->zones, l, zone)
2312 if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2313 zone->x, zone->y, zone->w, zone->h))
2315 e_client_zone_set(ec, zone);
2321 ////////////////////////////////////////////////
2324 _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set)
2326 if (ec->transform_core.activate == set) return;
2328 ec->transform_core.activate = set;
2332 if (ec->transform_core.result.enable)
2333 e_client_map_enable_set(ec, EINA_TRUE);
2337 e_client_map_enable_set(ec, EINA_FALSE);
2342 _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2344 E_Client *ec = data;
2346 if (stopping) return; //ignore all of this if we're shutting down!
2347 if (e_object_is_del(data)) return; //client is about to die
2348 if (ec->cur_mouse_action)
2350 if (ec->cur_mouse_action->func.end_mouse)
2351 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
2352 else if (ec->cur_mouse_action->func.end)
2353 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
2354 E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
2356 if (action_client == ec) _e_client_action_finish();
2358 ec->want_focus = ec->take_focus = 0;
2360 _e_client_transform_core_activate_set(ec, EINA_FALSE);
2362 if (ec->new_client) return;
2363 _e_client_event_hide(ec);
2369 _e_client_cb_evas_shade_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2371 E_Client *ec = data;
2373 if (e_object_is_del(data)) return;
2376 ec->shaded = !(ec->shaded);
2377 ec->changes.shaded = 1;
2378 ec->changes.shading = 1;
2379 e_client_comp_hidden_set(ec, ec->shaded);
2383 _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2385 E_Client *ec = data;
2389 if (e_object_is_del(data)) return;
2391 ec->pre_res_change.valid = 0;
2393 _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
2395 #ifdef REFACTOR_ZONE_DESK
2397 _e_client_zone_update(ec);
2399 evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
2400 if ((e_config->transient.move) && (ec->transients))
2402 Eina_List *list = eina_list_clone(ec->transients);
2405 EINA_LIST_FREE(list, child)
2407 if (child->vkbd.vkbd) continue;
2409 evas_object_move(child->frame,
2410 child->x + x - ec->pre_cb.x,
2411 child->y + y - ec->pre_cb.y);
2414 if (ec->moving || (ecmove == ec))
2416 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2417 _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
2420 if ((!ec->moving) && (ec->transformed))
2422 map = e_client_map_get(ec);
2423 _e_client_transform_geometry_save(ec, map);
2427 ec->pre_cb.x = x; ec->pre_cb.y = y;
2429 #ifdef REFACTOR_FOCUS_POLICY
2430 // This code is executed at E_CLIENT_HOOK_MOVE callback
2431 // at e_focus_policy_topmost.c and at e_focus_policy_history.c
2433 wl_signal_emit_mutable(&PRI(ec)->events.move, NULL);
2438 zone = e_comp_zone_find_by_ec(ec);
2439 if (zone && !E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2440 zone->x, zone->y, zone->w, zone->h))
2442 e_client_revert_focus(ec);
2447 e_comp_visibility_calculation_set(EINA_TRUE);
2451 _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2453 E_Client *ec = data;
2454 Evas_Coord x, y, w, h;
2456 if (e_object_is_del(data)) return;
2458 ec->pre_res_change.valid = 0;
2460 _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
2462 #ifdef REFACTOR_ZONE_DESK
2464 _e_client_zone_update(ec);
2466 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
2467 if ((e_config->transient.resize) && (ec->transients))
2469 Eina_List *list = eina_list_clone(ec->transients);
2472 EINA_LIST_FREE(list, child)
2474 Evas_Coord nx, ny, nw, nh;
2476 if ((ec->pre_cb.w > 0) && (ec->pre_cb.h > 0))
2478 nx = x + (((child->x - x) * w) / ec->pre_cb.w);
2479 ny = y + (((child->y - y) * h) / ec->pre_cb.h);
2480 nw = (child->w * w) / ec->pre_cb.w;
2481 nh = (child->h * h) / ec->pre_cb.h;
2482 nx += ((nw - child->w) / 2);
2483 ny += ((nh - child->h) / 2);
2484 evas_object_move(child->frame, nx, ny);
2489 if (e_client_util_resizing_get(ec) || (ecresize == ec))
2491 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2492 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
2494 ec->pre_cb.w = w; ec->pre_cb.h = h;
2496 e_client_transform_core_update(ec);
2497 e_comp_visibility_calculation_set(EINA_TRUE);
2501 _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2503 E_Client *ec = data;
2505 if (e_object_is_del(data)) return;
2507 _e_client_transform_core_activate_set(ec, EINA_TRUE);
2509 _e_client_event_show(ec);
2514 _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2516 E_Client *ec = data;
2517 E_Comp_Wl_Client_Data *child_cdata = NULL;
2519 if (e_object_is_del(data)) return;
2520 if (ec->layer_block) return;
2521 if (ec->layer_pending) return;
2522 if (e_config->transient.raise && ec->transients)
2524 Eina_List *list = eina_list_clone(ec->transients);
2525 E_Client *child, *below = NULL, *above = NULL;
2526 E_Transient transient_policy;
2528 E_LIST_REVERSE_FREE(list, child)
2530 child_cdata = e_client_cdata_get(child);
2531 if (child_cdata && !child_cdata->mapped)
2533 ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child));
2537 /* Don't stack iconic transients. If the user wants these shown,
2538 * that's another option.
2540 if (child->iconic && e_client_is_iconified_by_client(child)) continue;
2542 transient_policy = e_client_transient_policy_get(child);
2543 if (transient_policy == E_TRANSIENT_ABOVE)
2546 e_client_stack_below(child, below);
2548 e_client_stack_above(child, ec);
2551 else if (transient_policy == E_TRANSIENT_BELOW)
2554 e_client_stack_below(child, above);
2556 e_client_stack_below(child, ec);
2562 if (ec->unredirected_single) return;
2563 _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
2565 e_comp_visibility_calculation_set(EINA_TRUE);
2568 ////////////////////////////////////////////////
2570 #ifdef REFACTOR_ZONE_DESK
2573 _e_client_maximize(E_Client *ec, E_Maximize max)
2575 int x1, yy1, x2, y2;
2577 int desk_x, desk_y, desk_w, desk_h;
2578 Eina_Bool override = ec->maximize_override;
2581 zx = zy = zw = zh = 0;
2582 ec->maximize_override = 1;
2584 zone = e_comp_zone_find_by_ec(ec);
2587 if (ec->desk_area.enable && ec->desk_area.desk_area)
2589 desk_x = ec->desk_area.desk_area->x;
2590 desk_y = ec->desk_area.desk_area->y;
2591 desk_w = ec->desk_area.desk_area->w;
2592 desk_h = ec->desk_area.desk_area->h;
2596 desk_x = ec->desk->geom.x;
2597 desk_y = ec->desk->geom.y;
2598 desk_w = ec->desk->geom.w;
2599 desk_h = ec->desk->geom.h;
2602 switch (max & E_MAXIMIZE_TYPE)
2604 case E_MAXIMIZE_NONE:
2608 case E_MAXIMIZE_FULLSCREEN:
2609 case E_MAXIMIZE_FILL:
2610 if (ec->base_output_resolution.use)
2614 zw = ec->base_output_resolution.w;
2615 zh = ec->base_output_resolution.h;
2619 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, EINA_FALSE);
2622 switch (max & E_MAXIMIZE_DIRECTION)
2624 case E_MAXIMIZE_BOTH:
2625 e_client_maximized_geometry_set(ec, zx, zy, zw, zh);
2628 case E_MAXIMIZE_VERTICAL:
2629 e_client_maximized_geometry_set(ec, ec->x, zy, ec->w, zh);
2632 case E_MAXIMIZE_HORIZONTAL:
2633 e_client_maximized_geometry_set(ec, zx, ec->y, zw, ec->h);
2636 case E_MAXIMIZE_LEFT:
2637 e_client_maximized_geometry_set(ec, zx, zy, zw / 2, zh);
2640 case E_MAXIMIZE_RIGHT:
2641 e_client_maximized_geometry_set(ec, zx + zw / 2, zy, zw / 2, zh);
2646 case E_MAXIMIZE_SMART:
2647 case E_MAXIMIZE_EXPAND:
2648 if (ec->desk->visible)
2650 // base_output_resolution
2651 if (ec->base_output_resolution.use)
2655 zw = ec->base_output_resolution.w;
2656 zh = ec->base_output_resolution.h;
2660 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, EINA_TRUE);
2667 x2 = desk_x + desk_w;
2668 y2 = desk_y + desk_h;
2669 e_maximize_client_shelf_fill(ec, &x1, &yy1, &x2, &y2, max);
2675 evas_object_smart_callback_call(ec->frame, "maximize", NULL);
2677 switch (max & E_MAXIMIZE_DIRECTION)
2679 case E_MAXIMIZE_BOTH:
2680 e_client_maximized_geometry_set(ec, zx, zy, zw, zh);
2683 case E_MAXIMIZE_VERTICAL:
2684 e_client_maximized_geometry_set(ec, ec->x, zy, ec->w, zh);
2687 case E_MAXIMIZE_HORIZONTAL:
2688 e_client_maximized_geometry_set(ec, zx, ec->y, zw, ec->h);
2691 case E_MAXIMIZE_LEFT:
2692 e_client_maximized_geometry_set(ec, zx, zy, zw / 2, zh);
2695 case E_MAXIMIZE_RIGHT:
2696 e_client_maximized_geometry_set(ec, zx + zw / 2, zy, zw / 2, zh);
2703 if (ec->maximize_override)
2704 ec->maximize_override = override;
2708 ////////////////////////////////////////////////
2710 _e_client_aux_hint_eval(E_Client *ec)
2714 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2716 E_Comp_Wl_Aux_Hint *hint;
2718 if (cdata && cdata->aux_hint.changed)
2720 wl_signal_emit_mutable(&PRI(ec)->events.aux_hint_change, NULL);
2721 _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
2723 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
2725 hint->changed = EINA_FALSE;
2728 ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec, hint->id, hint->hint, hint->val);
2729 if (hint->hint) eina_stringshare_del(hint->hint);
2730 if (hint->val) eina_stringshare_del(hint->val);
2731 cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
2735 cdata->aux_hint.changed = 0;
2739 #ifdef REFACTOR_ZONE_DESK
2742 _e_client_apply_auto_placement(E_Client *ec)
2744 Eina_List *skiplist = NULL;
2745 int new_x, new_y, t = 0;
2747 E_Client *parent_ec;
2750 // intercept auto placement policy
2751 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
2753 ELOGF("POL", "Intercepted auto_placement policy.", ec);
2757 int zx = 0, zy = 0, zw = 0, zh = 0;
2759 zone = e_comp_zone_find_by_ec(ec);
2762 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
2764 unsigned int seed = (unsigned int)time(NULL);
2767 new_x = zx + (rand_r(&seed) % (zw - ec->w));
2771 new_y = zy + (rand_r(&seed) % (zh - ec->h));
2775 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
2777 parent_ec = ec->parent;
2781 new_x = parent_ec->x;
2782 new_y = parent_ec->y;
2784 else if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) || (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET))
2787 skiplist = eina_list_append(skiplist, ec);
2789 e_place_desk_region_smart(ec->desk, skiplist,
2790 ec->x, ec->y, ec->w, ec->h,
2793 e_place_zone_region_smart(zone, skiplist,
2794 ec->x, ec->y, ec->w, ec->h,
2797 eina_list_free(skiplist);
2799 else if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL)
2802 e_place_zone_manual(zone, ec->w, t, &new_x, &new_y);
2807 e_place_zone_cursor(zone, ec->x, ec->y, ec->w, ec->h,
2811 ELOGF("POL", "Apply auto placement (type:%d). (%d,%d) -> (%d,%d).", ec, type, ec->x, ec->y, new_x, new_y);
2812 e_client_pos_set(ec, new_x, new_y);
2813 ec->changes.pos = 1;
2815 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2820 _e_client_eval(E_Client *ec)
2823 unsigned int prop = 0;
2824 #ifdef REFACTOR_ZONE_DESK
2832 if (e_object_is_del(E_OBJECT(ec)))
2834 CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
2839 TRACE_DS_BEGIN(CLIENT:EVAL);
2841 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_new_client, NULL);
2842 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec))
2848 #ifdef REFACTOR_ZONE_DESK
2849 if ((ec->new_client) && (!e_client_util_ignored_get(ec)))
2851 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2852 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2859 zone = e_comp_zone_find_by_ec(ec);
2860 if ((ec->new_client) && (!e_client_util_ignored_get(ec)) && (zone))
2862 int zx = 0, zy = 0, zw = 0, zh = 0;
2864 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
2865 /* enforce wm size hints for initial sizing */
2866 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
2868 tw = MIN(ec->w, zone->w);
2869 th = MIN(ec->h, zone->h);
2870 e_client_size_set(ec, tw, th);
2875 e_client_resize_limit(ec, &nw, &nh);
2876 e_client_size_set(ec, nw, nh);
2880 int x = ec->x, y = ec->y;
2881 if (ec->x) e_comp_object_frame_xy_adjust(ec->frame, ec->x, 0, &ec->x, NULL);
2882 if (ec->y) e_comp_object_frame_xy_adjust(ec->frame, 0, ec->y, NULL, &ec->y);
2883 if ((x != ec->x) || (y != ec->y)) ec->changes.pos = 1;
2885 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2891 tx = zx + ((zw - ec->w) / 2);
2892 ty = zy + ((zh - ec->h) / 2);
2893 e_client_pos_set(ec, tx, ty);
2895 ec->changes.pos = 1;
2897 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2902 eai = e_appinfo_find_with_pid(ec->netwm.pid);
2906 _e_client_apply_auto_placement(ec);
2910 if (e_appinfo_auto_placement_get(eai))
2911 _e_client_apply_auto_placement(ec);
2914 /* Recreate state */
2915 if (ec->e.state.centered)
2917 tx = zx + (zw - ec->w) / 2;
2918 ty = zy + (zh - ec->h) / 2;
2919 e_client_pos_set(ec, tx, ty);
2920 ec->changes.pos = 1;
2923 /* if the explicit geometry request asks for the app to be
2924 * in another zone - well move it there */
2926 E_Zone *zone1 = NULL;
2931 if ((!ec->re_manage) && ((ec->x != x) || (ec->y != y)))
2932 zone1 = e_comp_zone_xy_get(x, y);
2936 zone1 = e_comp_zone_xy_get(ec->x + (ec->w / 2), ec->y + (ec->h / 2));
2939 E_Zone *z2 = e_comp_zone_xy_get(ec->x, ec->y);
2941 if (z2 && (z2 != zone1))
2947 EINA_LIST_FOREACH(e_comp->zones, l, z2)
2951 x = ec->x, y = ec->y, w = ec->w, h = ec->h;
2952 E_RECTS_CLIP_TO_RECT(x, y, w, h, z2->x, z2->y, z2->w, z2->h);
2953 if (w * h == z2->w * z2->h)
2955 /* client fully covering zone */
2959 if ((unsigned)(w * h) > psz)
2970 zone1 = e_comp_zone_xy_get(ec->x, ec->y);
2972 zone1 = e_comp_zone_xy_get(ec->x + ec->w - 1, ec->y);
2974 zone1 = e_comp_zone_xy_get(ec->x + ec->w - 1, ec->y + ec->h - 1);
2976 zone1 = e_comp_zone_xy_get(ec->x, ec->y + ec->h - 1);
2977 if ((zone1) && (zone1 != zone))
2978 e_client_zone_set(ec, zone1);
2982 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2983 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2990 /* effect changes to the window border itself */
2991 if ((ec->changes.shading))
2993 /* show at start of unshade (but don't hide until end of shade) */
2994 ec->changes.shading = 0;
2997 if (ec->changes.shaded) send_event = 0;
2998 if ((ec->changes.shaded) && (ec->changes.pos) && (ec->changes.size))
3000 ec->changes.shaded = 0;
3002 else if ((ec->changes.shaded) && (ec->changes.pos))
3004 ec->changes.size = 1;
3005 ec->changes.shaded = 0;
3007 else if ((ec->changes.shaded) && (ec->changes.size))
3009 ec->changes.shaded = 0;
3011 else if (ec->changes.shaded)
3013 ec->changes.shaded = 0;
3016 if (ec->changes.size)
3018 ec->changes.size = 0;
3019 if ((!ec->shaded) && (!ec->shading))
3020 evas_object_resize(ec->frame, ec->w, ec->h);
3022 prop |= E_CLIENT_PROPERTY_SIZE;
3024 if (ec->changes.pos)
3026 ec->changes.tz_position = 0;
3027 ec->changes.pos = 0;
3028 evas_object_move(ec->frame, ec->x, ec->y);
3029 prop |= E_CLIENT_PROPERTY_POS;
3032 if (ec->changes.reset_gravity)
3034 ec->changes.reset_gravity = 0;
3035 prop |= E_CLIENT_PROPERTY_GRAVITY;
3038 if (ec->changes.title)
3040 ec->changes.title = 0;
3041 prop |= E_CLIENT_PROPERTY_TITLE;
3044 if ((ec->changes.visible) && (ec->visible) && (ec->new_client) && (!ec->iconic))
3048 e_input_device_pointer_xy_get(NULL, &x, &y);
3049 if ((!ec->placed) && (!ec->re_manage) &&
3050 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
3051 (!((ec->icccm.transient_for != 0) ||
3053 (!ecmove) && (!ecresize))
3055 /* Set this window into moving state */
3057 ec->cur_mouse_action = e_action_find("window_move");
3058 if (ec->cur_mouse_action)
3060 if ((!ec->cur_mouse_action->func.end_mouse) &&
3061 (!ec->cur_mouse_action->func.end))
3062 ec->cur_mouse_action = NULL;
3063 if (ec->cur_mouse_action)
3066 tx = x - (ec->w >> 1);
3067 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
3069 e_client_pos_set(ec, tx, ty);
3071 ec->changes.pos = 1;
3076 evas_object_show(ec->frame);
3077 if (evas_object_visible_get(ec->frame))
3079 #ifdef REFACTOR_FOCUS_POLICY
3080 // It is useless, Nothing to do.
3082 if (ec->cur_mouse_action)
3084 ec->moveinfo.down.x = ec->x;
3085 ec->moveinfo.down.y = ec->y;
3086 ec->moveinfo.down.w = ec->w;
3087 ec->moveinfo.down.h = ec->h;
3088 ec->mouse.current.mx = x;
3089 ec->mouse.current.my = y;
3090 ec->moveinfo.down.button = 0;
3091 ec->moveinfo.down.mx = x;
3092 ec->moveinfo.down.my = y;
3094 e_object_ref(E_OBJECT(ec->cur_mouse_action));
3095 ec->cur_mouse_action->func.go(E_OBJECT(ec), NULL);
3096 if (e_config->border_raise_on_mouse_action)
3098 if (e_config->focus_policy_ext != E_FOCUS_EXT_TOP_STACK)
3100 ELOGF("FOCUS", "focus set | client eval", ec);
3101 e_client_frame_focus_set(ec, EINA_TRUE);
3105 ec->changes.visible = 0;
3106 _e_client_event_show(ec);
3109 else if ((ec->changes.visible) && (ec->new_client))
3111 ec->changes.visible = 0;
3113 _e_client_event_hide(ec);
3116 if (ec->changes.icon)
3118 ec->changes.icon = 0;
3122 e_comp->new_clients--;
3124 ec->changed = ec->changes.pos || ec->changes.size ||
3125 ec->changes.stack || ec->changes.prop || ec->changes.border ||
3126 ec->changes.reset_gravity || ec->changes.shading || ec->changes.shaded ||
3127 ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
3128 ec->changes.internal_state ||
3129 ec->changes.need_maximize || ec->changes.need_unmaximize;
3130 ec->changes.stack = 0;
3132 #ifdef REFACTOR_FOCUS_POLICY
3133 // This code executes at E_CLIENT_HOOK_EVAL_END callback at e_focus_policy_topmost.c and e_focus_policy_history.c
3135 zone = e_comp_zone_find_by_ec(ec);
3136 if ((!ec->input_only) && (!ec->iconic) &&
3137 ((!zone) || e_desk_has_ec(e_desk_current_get(zone), ec)) &&
3138 ((ec->take_focus) || (ec->want_focus)))
3144 #if 0 // focus should be set to the top window
3145 e_client_focus_set_with_pointer(ec);
3150 /* focus window by default when it is the only one on desk */
3151 E_Client *ec2 = NULL;
3154 desk = e_zone_desk_find_by_ec(zone, ec);
3155 EINA_LIST_FOREACH(focus_stack, l, ec2)
3157 if (ec == ec2) continue;
3158 if ((!ec2->iconic) && (ec2->visible) &&
3159 ((e_desk_has_ec(desk, ec2)) || ec2->sticky))
3165 e_client_focus_set_with_pointer(ec);
3170 ec->take_focus = ec->want_focus = 0;
3173 if (ec->changes.need_maximize)
3175 E_Maximize max = ec->maximized;
3176 ec->maximized = E_MAXIMIZE_NONE;
3177 e_client_maximize(ec, max);
3178 ec->changes.need_maximize = 0;
3180 else if (ec->changes.need_unmaximize)
3182 e_client_unmaximize(ec, ec->maximized);
3183 ec->changes.need_unmaximize = 0;
3186 if (ec->need_fullscreen)
3188 e_client_fullscreen(ec, e_config->fullscreen_policy);
3189 ec->need_fullscreen = 0;
3192 if (ec->changes.accepts_focus)
3194 if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus))
3197 ec->changes.accepts_focus = 0;
3201 if (send_event && prop)
3203 _e_client_event_property(ec, prop);
3206 _e_client_aux_hint_eval(ec);
3208 e_client_transform_core_update(ec);
3210 wl_signal_emit_mutable(&PRI(ec)->events.eval_end, NULL);
3211 _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
3216 #ifdef REFACTOR_ZONE_DESK
3218 e_client_frame_update(E_Client *ec)
3221 _e_client_frame_update(E_Client *ec)
3224 const char *bordername;
3226 #ifdef REFACTOR_ZONE_DESK
3227 EINA_SAFETY_ON_NULL_RETURN(ec);
3228 if (e_object_is_del(E_OBJECT(ec))) return;
3231 ec->border.changed = 0;
3232 if (!e_comp_object_frame_allowed(ec->frame)) return;
3233 if (ec->fullscreen || ec->borderless)
3234 bordername = "borderless";
3235 else if (ec->bordername)
3236 bordername = ec->bordername;
3237 else if (ec->mwm.borderless)
3238 bordername = "borderless";
3239 else if (((ec->icccm.transient_for != 0) || (ec->dialog)) &&
3240 (ec->icccm.min_w == ec->icccm.max_w) &&
3241 (ec->icccm.min_h == ec->icccm.max_h))
3242 bordername = "noresize_dialog";
3243 else if ((ec->icccm.min_w == ec->icccm.max_w) &&
3244 (ec->icccm.min_h == ec->icccm.max_h))
3245 bordername = "noresize";
3246 else if (ec->shaped)
3247 bordername = "shaped";
3248 else if (ec->urgent)
3249 bordername = "urgent";
3250 else if (ec->netwm.state.modal)
3251 bordername = "modal";
3252 else if ((ec->netwm.state.skip_taskbar) ||
3253 (ec->netwm.state.skip_pager))
3254 bordername = "skipped";
3256 else if ((ec->internal) && (ec->icccm.class) &&
3257 (!strncmp(ec->icccm.class, "e_fwin", 6)))
3258 bordername = "internal_fileman";
3261 bordername = e_config->theme_default_border_style;
3262 if (!bordername) bordername = "default";
3264 e_client_border_set(ec, bordername);
3268 _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
3270 if (!ec || !m) return EINA_FALSE;
3271 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
3273 if ((int)ec->netwm.type != m->window_type)
3276 #if defined(__cplusplus) || defined(c_plusplus)
3279 if (!ec->icccm.cpp_class)
3282 if (!e_util_glob_match(ec->icccm.cpp_class, m->clas))
3288 if (!ec->icccm.class)
3291 if (!e_util_glob_match(ec->icccm.class, m->clas))
3298 if (ec->icccm.name && e_util_glob_match(ec->icccm.name, m->name))
3301 if (ec->icccm.title && e_util_glob_match(ec->icccm.title, m->name))
3304 if (ec->netwm.name && e_util_glob_match(ec->netwm.name, m->name))
3312 e_client_type_update(E_Client *ec)
3314 E_Config_Client_Type *m;
3318 if (!e_config->client_types) return 0;
3320 EINA_LIST_FOREACH(e_config->client_types, l, m)
3322 if (!_e_client_type_match(ec, m)) continue;
3325 type = m->client_type;
3330 if (ec->client_type != type)
3332 ec->client_type = type;
3333 _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
3336 return ec->client_type;
3340 _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom)
3342 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3346 int ox = 0, oy = 0, ow, oh;
3350 EINA_SAFETY_ON_FALSE_RETURN(e_comp_wl_subsurface_check(ec));
3352 e_comp_wl_subsurface_position_get(ec, &ox, &oy);
3353 ow = cdata->width_from_viewport;
3354 oh = cdata->height_from_viewport;
3356 map = e_client_map_get(epc);
3357 e_map_point_coord_get(map, 0, &px, &py, 0);
3360 mx = ox * zoom + px;
3361 my = oy * zoom + py;
3365 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
3366 e_map_util_points_populate_from_geometry(map, mx, my, mw, mh, 0);
3367 e_map_util_object_move_sync_set(map, EINA_TRUE);
3368 e_client_map_set(ec, map);
3369 e_client_map_enable_set(ec, EINA_TRUE);
3371 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
3372 _e_client_transform_sub_apply(subc, ec, zoom);
3373 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
3374 _e_client_transform_sub_apply(subc, ec, zoom);
3380 _e_client_transient_for_group_make(E_Client *ec, Eina_List **list)
3386 if (!e_config->transient.raise) return;
3388 EINA_LIST_FOREACH(ec->transients, l, child)
3390 if (!child) continue;
3391 if (child->iconic) continue;
3392 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
3394 *list = eina_list_prepend(*list, child);
3395 _e_client_transient_for_group_make(child, list);
3401 e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus)
3403 E_Client *top_ec = NULL;
3404 Eina_List *transient_list = NULL;
3406 _e_client_transient_for_group_make(ec, &transient_list);
3410 Eina_List *l = NULL;
3411 E_Client *temp_ec = NULL;
3412 E_Client *temp_ec2 = NULL;
3414 E_CLIENT_REVERSE_FOREACH(temp_ec)
3423 EINA_LIST_FOREACH(transient_list, l, temp_ec2)
3425 if (temp_ec == temp_ec2)
3429 if ((temp_ec2->icccm.accepts_focus) ||
3430 (temp_ec2->icccm.take_focus))
3443 eina_list_free(transient_list);
3448 #ifdef EC_IS_NOT_VISIBLE
3449 # undef EC_IS_NOT_VISIBLE
3451 #define EC_IS_NOT_VISIBLE if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED)
3454 e_client_visibility_touched_check(E_Client *ec)
3458 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
3460 tx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x);
3461 ty = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y);
3463 return _e_client_position_inside_input_rect(ec, tx, ty);
3467 e_client_visibility_change_notify(E_Client *ec)
3469 EINA_SAFETY_ON_NULL_RETURN(ec);
3471 if (ec->visibility.changed)
3472 _e_client_event_simple(ec, E_EVENT_CLIENT_VISIBILITY_CHANGE);
3474 wl_signal_emit_mutable(&PRI(ec)->events.eval_visibility, NULL);
3475 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY, ec);
3479 e_client_visibility_end_notify(void)
3481 // FIXME: This hook means that the visiblitiy calculation of a zone is done
3482 // at this idle handler.This is a hook for a zone, not for a client.
3483 // Therefore, this hook may be defined as a zone hook,
3484 // ex) E_ZONE_HOOK_EVAL_VISIBILITY_END or E_ZONE_HOOK_EVAL_VISIBILITY_DONE.
3485 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY_END, NULL);
3488 #ifdef REFACTOR_FOCUS_POLICY
3491 _e_client_merge_focus_stack_with_defer_focus(void)
3493 Eina_List *l = NULL;
3494 E_Client *ec = NULL, *defer_ec = NULL;
3495 Eina_Bool find_rel = EINA_FALSE;
3496 Eina_Bool inserted = EINA_FALSE;
3498 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
3502 focus_stack = eina_list_merge(focus_stack, defer_focus_stack);
3506 E_CLIENT_FOREACH(defer_ec)
3508 if (!eina_list_data_find(defer_focus_stack, defer_ec)) continue;
3510 find_rel = EINA_FALSE;
3511 inserted = EINA_FALSE;
3512 focus_stack = eina_list_remove(focus_stack, defer_ec);
3514 EINA_LIST_FOREACH(focus_stack, l, ec)
3516 if (ec == NULL) continue;
3521 find_rel = EINA_TRUE;
3525 if (ec->layer > defer_ec->layer) continue;
3527 focus_stack = eina_list_prepend_relative_list(focus_stack, defer_ec, l);
3528 inserted = EINA_TRUE;
3533 focus_stack = eina_list_append(focus_stack, defer_ec);
3537 defer_focus_stack = eina_list_free(defer_focus_stack);
3542 _e_client_candidate_focus(E_Zone *zone, E_Client *reverted_focus_ec)
3545 E_Client *defered_focus_ec = NULL;
3546 Eina_List *child_list = NULL;
3547 Eina_List *l = NULL;
3548 Eina_Bool child_deferred;
3551 E_CLIENT_REVERSE_FOREACH(ec)
3553 if (!eina_list_data_find(defer_focus_stack, ec)) continue;
3555 if (e_object_is_del(E_OBJECT(ec))) continue;
3556 if (e_client_util_ignored_get(ec)) continue;
3557 if (!e_zone_has_ec(zone, ec)) continue;
3558 desk = e_desk_current_get(zone);
3559 if (!desk) continue;
3560 if (!e_desk_has_ec(desk, ec)) continue;
3562 if (!(ec->icccm.accepts_focus || ec->icccm.take_focus)) continue;
3563 if (ec->lock_focus_in || ec->lock_focus_out) continue;
3564 if (!evas_object_visible_get(ec->frame)) continue;
3565 if (ec->iconic) continue;
3566 if (ec->bg_state) continue;
3568 if (!(cec = e_client_check_obscured_by_children_group(ec)) ||
3569 e_client_check_really_iconified(cec))
3571 if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED) continue;
3572 if (e_client_check_fully_contain_by_above(ec, EINA_FALSE)) continue;
3575 if (focused && (focused->layer > ec->layer)) continue;
3576 else if (!focused && reverted_focus_ec && (reverted_focus_ec->layer > ec->layer)) continue;
3578 // check transient_for child defered
3579 child_deferred = EINA_FALSE;
3580 child_list = eina_list_clone(ec->transients);
3581 EINA_LIST_FOREACH(child_list, l, cec)
3583 if (e_client_transient_policy_get(cec) == E_TRANSIENT_BELOW) continue;
3584 if (!(cec->icccm.accepts_focus || cec->icccm.take_focus)) continue;
3585 if (eina_list_data_find(defer_focus_stack, cec))
3587 child_deferred = EINA_TRUE;
3591 eina_list_free(child_list);
3592 if (child_deferred) continue;
3594 defered_focus_ec = ec;
3597 return defered_focus_ec;
3601 e_client_focus_calculate(E_Zone *zone)
3603 E_Client *defered_focus_ec = NULL, *reverted_focus_ec = NULL;
3604 E_Client *ec = NULL, *old_focused = NULL;
3606 EINA_SAFETY_ON_NULL_RETURN(zone);
3607 if (!e_zone_is_displaying(zone)) return;
3609 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
3611 ec = _e_client_focus_topmost_focusable_get();
3615 if (!ec) ELOGF("FOCUS", "focus unset | No focusable ec", focused);
3616 e_client_frame_focus_set(focused, EINA_FALSE);
3620 ELOGF("FOCUS", "focus set | topmost focus calculate", ec);
3621 e_client_frame_focus_set(ec, EINA_TRUE);
3628 (focused != eina_list_data_get(focus_stack)) ||
3629 (!_e_client_focus_can_take(focused)))
3631 reverted_focus_ec = _e_client_revert_focus_get(focused);
3632 if (!reverted_focus_ec && focused)
3634 e_client_focus_defer_unset(focused);
3635 old_focused = focused;
3639 defered_focus_ec = _e_client_candidate_focus(zone, reverted_focus_ec);
3641 if (defered_focus_ec)
3643 if (defered_focus_ec != focused)
3645 ELOGF("FOCUS", "focus set | focus calculate (defer_focus)", defered_focus_ec);
3647 e_client_focus_defer_unset(focused);
3648 e_client_frame_focus_set(defered_focus_ec, EINA_TRUE);
3651 e_client_focus_defer_unset(defered_focus_ec);
3653 _e_client_merge_focus_stack_with_defer_focus();
3655 else if(reverted_focus_ec)
3657 if (reverted_focus_ec != focused)
3659 ELOGF("FOCUS", "focus set | focus calculate (revert_focus)", reverted_focus_ec);
3661 e_client_focus_defer_unset(focused);
3662 e_client_frame_focus_set(reverted_focus_ec, EINA_TRUE);
3665 else if (old_focused)
3667 ELOGF("FOCUS", "focus unset | focus calculate", old_focused);
3668 e_client_frame_focus_set(old_focused, EINA_FALSE);
3676 _e_client_transform_core_check_change(E_Client *ec)
3680 Eina_Bool check = EINA_FALSE;
3681 if (!ec) return EINA_FALSE;
3684 evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
3686 // check client position or size change
3687 if (ec->x != ec->transform_core.backup.client_x ||
3688 ec->y != ec->transform_core.backup.client_y ||
3689 ec->w != ec->transform_core.backup.client_w ||
3690 ec->h != ec->transform_core.backup.client_h ||
3691 w != ec->transform_core.backup.frame_w ||
3692 h != ec->transform_core.backup.frame_h ||
3693 ec->argb != ec->transform_core.backup.argb)
3696 ec->transform_core.backup.client_x = ec->x;
3697 ec->transform_core.backup.client_y = ec->y;
3698 ec->transform_core.backup.client_w = ec->w;
3699 ec->transform_core.backup.client_h = ec->h;
3700 ec->transform_core.backup.frame_w = w;
3701 ec->transform_core.backup.frame_h = h;
3702 ec->transform_core.backup.argb = ec->argb;
3705 // check new transform or del transform
3706 if (ec->transform_core.changed)
3709 ec->transform_core.changed = EINA_FALSE;
3712 // check each transform change
3713 if (ec->transform_core.transform_list)
3717 E_Util_Transform *transform;
3719 EINA_LIST_FOREACH_SAFE(ec->transform_core.transform_list, l, l_next, transform)
3721 // del transform check
3722 if (e_util_transform_ref_count_get(transform) <= 1)
3724 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
3725 e_util_transform_unref(transform);
3730 // transform change test
3731 if (e_util_transform_change_get(transform))
3734 e_util_transform_change_unset(transform);
3739 if (e_comp_wl_subsurface_check(ec))
3741 // check parent matrix change
3742 E_Client *parent = e_comp_wl_subsurface_parent_get(ec);
3743 if (parent && parent->transform_core.result.enable)
3745 ec->transform_core.parent.enable = EINA_TRUE;
3747 if (!e_util_transform_matrix_equal_check(&ec->transform_core.parent.matrix,
3748 &parent->transform_core.result.matrix))
3751 ec->transform_core.parent.matrix = parent->transform_core.result.matrix;
3753 if (memcmp(&ec->transform_core.parent.zoom, &parent->transform_core.result.transform.zoom, sizeof(E_Util_Transform_Zoom)) != 0)
3756 ec->transform_core.parent.zoom = parent->transform_core.result.transform.zoom;
3759 else if (ec->transform_core.parent.enable)
3761 ec->transform_core.parent.enable = EINA_FALSE;
3762 e_util_transform_matrix_load_identity(&ec->transform_core.parent.matrix);
3763 ec->transform_core.parent.zoom.zoom_x = 1.0;
3764 ec->transform_core.parent.zoom.zoom_y = 1.0;
3765 ec->transform_core.parent.zoom.cx = 0;
3766 ec->transform_core.parent.zoom.cy = 0;
3775 _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
3777 int minx = 99999, miny = 99999;
3778 int maxx = -99999, maxy = -99999;
3783 if (!ec->frame) return;
3784 if (!ec->transform_core.result.enable) return;
3785 if (!vertices) return;
3787 for (i = 0; i < 4; ++i)
3792 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
3794 if (x < minx) minx = x;
3795 if (y < miny) miny = y;
3796 if (x > maxx) maxx = x;
3797 if (y > maxy) maxy = y;
3800 ec->transform_core.result.boundary.x = minx;
3801 ec->transform_core.result.boundary.y = miny;
3802 ec->transform_core.result.boundary.w = maxx - minx;
3803 ec->transform_core.result.boundary.h = maxy - miny;
3805 ELOGF("COMP", "[Transform][boundary][%d %d %d %d]",
3807 ec->transform_core.result.boundary.x,
3808 ec->transform_core.result.boundary.y,
3809 ec->transform_core.result.boundary.w,
3810 ec->transform_core.result.boundary.h);
3814 _e_client_transform_core_map_new(Evas_Object *obj,
3815 E_Util_Transform_Rect_Vertex *vertices,
3816 E_Util_Transform *transform,
3817 Eina_Bool direct_render)
3824 map = e_map_new_with_direct_render(direct_render);
3825 EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL);
3827 e_map_util_points_populate_from_object_full(map, obj, 0);
3828 e_map_util_points_color_set(map, 255, 255, 255, 255);
3830 for (i = 0 ; i < 4 ; ++i)
3835 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
3836 e_map_point_coord_set(map, i, x, y, 1.0);
3838 if (transform && e_util_transform_texcoord_flag_get(transform))
3843 e_util_transform_texcoord_get(transform, i, &u, &v);
3844 e_map_point_image_uv_set(map, i, u, v);
3852 _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec,
3854 E_Util_Transform_Rect_Vertex *vertices,
3855 E_Util_Transform *transform,
3856 E_Util_Transform_Zoom zoom)
3864 map = _e_client_transform_core_map_new(obj, vertices, transform,
3865 ec->transform_core.direct_render);
3866 EINA_SAFETY_ON_NULL_RETURN(map);
3868 e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy);
3870 e_comp_object_map_set(obj, map);
3872 if (ec->transform_core.activate)
3873 e_comp_object_map_enable_set(obj, EINA_TRUE);
3875 e_comp_object_map_enable_set(obj, EINA_FALSE);
3880 evas_object_map_enable_set(obj, EINA_FALSE);
3884 _e_client_transform_core_vertices_apply(E_Client *ec,
3886 E_Util_Transform_Rect_Vertex *vertices,
3887 E_Util_Transform *transform)
3895 map = _e_client_transform_core_map_new(obj, vertices, transform,
3896 ec->transform_core.direct_render);
3897 EINA_SAFETY_ON_NULL_RETURN(map);
3899 e_comp_object_map_set(obj, map);
3901 if (ec->transform_core.activate)
3902 e_comp_object_map_enable_set(obj, EINA_TRUE);
3904 e_comp_object_map_enable_set(obj, EINA_FALSE);
3909 evas_object_map_enable_set(obj, EINA_FALSE);
3913 _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
3917 E_Comp_Wl_Client_Data *cdata;
3921 cdata = e_client_cdata_get(ec);
3924 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
3925 e_client_transform_core_update(subc);
3927 EINA_LIST_FOREACH(cdata->sub.below_list, l, subc)
3928 e_client_transform_core_update(subc);
3932 _e_client_cb_hook_shell_surface_ready(void *data EINA_UNUSED, E_Client *ec)
3934 if (EINA_UNLIKELY(!ec))
3937 _e_client_aux_hint_eval(ec);
3940 // FIXME: This function has to be deleted and it remains for the backward compatibility.
3941 // Please find and fix to use e_comp_visibility_calculation_set(EINA_TRUE)
3942 // instead of e_client_visibility_calculate() call at e20 modules.
3944 e_client_visibility_calculate(void)
3946 e_comp_visibility_calculation_set(EINA_TRUE);
3950 e_client_visibility_skip_set(E_Client *ec, Eina_Bool skip)
3954 ELOGF("POL_VIS", "visibility skip set to %d", ec, skip);
3955 ec->visibility.skip = skip;
3959 e_client_post_raise_lower_set(E_Client *ec, Eina_Bool raise_set, Eina_Bool lower_set)
3963 ec->post_raise = raise_set;
3964 ec->post_lower = lower_set;
3968 e_client_first_mapped_get(E_Client *ec)
3970 if (!ec) return EINA_FALSE;
3972 return ec->first_mapped;
3975 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec)
3977 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3978 EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE);
3980 return cdata->mapped;
3984 e_client_mapped_set(E_Client *ec, Eina_Bool set)
3986 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3987 EINA_SAFETY_ON_NULL_RETURN(cdata);
3989 cdata->mapped = set;
3993 ////////////////////////////////////////////////
3995 e_client_clients_hash_exist()
3999 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4001 if (eina_hash_population(clients_hash[pix_id]))
4009 e_client_idler_before(Eina_Bool *check_focus)
4014 *check_focus = EINA_FALSE;
4016 if (!e_client_clients_hash_exist()) return;
4018 TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
4020 EINA_LIST_FOREACH(e_comp->clients, l, ec)
4022 // pass 1 - eval0. fetch properties on new or on change and
4023 // call hooks to decide what to do - maybe move/resize
4024 if (ec->ignored || (!ec->changed)) continue;
4026 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_fetch, NULL);
4027 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
4030 /* FETCH is hooked by the compositor to get client hints */
4031 wl_signal_emit_mutable(&PRI(ec)->events.eval_fetch, NULL);
4032 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
4036 e_client_type_update(ec);
4039 /* PRE_POST_FETCH calls e_remember apply for new client */
4040 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_post_fetch, NULL);
4041 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
4042 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_fetch, NULL);
4043 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
4044 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_frame_assign, NULL);
4045 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
4047 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_frame_assign, NULL);
4048 _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
4050 // pass 2 - show and hide windows needing hide and eval (main eval)
4051 E_CLIENT_FOREACH(ec)
4053 if (e_object_is_del(E_OBJECT(ec))) continue;
4056 // ignored client but needing eval (aux hint) such as remote surfaces
4059 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4060 if (cdata && cdata->first_commit)
4061 _e_client_aux_hint_eval(ec);
4066 if (ec->changes.visible)
4070 if ((!ec->new_client) &&
4071 (!ec->changes.pos) &&
4072 (!ec->changes.size))
4074 evas_object_show(ec->frame);
4075 ec->changes.visible = !evas_object_visible_get(ec->frame);
4080 evas_object_hide(ec->frame);
4081 ec->changes.visible = 0;
4088 e_comp_visibility_calculation_set(EINA_TRUE);
4089 if (ec->changes.accepts_focus)
4090 *check_focus = EINA_TRUE;
4091 ec->changes.accepts_focus = 0;
4094 if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
4096 evas_object_show(ec->frame);
4097 ec->changes.visible = !evas_object_visible_get(ec->frame);
4098 ec->changed = ec->changes.visible;
4099 e_comp_visibility_calculation_set(EINA_TRUE);
4111 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4112 clients_hash[pix_id] = eina_hash_pointer_new(NULL);
4114 E_COMP_WL_HOOK_APPEND(hooks, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _e_client_cb_hook_shell_surface_ready, NULL);
4116 #ifdef REFACTOR_FOCUS_POLICY
4118 g_mutex_init(&focused_ec_mutex);
4121 E_EVENT_CLIENT_ADD = ecore_event_type_new();
4122 E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
4123 E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
4124 E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
4125 E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
4126 E_EVENT_CLIENT_MOVE = ecore_event_type_new();
4127 E_EVENT_CLIENT_SHOW = ecore_event_type_new();
4128 E_EVENT_CLIENT_HIDE = ecore_event_type_new();
4129 E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
4130 E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
4131 E_EVENT_CLIENT_STACK = ecore_event_type_new();
4132 E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
4133 E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
4134 E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
4135 E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
4136 E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
4137 #ifdef _F_ZONE_WINDOW_ROTATION_
4138 E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
4139 E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
4140 E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new();
4141 E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = ecore_event_type_new();
4143 E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new();
4144 E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new();
4145 E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();;
4146 E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();;
4148 return (!!clients_hash[1]);
4152 e_client_shutdown(void)
4155 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4156 E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
4158 E_FREE_LIST(hooks, e_comp_wl_hook_del);
4159 E_FREE_LIST(handlers, ecore_event_handler_del);
4161 #ifdef REFACTOR_FOCUS_POLICY
4163 g_mutex_clear(&focused_ec_mutex);
4168 e_client_unignore(E_Client *ec)
4171 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4172 if (!ec->ignored) return;
4175 _e_client_event_add(ec);
4179 e_client_new(E_Pixmap *cp, int first_map, int internal)
4184 type = e_pixmap_type_get(cp);
4185 if (type >= E_PIXMAP_TYPE_MAX) return NULL;
4186 if (eina_hash_find(clients_hash[type], &cp)) return NULL;
4188 ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
4189 if (!ec) return NULL;
4190 e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
4192 if (!_e_client_private_init(ec))
4194 e_object_del(E_OBJECT(ec));
4198 uuid_generate(ec->uuid);
4200 ec->focus_policy_override = E_FOCUS_LAST;
4201 e_client_size_set(ec, 1, 1);
4202 ec->internal = internal;
4205 e_pixmap_client_set(cp, ec);
4206 ec->resize_mode = E_POINTER_RESIZE_NONE;
4207 ec->layer = E_LAYER_CLIENT_NORMAL;
4208 ec->first_mapped = EINA_FALSE;
4209 ec->post_raise = EINA_TRUE;
4210 ec->post_lower = EINA_FALSE;
4211 ec->animatable = EINA_TRUE;
4212 ec->maximize_type = e_config->maximize_policy & E_MAXIMIZE_TYPE;
4214 /* FIXME: if first_map is 1 then we should ignore the first hide event
4215 * or ensure the window is already hidden and events flushed before we
4216 * create a border for it */
4219 ec->changes.pos = 1;
4221 // needed to be 1 for internal windw and on restart.
4222 // ec->ignore_first_unmap = 2;
4224 ec->offer_resistance = 1;
4226 e_comp->new_clients++;
4228 ec->exp_iconify.by_client = 0;
4229 ec->exp_iconify.not_raise = 0;
4230 ec->exp_iconify.skip_iconify = 0;
4231 ec->exp_iconify.skip_by_remote = 0;
4232 if (e_config->deiconify_approve)
4233 ec->exp_iconify.deiconify_update= 1;
4235 ec->exp_iconify.deiconify_update= 0;
4236 if (e_config->use_buffer_flush)
4237 ec->exp_iconify.buffer_flush = 1;
4239 ec->exp_iconify.buffer_flush = 0;
4241 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
4243 wl_signal_emit_mutable(&PRI(ec)->events.new_client, NULL);
4244 if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec))
4246 /* delete the above allocated object */
4247 //e_object_del(E_OBJECT(ec));
4251 _e_client_aux_hint_eval(ec);
4253 ec->icccm.title = NULL;
4254 ec->icccm.name = NULL;
4255 #if defined(__cplusplus) || defined(c_plusplus)
4256 ec->icccm.cpp_class = NULL;
4258 ec->icccm.class = NULL;
4260 ec->icccm.icon_name = NULL;
4261 ec->icccm.machine = NULL;
4262 ec->icccm.min_w = 1;
4263 ec->icccm.min_h = 1;
4264 ec->icccm.max_w = 32767;
4265 ec->icccm.max_h = 32767;
4266 ec->icccm.base_w = 0;
4267 ec->icccm.base_h = 0;
4268 ec->icccm.step_w = -1;
4269 ec->icccm.step_h = -1;
4270 ec->icccm.min_aspect = 0.0;
4271 ec->icccm.max_aspect = 0.0;
4274 ec->netwm.name = NULL;
4275 ec->netwm.icon_name = NULL;
4276 ec->netwm.desktop = 0;
4277 ec->netwm.state.modal = 0;
4278 ec->netwm.state.sticky = 0;
4279 ec->netwm.state.shaded = 0;
4280 ec->netwm.state.hidden = 0;
4281 ec->netwm.state.maximized_v = 0;
4282 ec->netwm.state.maximized_h = 0;
4283 ec->netwm.state.skip_taskbar = 0;
4284 ec->netwm.state.skip_pager = 0;
4285 ec->netwm.state.fullscreen = 0;
4286 ec->netwm.state.stacking = E_STACKING_NONE;
4287 ec->netwm.action.move = 0;
4288 ec->netwm.action.resize = 0;
4289 ec->netwm.action.minimize = 0;
4290 ec->netwm.action.shade = 0;
4291 ec->netwm.action.stick = 0;
4292 ec->netwm.action.maximized_h = 0;
4293 ec->netwm.action.maximized_v = 0;
4294 ec->netwm.action.fullscreen = 0;
4295 ec->netwm.action.change_desktop = 0;
4296 ec->netwm.action.close = 0;
4297 ec->netwm.opacity = 255;
4299 ec->visibility.obscured = E_VISIBILITY_UNKNOWN;
4300 ec->visibility.opaque = -1;
4301 ec->visibility.changed = 0;
4302 ec->visibility.skip = 0;
4303 ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN;
4305 ec->transform.zoom = 1.0;
4306 ec->transform.angle = 0.0;
4307 ec->transform_core.direct_render = EINA_TRUE;
4308 ec->transform_core.activate = EINA_TRUE;
4310 ec->pointer_enter_sent = EINA_FALSE;
4312 ec->acquire_fence_fd = -1;
4316 e_comp->clients = eina_list_append(e_comp->clients, ec);
4317 eina_hash_add(clients_hash[type], &ec->pixmap, ec);
4319 ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored);
4321 _e_client_event_add(ec);
4322 e_comp_object_client_add(ec);
4325 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
4326 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
4327 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
4328 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
4329 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
4330 evas_object_smart_callback_add(ec->frame, "shade_done", _e_client_cb_evas_shade_done, ec);
4333 #ifdef REFACTOR_ZONE_DESK
4336 _e_client_zone_update(ec);
4338 e_client_desk_set(ec, e_desk_current_get(e_zone_current_get()));
4341 wl_signal_emit_mutable(&PRI(ec)->events.new_client_post, NULL);
4342 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
4343 _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec);
4346 ec->manage_resize.resize_obj = NULL;
4347 ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0;
4348 ec->manage_resize.enable_aspect_ratio = EINA_FALSE;
4349 ec->manage_resize.aw = ec->manage_resize.ah = 0;
4350 ec->manage_resize.header_h = 0;
4351 ec->manage_resize.footer_h = 0;
4353 ec->visibility.ignore_geometry = e_config->calc_vis_ignore_geometry;
4358 E_API Eina_Bool e_client_is_internal(E_Client *ec)
4360 E_OBJECT_CHECK_RETURN(ec, EINA_TRUE);
4361 return ec->internal;
4364 #ifdef REFACTOR_ZONE_DESK
4367 e_client_desk_set(E_Client *ec, E_Desk *desk)
4369 E_Event_Client_Desk_Set *ev;
4374 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4375 E_OBJECT_CHECK(desk);
4376 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
4377 if (e_desk_has_ec(desk, ec)) return;
4381 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
4382 desk->fullscreen_clients = eina_list_append(desk->fullscreen_clients, ec);
4384 old_desk = ec->desk;
4386 e_desk_client_del(old_desk, ec);
4388 e_desk_client_add(desk, ec);
4389 if (!ec->new_client)
4393 e_comp_object_effect_unclip(ec->frame);
4394 e_comp_object_effect_set(ec->frame, NULL);
4396 if (desk->visible || ec->sticky)
4398 if ((!ec->hidden) && (!ec->iconic))
4399 evas_object_show(ec->frame);
4404 evas_object_hide(ec->frame);
4407 e_client_comp_hidden_set(ec, (!desk->visible) && (!ec->sticky));
4408 e_client_zone_set(ec, desk->zone);
4412 ev = E_NEW(E_Event_Client_Desk_Set, 1);
4417 e_object_ref(E_OBJECT(ec));
4418 ev->desk = old_desk;
4419 e_object_ref(E_OBJECT(old_desk));
4420 ecore_event_add(E_EVENT_CLIENT_DESK_SET, ev, (Ecore_End_Cb)_e_client_event_desk_set_free, NULL);
4423 zone = e_comp_zone_find_by_ec(ec);
4424 if (old_desk->zone == zone)
4426 e_client_res_change_geometry_save(ec);
4427 e_client_res_change_geometry_restore(ec);
4428 ec->pre_res_change.valid = 0;
4432 if (e_config->transient.desktop)
4437 EINA_LIST_FOREACH(ec->transients, l, child)
4438 e_client_desk_set(child, ec->desk);
4441 _e_client_hook_call(E_CLIENT_HOOK_DESK_SET, ec);
4442 evas_object_smart_callback_call(ec->frame, "desk_change", ec);
4444 if (ec->desk->desk_area.enable)
4446 if (!ec->desk_area.desk_area)
4449 eda = e_desk_desk_area_base_get(ec->desk);
4450 e_client_desk_area_set(ec, eda);
4453 e_client_desk_area_enable_set(ec, EINA_TRUE);
4459 e_client_desk_iconify_skip_set(E_Client *ec, Eina_Bool skip)
4462 ec->user_skip_winlist = skip;
4466 e_client_desk_iconify_skip_get(E_Client *ec)
4468 if (!ec) return EINA_FALSE;
4469 return ec->user_skip_winlist;
4473 e_client_comp_grabbed_get(void)
4475 return comp_grabbed;
4479 e_client_action_get(void)
4481 return action_client;
4485 //////////////////////////////////////////////////////////
4488 e_client_mouse_in(E_Client *ec, int x, int y)
4492 if (comp_grabbed) return;
4493 if (e_object_is_del(E_OBJECT(ec))) return;
4494 desk = e_comp_desk_find_by_ec(ec);
4495 if (desk && desk->animate_count) return;
4496 ec->mouse.current.mx = x;
4497 ec->mouse.current.my = y;
4500 #ifdef REFACTOR_FOCUS_POLICY
4501 wl_signal_emit_mutable(&PRI(ec)->events.mouse_in, NULL);
4503 if ((!ec->iconic) && (!e_client_util_ignored_get(ec)))
4504 e_focus_event_mouse_in(ec);
4509 e_client_mouse_out(E_Client *ec, int x, int y)
4513 if (comp_grabbed) return;
4514 if (ec->fullscreen) return;
4515 if (e_object_is_del(E_OBJECT(ec))) return;
4516 desk = e_comp_desk_find_by_ec(ec);
4517 if (desk && desk->animate_count) return;
4519 ec->mouse.current.mx = x;
4520 ec->mouse.current.my = y;
4523 #ifdef REFACTOR_FOCUS_POLICY
4524 wl_signal_emit_mutable(&PRI(ec)->events.mouse_out, NULL);
4526 if ((!ec->iconic) && (!e_client_util_ignored_get(ec)))
4527 e_focus_event_mouse_out(ec);
4532 e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
4534 EINA_SAFETY_ON_NULL_RETURN(ec);
4535 if (action_client) return;
4536 ec->mouse.current.mx = output->x;
4537 ec->mouse.current.my = output->y;
4541 e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
4543 #ifdef REFACTOR_FOCUS_POLICY
4548 EINA_SAFETY_ON_NULL_RETURN(ec);
4549 if (action_client || ec->iconic || e_client_util_ignored_get(ec)) return;
4550 if ((button >= 1) && (button <= 3))
4552 ec->mouse.last_down[button - 1].mx = output->x;
4553 ec->mouse.last_down[button - 1].my = output->y;
4554 ec->mouse.last_down[button - 1].x = ec->x;
4555 ec->mouse.last_down[button - 1].y = ec->y;
4556 ec->mouse.last_down[button - 1].w = ec->w;
4557 ec->mouse.last_down[button - 1].h = ec->h;
4561 ec->moveinfo.down.x = ec->x;
4562 ec->moveinfo.down.y = ec->y;
4563 ec->moveinfo.down.w = ec->w;
4564 ec->moveinfo.down.h = ec->h;
4566 ec->mouse.current.mx = output->x;
4567 ec->mouse.current.my = output->y;
4568 if ((button >= 1) && (button <= 3))
4570 ec->mouse.last_down[button - 1].mx = output->x;
4571 ec->mouse.last_down[button - 1].my = output->y;
4572 ec->mouse.last_down[button - 1].x = ec->x;
4573 ec->mouse.last_down[button - 1].y = ec->y;
4574 ec->mouse.last_down[button - 1].w = ec->w;
4575 ec->mouse.last_down[button - 1].h = ec->h;
4579 ec->moveinfo.down.x = ec->x;
4580 ec->moveinfo.down.y = ec->y;
4581 ec->moveinfo.down.w = ec->w;
4582 ec->moveinfo.down.h = ec->h;
4584 ec->mouse.current.mx = output->x;
4585 ec->mouse.current.my = output->y;
4587 #ifdef REFACTOR_FOCUS_POLICY
4588 wl_signal_emit_mutable(&PRI(ec)->events.mouse_down, NULL);
4590 focused = e_client_focused_get();
4591 if ((focused) && (ec != focused))
4593 e_focus_event_mouse_down(ec);
4599 e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
4601 EINA_SAFETY_ON_NULL_RETURN(ec);
4602 if (ec->iconic || e_client_util_ignored_get(ec)) return;
4603 if ((button >= 1) && (button <= 3))
4605 ec->mouse.last_up[button - 1].mx = output->x;
4606 ec->mouse.last_up[button - 1].my = output->y;
4607 ec->mouse.last_up[button - 1].x = ec->x;
4608 ec->mouse.last_up[button - 1].y = ec->y;
4610 ec->mouse.current.mx = output->x;
4611 ec->mouse.current.my = output->y;
4612 /* also we don't pass the same params that went in - then again that */
4613 /* should be ok as we are just ending the action if it has an end */
4614 if (ec->cur_mouse_action)
4616 if (ec->cur_mouse_action->func.end_mouse)
4617 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
4618 else if (ec->cur_mouse_action->func.end)
4619 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4620 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4621 ec->cur_mouse_action = NULL;
4624 if ((button >= 1) && (button <= 3))
4626 ec->mouse.last_up[button - 1].mx = output->x;
4627 ec->mouse.last_up[button - 1].my = output->y;
4628 ec->mouse.last_up[button - 1].x = ec->x;
4629 ec->mouse.last_up[button - 1].y = ec->y;
4634 e_client_stay_within_canvas_margin(E_Client *ec)
4641 _e_client_stay_within_canvas_margin(ec, ec->x, ec->y, &new_x, &new_y);
4643 if ((ec->x != new_x) || (ec->y != new_y))
4644 evas_object_move(ec->frame, new_x, new_y);
4649 e_client_mouse_move(E_Client *ec, Evas_Point *output)
4651 EINA_SAFETY_ON_NULL_RETURN(ec);
4652 if (ec->iconic || e_client_util_ignored_get(ec)) return;
4653 ec->mouse.current.mx = output->x;
4654 ec->mouse.current.my = output->y;
4655 if (e_client_util_moving_get(ec))
4657 _e_client_move_handle(ec);
4659 else if (e_client_util_resizing_get(ec))
4661 _e_client_resize_handle(ec);
4664 ///////////////////////////////////////////////////////
4667 e_client_res_change_geometry_save(E_Client *ec)
4670 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4672 if (ec->pre_res_change.valid) return;
4673 ec->pre_res_change.valid = 1;
4674 ec->pre_res_change.x = ec->x;
4675 ec->pre_res_change.y = ec->y;
4676 ec->pre_res_change.w = ec->w;
4677 ec->pre_res_change.h = ec->h;
4678 ec->pre_res_change.saved.x = ec->saved.x;
4679 ec->pre_res_change.saved.y = ec->saved.y;
4680 ec->pre_res_change.saved.w = ec->saved.w;
4681 ec->pre_res_change.saved.h = ec->saved.h;
4685 e_client_res_change_geometry_restore(E_Client *ec)
4691 unsigned char valid : 1;
4700 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4701 if (!ec->pre_res_change.valid) return;
4702 if (ec->new_client) return;
4704 zone = e_comp_zone_find_by_ec(ec);
4707 memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
4711 e_client_unfullscreen(ec);
4712 e_client_fullscreen(ec, e_config->fullscreen_policy);
4714 else if (ec->maximized != E_MAXIMIZE_NONE)
4718 max = ec->maximized;
4719 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
4720 e_client_maximize(ec, max);
4724 int x, y, w, h, zx, zy, zw, zh;
4726 ec->saved.x = ec->pre_res_change.saved.x;
4727 ec->saved.y = ec->pre_res_change.saved.y;
4728 ec->saved.w = ec->pre_res_change.saved.w;
4729 ec->saved.h = ec->pre_res_change.saved.h;
4731 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
4733 if (ec->saved.w > zw)
4735 if ((ec->saved.x + ec->saved.w) > (zx + zw))
4736 ec->saved.x = zx + zw - ec->saved.w;
4738 if (ec->saved.h > zh)
4740 if ((ec->saved.y + ec->saved.h) > (zy + zh))
4741 ec->saved.y = zy + zh - ec->saved.h;
4743 x = ec->pre_res_change.x;
4744 y = ec->pre_res_change.y;
4745 w = ec->pre_res_change.w;
4746 h = ec->pre_res_change.h;
4751 if ((x + w) > (zx + zw))
4753 if ((y + h) > (zy + zh))
4755 evas_object_geometry_set(ec->frame, x, y, w, h);
4757 memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
4760 #ifdef REFACTOR_ZONE_DESK
4763 e_client_zone_set(E_Client *ec, E_Zone *zone)
4765 E_Event_Client_Zone_Set *ev;
4768 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4769 E_OBJECT_CHECK(zone);
4770 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
4771 if (e_zone_has_ec(zone, ec)) return;
4773 ev = E_NEW(E_Event_Client_Zone_Set, 1);
4776 /* if the window does not lie in the new zone, move it so that it does */
4777 if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
4781 x = ec->x, y = ec->y;
4783 /* keep window from hanging off bottom and left */
4784 if (x + ec->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + ec->w);
4785 if (y + ec->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + ec->h);
4787 /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
4788 if (x < zone->x) x = zone->x;
4789 if (y < zone->y) y = zone->y;
4791 if (!E_INTERSECTS(x, y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
4793 /* still not in zone at all, so just move it to closest edge */
4794 if (x < zone->x) x = zone->x;
4795 if (x >= zone->x + zone->w) x = zone->x + zone->w - ec->w;
4796 if (y < zone->y) y = zone->y;
4797 if (y >= zone->y + zone->h) y = zone->y + zone->h - ec->h;
4799 evas_object_move(ec->frame, x, y);
4802 // TODO: NEED TO DELETE LINE BELOW
4807 e_object_ref(E_OBJECT(ec));
4809 e_object_ref(E_OBJECT(zone));
4811 ecore_event_add(E_EVENT_CLIENT_ZONE_SET, ev, (Ecore_End_Cb)_e_client_event_zone_set_free, NULL);
4813 // TODO: change all use of e_client_zone_set() to e_zone_client_add()
4814 e_zone_client_add(zone, ec);
4819 e_client_pos_set(E_Client *ec, int x, int y)
4827 e_client_pos_get(E_Client *ec, int *x, int *y)
4843 e_client_size_set(E_Client *ec, int w, int h)
4851 e_client_size_get(E_Client *ec, int *w, int *h)
4867 e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
4875 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4877 if (e_client_transform_core_enable_get(ec))
4879 gx = ec->transform_core.result.boundary.x;
4880 gy = ec->transform_core.result.boundary.y;
4881 gw = ec->transform_core.result.boundary.w;
4882 gh = ec->transform_core.result.boundary.h;
4888 evas_object_geometry_get(ec->frame, &gx, &gy, &gw, &gh);
4889 if (gw == 0 && gh == 0)
4891 /* In this case, there is no image buffer in e_comp_object, thus it
4892 * should return geometry value of ec itself. It usually happens if
4893 * new ec is not mapped yet.
4917 e_client_above_get(const E_Client *ec)
4922 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
4923 if (EINA_INLIST_GET(ec)->next) //check current layer
4925 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
4929 ELOGF("FATAL", "CHECK the ec inlist next", ec);
4932 if (!e_object_is_del(E_OBJECT(ec2)))
4936 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
4937 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
4939 g_rec_mutex_lock(&e_comp->input_key_grabs_mutex);
4940 /* go up the layers until we find one */
4941 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
4943 if (!e_comp->layers[x].clients) continue;
4944 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
4948 ELOGF("FATAL", "EC exist above layer. ec layer_map:%d, cur layer_map:%d",
4949 ec, e_comp_canvas_layer_map(ec->layer), x);
4952 if (!e_object_is_del(E_OBJECT(ec2)))
4954 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
4959 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
4965 e_client_below_get(const E_Client *ec)
4970 E_Layer ec_layer, ec_layer_cw;
4973 E_OBJECT_CHECK_RETURN(ec, NULL);
4974 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
4976 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
4977 if (EINA_INLIST_GET(ec)->prev) //check current layer
4979 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
4981 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
4984 ELOGF("FATAL", "CHECK the ec inlist prev", ec);
4987 if (!e_object_is_del(E_OBJECT(ec2)))
4992 // check layer validation
4993 ec_layer = ec->layer;
4994 if (ec->layer_block || ec->layer_pending)
4996 cw_layer = e_comp_object_layer_get(ec->frame);
4999 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
5000 if (ec_layer != ec_layer_cw)
5002 ELOGF("COMP", "LAYER is not same. USE obj layer! (ec->layer:%d, obj:%d). block:%d, pending:%d)", ec, ec_layer, ec_layer_cw, ec->layer_block, ec->layer_pending);
5003 ec_layer = ec_layer_cw;
5008 if (ec_layer == E_LAYER_CLIENT_DESKTOP) return NULL;
5009 if (e_comp_canvas_client_layer_map(ec_layer) == 9999) return NULL;
5011 /* go down the layers until we find one */
5012 x = e_comp_canvas_layer_map(ec_layer);
5015 g_rec_mutex_lock(&e_comp->input_key_grabs_mutex);
5016 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
5018 if (!e_comp->layers[x].clients) continue;
5019 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
5023 ELOGF("FATAL", "EC exist below layer. ec layer_map:%d, cur layer_map:%d",
5024 ec, e_comp_canvas_layer_map(ec_layer), x);
5027 if (!e_object_is_del(E_OBJECT(ec2)))
5029 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5034 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5040 e_client_bottom_get(void)
5043 g_rec_mutex_lock(&e_comp->input_key_grabs_mutex);
5044 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
5048 if (!e_comp->layers[x].clients) continue;
5049 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
5050 if (!e_object_is_del(E_OBJECT(ec2)))
5052 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5056 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5062 e_client_top_get(void)
5065 g_rec_mutex_lock(&e_comp->input_key_grabs_mutex);
5066 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
5070 if (!e_comp->layers[x].clients) continue;
5071 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
5072 if (!e_object_is_del(E_OBJECT(ec2)))
5074 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5078 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5083 EINTERN unsigned int
5084 e_clients_count(void)
5086 return eina_list_count(e_comp->clients);
5091 * Set a callback which will be called just prior to updating the
5092 * move coordinates for a border
5095 e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
5097 ec->move_intercept_cb = cb;
5100 ///////////////////////////////////////
5102 E_API E_Client_Hook *
5103 e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
5107 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_HOOK_LAST, NULL);
5108 ch = E_NEW(E_Client_Hook, 1);
5109 if (!ch) return NULL;
5110 ch->hookpoint = hookpoint;
5112 ch->data = (void*)data;
5113 _e_client_hooks[hookpoint] = eina_inlist_append(_e_client_hooks[hookpoint], EINA_INLIST_GET(ch));
5118 e_client_hook_del(E_Client_Hook *ch)
5121 if (_e_client_hooks_walking == 0)
5123 _e_client_hooks[ch->hookpoint] = eina_inlist_remove(_e_client_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
5127 _e_client_hooks_delete++;
5130 ///////////////////////////////////////
5132 E_API E_Client_Intercept_Hook *
5133 e_client_intercept_hook_add(E_Client_Intercept_Hook_Point hookpoint, E_Client_Intercept_Hook_Cb func, const void *data)
5135 E_Client_Intercept_Hook *ch;
5137 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_INTERCEPT_HOOK_LAST, NULL);
5138 ch = E_NEW(E_Client_Intercept_Hook, 1);
5139 if (!ch) return NULL;
5140 ch->hookpoint = hookpoint;
5142 ch->data = (void*)data;
5143 _e_client_intercept_hooks[hookpoint] = eina_inlist_append(_e_client_intercept_hooks[hookpoint], EINA_INLIST_GET(ch));
5148 e_client_intercept_hook_del(E_Client_Intercept_Hook *ch)
5153 if (_e_client_intercept_hooks_walking == 0)
5155 _e_client_intercept_hooks[ch->hookpoint] =
5156 eina_inlist_remove(_e_client_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
5160 _e_client_intercept_hooks_delete++;
5163 #ifdef REFACTOR_FOCUS_POLICY
5166 e_client_focus_stack_lower(E_Client *ec)
5168 Eina_List *l = NULL;
5169 E_Client *ec2 = NULL;
5171 EINA_SAFETY_ON_NULL_RETURN(ec);
5173 focus_stack = eina_list_remove(focus_stack, ec);
5175 EINA_LIST_REVERSE_FOREACH(focus_stack, l, ec2)
5177 if (ec2 == NULL) continue;
5178 if (ec2->layer < ec->layer) continue;
5180 focus_stack = eina_list_append_relative_list(focus_stack, ec, l);
5184 focus_stack = eina_list_prepend(focus_stack, ec);
5190 e_client_focus_latest_set(E_Client *ec)
5192 EINA_SAFETY_ON_NULL_RETURN(ec);
5194 #ifdef REFACTOR_FOCUS_POLICY
5195 wl_signal_emit_mutable(&PRI(ec)->events.focus_latest_set, NULL);
5197 focus_stack = eina_list_remove(focus_stack, ec);
5198 focus_stack = eina_list_prepend(focus_stack, ec);
5202 #ifdef REFACTOR_FOCUS_POLICY
5205 e_client_focus_stack_append_current_focused(E_Client *ec)
5207 Eina_List *l = NULL;
5208 E_Client *temp_ec = NULL;
5210 if (!ec) CRI("ACK");
5212 focus_stack = eina_list_remove(focus_stack, ec);
5214 EINA_LIST_FOREACH(focus_stack, l, temp_ec)
5216 if (temp_ec != focused) continue;
5218 focus_stack = eina_list_append_relative_list(focus_stack, ec, l);
5222 focus_stack = eina_list_prepend(focus_stack, ec);
5228 e_client_focus_defer_set(E_Client *ec)
5230 EINA_SAFETY_ON_NULL_RETURN(ec);
5231 #ifdef REFACTOR_FOCUS_POLICY
5232 wl_signal_emit_mutable(&PRI(ec)->events.focus_defer_set, NULL);
5234 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5236 ELOGF("FOCUS", "focus defer set", ec);
5238 defer_focus_stack = eina_list_remove(defer_focus_stack, ec);
5239 defer_focus_stack = eina_list_prepend(defer_focus_stack, ec);
5243 #ifdef REFACTOR_FOCUS_POLICY
5246 e_client_focus_defer_unset(E_Client *ec)
5248 EINA_SAFETY_ON_NULL_RETURN(ec);
5249 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5251 ELOGF("FOCUS", "focus defer unset", ec);
5253 defer_focus_stack = eina_list_remove(defer_focus_stack, ec);
5257 e_client_focus_defer_clear(void)
5259 if (!defer_focus_stack) return;
5261 ELOGF("FOCUS", "focus defer clear", NULL);
5263 defer_focus_stack = eina_list_free(defer_focus_stack);
5267 e_client_refocus(void)
5273 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5275 EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec)
5277 desk = e_comp_desk_find_by_ec(ec);
5278 if (!desk) continue;
5279 if (desk->visible && (!ec->iconic))
5281 g_rec_mutex_lock(&e_comp->input_key_grabs_mutex);
5282 if (e_comp->input_key_grabs || e_comp->input_mouse_grabs)
5284 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5287 g_rec_mutex_unlock(&e_comp->input_key_grabs_mutex);
5288 ELOGF("FOCUS", "focus set | refocus", ec);
5289 e_client_frame_focus_set(ec, EINA_TRUE);
5297 * Sets the focus to the given client if necessary
5298 * There are 3 cases of different focus_policy-configurations:
5300 * - E_FOCUS_CLICK: just set the focus, the most simple one
5302 * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
5303 * warp the pointer to the window. If this fails (because
5304 * the pointer is already in the window), just set the focus.
5306 * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
5307 * last window which was focused, if the mouse is on the
5308 * desktop. So, we need to look if there is another window
5309 * under the pointer and warp to pointer to the right
5310 * one if so (also, we set the focus afterwards). In case
5311 * there is no window under pointer, the pointer is on the
5312 * desktop and so we just set the focus.
5315 * This function is to be called when setting the focus was not
5316 * explicitly triggered by the user (by moving the mouse or
5317 * clicking for example), but implicitly (by closing a window,
5318 * the last focused window should get focus).
5322 e_client_focus_set_with_pointer(E_Client *ec)
5325 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5326 /* note: this is here as it seems there are enough apps that do not even
5327 * expect us to emulate a look of focus but not actually set x input
5328 * focus as we do - so simply abort any focuse set on such windows */
5329 /* be strict about accepting focus hint */
5330 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5332 if ((!ec->icccm.accepts_focus) &&
5333 (!ec->icccm.take_focus)) return;
5334 if (ec->lock_focus_out) return;
5335 if (ec == focused) return;
5337 TRACE_DS_BEGIN(CLIENT:FOCUS SET WITH POINTER);
5338 ELOGF("FOCUS", "focus set | focus with pointer", ec);
5339 e_client_frame_focus_set(ec, EINA_TRUE);
5341 if (e_config->focus_policy == E_FOCUS_CLICK)
5357 e_client_focused_set(E_Client *ec)
5359 #ifdef REFACTOR_FOCUS_POLICY
5360 E_Client *focused_ec;
5364 ELOGF("FOCUS", "CLIENT FOCUSED_SET : SET", ec);
5366 ELOGF("FOCUS", "CLIENT FOCUSED_SET : UNSET", NULL);
5368 focused_ec = e_comp_focused_ec_get();
5369 if (ec == focused_ec) return;
5371 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
5373 // unset the current focused_ec if focused_ec is not being deleted
5376 if (!e_object_is_del(E_OBJECT(focused_ec)))
5378 // FIXME: Remove focus_unset event of client.
5379 // Instead, make zone focus_unset event and use it.
5380 wl_signal_emit_mutable(&PRI(focused_ec)->events.focus_unset, NULL);
5381 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, focused_ec);
5383 if (e_object_ref_get(E_OBJECT(focused_ec)) > 0)
5385 _e_client_event_simple(focused_ec, E_EVENT_CLIENT_FOCUS_OUT);
5386 e_client_urgent_set(focused_ec, focused_ec->icccm.urgent);
5391 // clear the current focused_ec when ec is NULL
5394 zone = e_comp_zone_find_by_ec(focused_ec);
5395 e_zone_focus_clear(zone);
5400 // FIXME: Remove focus_set event of client.
5401 // Instead, make zone focus_set event and use it.
5402 // set the new current focused_ec
5403 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, NULL);
5404 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
5406 // send the client_focuse_in event
5407 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
5409 #ifdef REFACTOR_ZONE_DESK
5411 // TODO: This is not for focus, but for Window Placement policy.
5412 // Move this code to the better place.
5413 if (ec->sticky && ec->desk && (!ec->desk->visible))
5414 e_client_desk_set(ec, e_desk_current_get(zone));
5419 E_Client *ec2, *ec_unfocus = focused;
5423 if (ec == focused) return;
5425 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
5427 ELOGF("FOCUS", "CLIENT FOCUS_SET", ec);
5429 g_mutex_lock(&focused_ec_mutex);
5431 g_mutex_unlock(&focused_ec_mutex);
5433 zone = e_comp_zone_find_by_ec(ec);
5437 e_client_urgent_set(ec, 0);
5438 int x, total = zone->desk_x_count * zone->desk_y_count;
5440 for (x = 0; x < total; x++)
5442 E_Desk *desk = zone->desks[x];
5443 /* if there's any fullscreen non-parents on this desk, unfullscreen them */
5444 EINA_LIST_FOREACH_SAFE(desk->fullscreen_clients, l, ll, ec2)
5446 if (ec2 == ec) continue;
5447 if (e_object_is_del(E_OBJECT(ec2))) continue;
5448 /* but only if it's the same desk or one of the clients is sticky */
5449 if ((e_desk_has_ec(desk, ec)) || (ec->sticky || ec2->sticky))
5451 if (!eina_list_data_find(ec->transients, ec2))
5452 e_client_unfullscreen(ec2);
5458 while ((ec_unfocus) && (ec_unfocus->zone))
5460 ec_unfocus->want_focus = ec_unfocus->focused = 0;
5461 if (ec_unfocus->mouse.in && ec && (!e_client_util_is_popup(ec)) &&
5462 (e_config->focus_policy != E_FOCUS_CLICK))
5463 e_client_mouse_out(ec_unfocus, ec_unfocus->x - 1, ec_unfocus->y - 1);
5465 /* if there unfocus client is fullscreen and visible */
5466 if ((ec_unfocus->fullscreen) && (!ec_unfocus->iconic) && (!ec_unfocus->hidden) &&
5467 (ec_unfocus->zone == e_zone_current_get()) &&
5468 ((ec_unfocus->desk == e_desk_current_get(ec_unfocus->zone)) || (ec_unfocus->sticky)))
5470 Eina_Bool have_vis_child = EINA_FALSE;
5472 /* if any of its children are visible */
5473 EINA_LIST_FOREACH(ec_unfocus->transients, l, ec2)
5475 if ((ec2->zone == ec_unfocus->zone) &&
5476 ((ec2->desk == ec_unfocus->desk) ||
5477 (ec2->sticky) || (ec_unfocus->sticky)))
5479 have_vis_child = EINA_TRUE;
5483 /* if no children are visible, unfullscreen */
5484 if ((!e_object_is_del(E_OBJECT(ec_unfocus))) && (!have_vis_child))
5485 e_client_unfullscreen(ec_unfocus);
5488 if (!e_object_is_del(E_OBJECT(ec_unfocus)))
5490 wl_signal_emit_mutable(&PRI(ec)->events.focus_unset, focused_ec);
5491 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, ec_unfocus);
5493 /* only send event here if we're not being deleted */
5494 if ((!e_object_is_del(E_OBJECT(ec_unfocus))) &&
5495 (e_object_ref_get(E_OBJECT(ec_unfocus)) > 0))
5497 _e_client_event_simple(ec_unfocus, E_EVENT_CLIENT_FOCUS_OUT);
5498 e_client_urgent_set(ec_unfocus, ec_unfocus->icccm.urgent);
5501 e_client_focus_defer_unset(ec_unfocus);
5510 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, ec);
5511 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
5513 e_client_focus_latest_set(ec);
5515 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
5517 #ifdef REFACTOR_ZONE_DESK
5519 if (ec->sticky && ec->desk && (!ec->desk->visible))
5520 e_client_desk_set(ec, e_desk_current_get(zone));
5528 e_client_activate(E_Client *ec)
5531 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5533 TRACE_DS_BEGIN(CLIENT:ACTIVATE);
5535 ELOGF("COMP", "Set launching flag..", ec);
5536 ec->launching = EINA_TRUE;
5538 ec->exp_iconify.not_raise = 0;
5542 if (!ec->lock_user_iconify)
5543 e_client_uniconify(ec);
5545 ELOGF("COMP", "Un-Set ICONIFY BY CLIENT", ec);
5546 ec->exp_iconify.by_client = 0;
5547 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
5549 #ifdef REFACTOR_ZONE_DESK
5551 if ((!ec->iconic) && (!ec->sticky))
5553 e_desk_show(ec->desk);
5555 if (!ec->lock_user_stacking)
5557 if (ec->shaded || ec->shading)
5558 e_client_unshade(ec, ec->shade_dir);
5561 #ifdef REFACTOR_FOCUS_POLICY
5562 // This code will be executed at E_CLIENT_HOOK_ACTIVATE_DONE callback at e_focus_policy_history.c
5564 if (!ec->lock_focus_out)
5566 E_Client *focus_ec = NULL;
5567 E_Client *obscured_above = NULL;
5570 focus_ec = e_client_transient_child_top_get(ec, EINA_TRUE);
5576 e_client_focus_latest_set(ec);
5577 e_client_focus_latest_set(focus_ec);
5578 e_client_focus_defer_unset(ec);
5581 obscured_above = e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
5582 if (!obscured_above)
5584 if (!e_policy_visibility_client_is_uniconic(ec))
5586 e_client_focus_defer_set(focus_ec);
5587 e_client_focus_latest_set(focus_ec);
5591 if (e_config->focus_policy_ext != E_FOCUS_EXT_TOP_STACK)
5593 ELOGF("FOCUS", "focus set | client activate", focus_ec);
5594 e_client_frame_focus_set(focus_ec, EINA_TRUE);
5600 e_client_focus_defer_set(focus_ec);
5601 e_client_focus_latest_set(focus_ec);
5606 #ifdef REFACTOR_ZONE_DESK
5608 if (!e_client_desk_iconify_skip_get(ec))
5610 e_desk_visible_client_iconified_list_remove_all(ec->desk);
5614 wl_signal_emit_mutable(&PRI(ec)->events.activate_done, NULL);
5615 _e_client_hook_call(E_CLIENT_HOOK_ACTIVATE_DONE, ec);
5621 e_client_focused_get(void)
5623 #ifdef REFACTOR_FOCUS_POLICY
5624 return e_comp_focused_ec_get();
5626 E_Client *focused_ec = NULL;
5628 g_mutex_lock(&focused_ec_mutex);
5629 focused_ec = focused;
5630 g_mutex_unlock(&focused_ec_mutex);
5636 #ifdef REFACTOR_FOCUS_POLICY
5639 e_client_focus_stack_get(void)
5645 e_client_defer_focus_stack_get(void)
5647 return defer_focus_stack;
5651 e_client_focus_stack_set(Eina_List *l)
5657 e_client_focus_stack_clear(void)
5659 if (!focus_stack) return;
5661 focus_stack = eina_list_free(focus_stack);
5666 e_client_lost_windows_get(E_Zone *zone)
5668 Eina_List *list = NULL;
5671 int loss_overlap = 5;
5673 E_OBJECT_CHECK_RETURN(zone, NULL);
5674 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
5675 EINA_LIST_FOREACH(e_comp->clients, l, ec)
5677 if (!e_zone_has_ec(zone, ec)) continue;
5678 if (e_client_util_ignored_get(ec)) continue;
5680 if (!E_INTERSECTS(zone->x + loss_overlap,
5681 zone->y + loss_overlap,
5682 zone->w - (2 * loss_overlap),
5683 zone->h - (2 * loss_overlap),
5684 ec->x, ec->y, ec->w, ec->h))
5686 list = eina_list_append(list, ec);
5692 ///////////////////////////////////////
5695 e_client_shade(E_Client *ec, E_Direction dir)
5698 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5699 if ((ec->shaded) || (ec->shading) || (ec->fullscreen) ||
5700 ((ec->maximized) && (!e_config->allow_manip))) return;
5701 if (!e_util_strcmp("borderless", ec->bordername)) return;
5702 if (!e_comp_object_frame_allowed(ec->frame)) return;
5706 ec->shade_dir = dir;
5708 evas_object_smart_callback_call(ec->frame, "shaded", (uintptr_t*)dir);
5712 e_client_unshade(E_Client *ec, E_Direction dir)
5715 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5716 if ((!ec->shaded) || (ec->shading))
5722 evas_object_smart_callback_call(ec->frame, "unshaded", (uintptr_t*)dir);
5725 ///////////////////////////////////////
5728 e_client_maximized_geometry_set(E_Client *ec, int x, int y, int w, int h)
5732 ec->maximized_info.x = x;
5733 ec->maximized_info.y = y;
5734 ec->maximized_info.w = w;
5735 ec->maximized_info.h = h;
5737 e_client_frame_geometry_set(ec, x, y, w, h);
5741 e_client_maximized_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5745 if (x) *x = ec->maximized_info.x;
5746 if (y) *y = ec->maximized_info.y;
5747 if (w) *w = ec->maximized_info.w;
5748 if (h) *h = ec->maximized_info.h;
5752 e_client_maximize_update(E_Client *ec)
5757 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5761 max = ec->maximized;
5763 e_client_maximize(ec, max);
5768 e_client_maximize(E_Client *ec, E_Maximize max)
5770 #ifdef REFACTOR_ZONE_DESK
5772 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5774 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
5776 if ((ec->shaded) || (ec->shading)) return;
5778 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
5780 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
5786 ec->changes.need_maximize = 1;
5787 ec->maximized &= ~E_MAXIMIZE_TYPE;
5788 ec->maximized |= max;
5793 // call the maximize hook of a client
5794 wl_signal_emit_mutable(&PRI(ec)->events.maximize, &max);
5796 // store the E_Maximize value
5797 ec->maximized = max;
5798 ec->changes.need_unmaximize = 0;
5800 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
5806 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5808 zone = e_comp_zone_find_by_ec(ec);
5810 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
5812 if ((ec->shaded) || (ec->shading)) return;
5814 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
5816 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
5822 ec->changes.need_maximize = 1;
5823 ec->maximized &= ~E_MAXIMIZE_TYPE;
5824 ec->maximized |= max;
5829 if (ec->desk_area.enable && ec->desk_area.desk_area)
5831 desk_x = ec->desk_area.desk_area->x;
5832 desk_y = ec->desk_area.desk_area->y;
5836 desk_x = ec->desk->geom.x;
5837 desk_y = ec->desk->geom.y;
5840 evas_object_smart_callback_call(ec->frame, "maximize_pre", NULL);
5843 e_client_unfullscreen(ec);
5844 ec->pre_res_change.valid = 0;
5845 if (!(ec->maximized & E_MAXIMIZE_HORIZONTAL))
5847 /* Horizontal hasn't been set */
5848 ec->saved.x = ec->client.x - desk_x;
5849 ec->saved.w = ec->client.w;
5851 if (!(ec->maximized & E_MAXIMIZE_VERTICAL))
5853 /* Vertical hasn't been set */
5854 ec->saved.y = ec->client.y - desk_y;
5855 ec->saved.h = ec->client.h;
5858 ec->saved.zone = zone->num;
5860 _e_client_maximize(ec, max);
5862 ec->maximized = max;
5863 ec->changes.need_unmaximize = 0;
5865 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
5870 e_client_unmaximize(E_Client *ec, E_Maximize max)
5872 #ifdef REFACTOR_ZONE_DESK
5874 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5876 if (!(max & E_MAXIMIZE_DIRECTION))
5878 CRI("BUG: Unmaximize call without direction!");
5883 ec->changes.need_unmaximize = 1;
5888 if ((ec->shaded) || (ec->shading)) return;
5890 /* Remove directions not used */
5891 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
5892 /* Can only remove existing maximization directions */
5895 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
5897 // call the unmaximize hook of a client
5898 wl_signal_emit_mutable(&PRI(ec)->events.unmaximize, &max);
5900 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
5901 ec->changes.need_unmaximize = 0;
5906 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5908 zone = e_comp_zone_find_by_ec(ec);
5910 if (!(max & E_MAXIMIZE_DIRECTION))
5912 CRI("BUG: Unmaximize call without direction!");
5917 ec->changes.need_unmaximize = 1;
5922 if ((ec->shaded) || (ec->shading)) return;
5924 /* Remove directions not used */
5925 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
5926 /* Can only remove existing maximization directions */
5929 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
5931 if (ec->maximized & E_MAXIMIZE_TYPE)
5933 ec->pre_res_change.valid = 0;
5934 ec->changes.need_maximize = 0;
5936 if ((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)
5938 E_Maximize tmp_max = ec->maximized;
5940 //un-set maximized state for updating frame.
5941 ec->maximized = E_MAXIMIZE_NONE;
5942 _e_client_frame_update(ec);
5943 // re-set maximized state for unmaximize smart callback.
5944 ec->maximized = tmp_max;
5945 evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
5946 // un-set maximized state.
5947 ec->maximized = E_MAXIMIZE_NONE;
5948 e_client_util_move_resize_without_frame(ec,
5949 ec->saved.x + zone->x,
5950 ec->saved.y + zone->y,
5951 ec->saved.w, ec->saved.h);
5952 ec->saved.x = ec->saved.y = ec->saved.w = ec->saved.h = 0;
5957 Eina_Bool horiz = EINA_FALSE, vert = EINA_FALSE;
5964 if (max & E_MAXIMIZE_VERTICAL)
5966 /* Remove vertical */
5969 y = ec->saved.y + zone->y;
5970 if ((max & E_MAXIMIZE_VERTICAL) == E_MAXIMIZE_VERTICAL)
5972 ec->maximized &= ~E_MAXIMIZE_VERTICAL;
5973 ec->maximized &= ~E_MAXIMIZE_LEFT;
5974 ec->maximized &= ~E_MAXIMIZE_RIGHT;
5976 if ((max & E_MAXIMIZE_LEFT) == E_MAXIMIZE_LEFT)
5977 ec->maximized &= ~E_MAXIMIZE_LEFT;
5978 if ((max & E_MAXIMIZE_RIGHT) == E_MAXIMIZE_RIGHT)
5979 ec->maximized &= ~E_MAXIMIZE_RIGHT;
5981 if (max & E_MAXIMIZE_HORIZONTAL)
5983 /* Remove horizontal */
5985 x = ec->saved.x + zone->x;
5987 ec->maximized &= ~E_MAXIMIZE_HORIZONTAL;
5990 if (!(ec->maximized & E_MAXIMIZE_DIRECTION))
5992 ec->maximized = E_MAXIMIZE_NONE;
5993 _e_client_frame_update(ec);
5994 evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
5995 e_client_resize_limit(ec, &w, &h);
5996 e_client_pos_set(ec, x, y);
5997 if ((ec->saved.w != 0) && (ec->saved.h != 0))
5999 if ((w != ec->saved.w) || (h != ec->saved.h))
6001 e_policy_visibility_client_defer_move(ec);
6007 evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
6008 e_client_resize_limit(ec, &w, &h);
6009 e_client_pos_set(ec, x, y);
6010 if ((ec->saved.w != 0) && (ec->saved.h != 0))
6012 if ((w != ec->saved.w) || (h != ec->saved.h))
6014 e_policy_visibility_client_defer_move(ec);
6019 ec->saved.h = ec->saved.y = 0;
6021 ec->saved.w = ec->saved.x = 0;
6024 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
6025 ec->changes.need_unmaximize = 0;
6030 e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
6032 #ifdef REFACTOR_ZONE_DESK
6034 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6036 if ((ec->shaded) || (ec->shading) || (ec->fullscreen)) return;
6038 // call the fullscreen_pre hook of a client
6039 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
6040 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
6042 // call the fullscreen hook of a client
6043 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
6045 ec->fullscreen_policy = policy;
6047 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
6053 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6055 zone = e_comp_zone_find_by_ec(ec);
6058 if ((ec->shaded) || (ec->shading) || (ec->fullscreen)) return;
6060 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
6061 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
6063 if (ec->skip_fullscreen) return;
6064 if (!ec->desk->visible) return;
6067 ec->need_fullscreen = 1;
6070 if (e_comp->nocomp_ec && (ec->desk == e_comp->nocomp_ec->desk))
6071 e_comp->nocomp_ec = ec;
6072 ec->desk->fullscreen_clients = eina_list_append(ec->desk->fullscreen_clients, ec);
6073 ec->pre_res_change.valid = 0;
6084 ec->saved.x = ec->client.x - zone->x;
6085 ec->saved.y = ec->client.y - zone->y;
6086 ec->saved.w = ec->client.w;
6087 ec->saved.h = ec->client.h;
6089 ec->saved.maximized = ec->maximized;
6090 ec->saved.zone = zone->num;
6094 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
6101 ec->saved.layer = ec->layer;
6102 e_client_layer_set(ec, E_LAYER_CLIENT_FULLSCREEN);
6105 if ((eina_list_count(e_comp->zones) > 1) ||
6106 (policy == E_FULLSCREEN_RESIZE))
6108 e_client_frame_geometry_set(ec, zone->x, zone->y, zone->w, zone->h);
6110 else if (policy == E_FULLSCREEN_ZOOM)
6112 /* compositor backends! */
6113 evas_object_smart_callback_call(ec->frame, "fullscreen_zoom", NULL);
6116 if (!e_client_util_ignored_get(ec))
6117 _e_client_frame_update(ec);
6118 ec->fullscreen_policy = policy;
6119 evas_object_smart_callback_call(ec->frame, "fullscreen", NULL);
6121 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
6122 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
6127 e_client_unfullscreen(E_Client *ec)
6129 #ifdef REFACTOR_ZONE_DESK
6131 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6133 if ((ec->shaded) || (ec->shading)) return;
6134 if (!ec->fullscreen) return;
6136 // call the unfullscreen hook of a client
6137 wl_signal_emit_mutable(&PRI(ec)->events.unfullscreen, NULL);
6139 ec->fullscreen_policy = E_FULLSCREEN_RESIZE;
6141 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
6146 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6148 zone = e_comp_zone_find_by_ec(ec);
6150 if ((ec->shaded) || (ec->shading)) return;
6151 if (!ec->fullscreen) return;
6152 ec->pre_res_change.valid = 0;
6154 ec->need_fullscreen = 0;
6155 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
6157 if (ec->fullscreen_policy == E_FULLSCREEN_ZOOM)
6158 evas_object_smart_callback_call(ec->frame, "unfullscreen_zoom", NULL);
6160 if (!e_client_util_ignored_get(ec))
6161 _e_client_frame_update(ec);
6162 ec->fullscreen_policy = 0;
6163 evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
6164 e_client_util_move_resize_without_frame(ec, zone->x + ec->saved.x,
6165 zone->y + ec->saved.y,
6166 ec->saved.w, ec->saved.h);
6168 if (ec->saved.maximized)
6169 e_client_maximize(ec, (ec->maximize_type & E_MAXIMIZE_TYPE) |
6170 ec->saved.maximized);
6172 e_client_layer_set(ec, ec->saved.layer);
6174 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
6176 if (!ec->desk->fullscreen_clients)
6177 e_comp_render_queue();
6181 ///////////////////////////////////////
6182 #ifdef REFACTOR_ZONE_DESK
6184 e_client_is_parent_iconify_by_client(E_Client *ec)
6187 _e_client_is_parent_iconify_by_client(E_Client *ec)
6190 E_Client *parent = ec->parent;
6191 if (!parent) return EINA_FALSE;
6193 if ((parent->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) ||
6194 (parent->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT))
6201 e_client_iconify(E_Client *ec)
6204 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6206 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6207 Eina_Bool iconified_by_client = e_client_is_iconified_by_client(ec);
6209 ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d",
6210 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6211 ec->exp_iconify.by_client, ec->exp_iconify.type);
6213 if (ec->shading || ec->iconic) return;
6214 if (ec->exp_iconify.skip_iconify && !iconified_by_client) return;
6215 if (ec->exp_iconify.skip_by_remote) return;
6216 if (!cdata || !cdata->mapped)
6218 if (!iconified_by_client)
6220 ELOGF("TZVIS", "Not mapped.. So, don't iconify", ec);
6225 ELOGF("TZVIS", "Not mapped.. But, iconify by user request", ec);
6229 TRACE_DS_BEGIN(CLIENT:ICONIFY);
6231 #ifdef REFACTOR_ZONE_DESK
6233 e_comp_wl_remote_surface_image_save(ec);
6236 ec->want_focus = ec->take_focus = 0;
6237 ec->changes.visible = 0;
6239 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
6240 e_client_comp_hidden_set(ec, 1);
6241 evas_object_hide(ec->frame);
6242 e_client_urgent_set(ec, ec->icccm.urgent);
6244 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
6246 if (e_config->transient.iconify)
6249 Eina_List *list = eina_list_clone(ec->transients);
6251 EINA_LIST_FREE(list, child)
6253 if ((child->exp_iconify.type != E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) &&
6254 (_e_client_is_parent_iconify_by_client(child)))
6256 e_client_iconified_type_set(child, E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT);
6257 child->exp_iconify.by_client = 1;
6258 e_policy_client_iconic_state_change_send(child, 1);
6260 e_client_iconify(child);
6266 wl_signal_emit_mutable(&PRI(ec)->events.iconify, NULL);
6267 _e_client_hook_call(E_CLIENT_HOOK_ICONIFY, ec);
6273 e_client_uniconify(E_Client *ec)
6275 #ifdef REFACTOR_ZONE_DESK
6276 E_Comp_Wl_Client_Data *cdata;
6279 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6281 cdata = e_client_cdata_get(ec);
6283 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
6284 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6285 ec->exp_iconify.by_client, ec->exp_iconify.type,
6286 cdata ? cdata->mapped : 0);
6288 if (ec->shading || (!ec->iconic)) return;
6290 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
6292 // call the uniconify hook of a client
6293 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
6294 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
6299 Eina_Bool not_raise;
6302 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6304 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6306 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
6307 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6308 ec->exp_iconify.by_client, ec->exp_iconify.type,
6309 cdata ? cdata->mapped : 0);
6311 if (ec->shading || (!ec->iconic)) return;
6313 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
6315 e_comp_wl_remote_surface_image_save_cancel(ec);
6317 desk = e_desk_current_get(ec->desk->zone);
6318 e_client_desk_set(ec, desk);
6319 not_raise = ec->exp_iconify.not_raise;
6321 ec->exp_iconify.by_client = 0;
6322 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
6324 if (e_config->transient.iconify)
6327 Eina_List *list = eina_list_clone(ec->transients);
6329 EINA_LIST_FREE(list, child)
6331 if (e_client_transient_policy_get(child) == E_TRANSIENT_BELOW)
6333 child->exp_iconify.not_raise = not_raise;
6334 e_client_uniconify(child);
6344 ELOGF("TZVIS", "UNICONIFY|internal object force show", ec);
6345 evas_object_show(ec->frame);
6350 if (e_pixmap_usable_get(ec->pixmap))
6352 if (cdata && cdata->mapped)
6354 ELOGF("TZVIS", "UNICONIFY|object show. frame_visible:%d", ec, evas_object_visible_get(ec->frame));
6355 evas_object_show(ec->frame);
6359 ELOGF("TZVIS", "UNICONIFY|object no show. currently unmapped", ec);
6364 if (!ec->exp_iconify.buffer_flush &&
6365 !ec->exp_iconify.deiconify_update)
6367 if (cdata && cdata->mapped)
6369 ELOGF("TZVIS", "UNICONIFY|object show. no use buffer flush. frame_visible:%d", ec, evas_object_visible_get(ec->frame));
6370 evas_object_show(ec->frame);
6375 e_client_comp_hidden_set(ec, 0);
6376 ec->deskshow = ec->iconic = 0;
6378 #if 0 // focus should be set to the top window not uniconify window
6379 if (ec->pixmap && e_pixmap_usable_get(ec->pixmap))
6380 e_client_frame_focus_set(ec, EINA_TRUE);
6383 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
6385 if (e_config->transient.iconify)
6388 Eina_List *list = eina_list_clone(ec->transients);
6390 EINA_LIST_FREE(list, child)
6392 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
6394 if (child->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
6395 e_policy_client_iconic_state_change_send(child, 0);
6396 child->exp_iconify.not_raise = not_raise;
6397 e_client_uniconify(child);
6402 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
6403 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
6405 ec->exp_iconify.not_raise = 0;
6412 e_client_iconified_type_set(E_Client *ec, E_Iconified_Type type)
6415 ec->exp_iconify.type = type;
6418 EINTERN E_Iconified_Type
6419 e_client_iconified_type_get(E_Client *ec)
6421 if (!ec) return E_ICONIFIED_TYPE_NONE;
6422 return ec->exp_iconify.type;
6425 E_API Eina_Bool e_client_is_iconified_by_client(E_Client *ec)
6427 if (!ec) return EINA_FALSE;
6429 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT)
6432 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_DESK_ICONIFY_BY_CLIENT)
6435 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
6438 if (ec->exp_iconify.by_client)
6440 ELOGF("POL", "CHECK. mismatch value. by_client:%d, type:%d", ec, ec->exp_iconify.by_client, ec->exp_iconify.type);
6447 ///////////////////////////////////////
6450 e_client_urgent_set(E_Client *ec, Eina_Bool urgent)
6453 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6456 if (urgent == ec->urgent) return;
6457 _e_client_event_property(ec, E_CLIENT_PROPERTY_URGENCY);
6458 if (urgent && (!ec->focused) && (!ec->want_focus))
6460 e_comp_object_signal_emit(ec->frame, "e,state,urgent", "e");
6461 ec->urgent = urgent;
6465 e_comp_object_signal_emit(ec->frame, "e,state,not_urgent", "e");
6470 ///////////////////////////////////////
6473 e_client_stick(E_Client *ec)
6475 #ifdef REFACTOR_ZONE_DESK
6477 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6478 if (ec->sticky) return;
6480 // call the stick hook of a client
6481 wl_signal_emit_mutable(&PRI(ec)->events.stick, NULL);
6483 // send the sticky property event of a client
6484 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6489 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6490 if (ec->sticky) return;
6495 e_client_desk_set(ec, desk);
6496 evas_object_smart_callback_call(ec->frame, "stick", NULL);
6498 if (e_config->transient.desktop)
6501 Eina_List *list = eina_list_clone(ec->transients);
6503 EINA_LIST_FREE(list, child)
6506 evas_object_show(ec->frame);
6510 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6515 e_client_unstick(E_Client *ec)
6517 #ifdef REFACTOR_ZONE_DESK
6519 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6521 if (!ec->sticky) return;
6523 // call the unstick hook of a client
6524 wl_signal_emit_mutable(&PRI(ec)->events.unstick, NULL);
6526 // send the sticky property event of a client
6527 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6533 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6534 /* Set the desk before we unstick the client */
6535 if (!ec->sticky) return;
6537 zone = e_comp_zone_find_by_ec(ec);
6538 desk = e_desk_current_get(zone);
6540 ec->hidden = ec->sticky = 0;
6541 e_client_desk_set(ec, desk);
6542 evas_object_smart_callback_call(ec->frame, "unstick", NULL);
6544 if (e_config->transient.desktop)
6547 Eina_List *list = eina_list_clone(ec->transients);
6549 EINA_LIST_FREE(list, child)
6555 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6557 e_client_desk_set(ec, e_desk_current_get(zone));
6562 e_client_pinned_set(E_Client *ec, Eina_Bool set)
6566 EINA_SAFETY_ON_NULL_RETURN(ec);
6568 layer = E_LAYER_CLIENT_ABOVE;
6570 layer = E_LAYER_CLIENT_NORMAL;
6572 e_client_layer_set(ec, layer);
6577 ///////////////////////////////////////
6580 e_client_border_set(E_Client *ec, const char *name)
6582 Eina_Stringshare *pborder;
6584 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6585 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6586 if (!e_comp_object_frame_allowed(ec->frame)) return EINA_FALSE;
6587 if (ec->border.changed)
6588 CRI("CALLING WHEN border.changed SET!");
6590 if (!e_util_strcmp(ec->border.name, name)) return EINA_TRUE;
6591 if (ec->mwm.borderless && name && strcmp(name, "borderless"))
6593 CRI("border change attempted for MWM borderless client!");
6595 pborder = ec->border.name;
6596 ec->border.name = eina_stringshare_add(name);
6597 if (e_comp_object_frame_theme_set(ec->frame, name))
6599 eina_stringshare_del(pborder);
6602 eina_stringshare_del(ec->border.name);
6603 ec->border.name = pborder;
6607 ///////////////////////////////////////
6610 e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
6613 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6616 if (ec->comp_hidden == hidden) return;
6617 ec->comp_hidden = hidden;
6618 evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
6621 ///////////////////////////////////////
6624 e_client_act_move_keyboard(E_Client *ec)
6626 EINA_SAFETY_ON_NULL_RETURN(ec);
6628 if (!_e_client_move_begin(ec))
6631 _e_client_action_init(ec);
6632 _e_client_action_move_timeout_add();
6634 wl_signal_emit_mutable(&PRI(ec)->events.move_update, NULL);
6635 if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
6636 evas_object_freeze_events_set(ec->frame, 1);
6638 if (!action_handler_mouse)
6639 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
6643 e_client_act_resize_keyboard(E_Client *ec)
6645 EINA_SAFETY_ON_NULL_RETURN(ec);
6647 ec->resize_mode = E_POINTER_RESIZE_TL;
6648 ec->keyboard_resizing = 1;
6649 if (!e_client_resize_begin(ec))
6651 ec->keyboard_resizing = 0;
6655 _e_client_action_init(ec);
6656 _e_client_action_resize_timeout_add();
6657 evas_object_freeze_events_set(ec->frame, 1);
6659 if (!action_handler_mouse)
6660 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
6664 e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
6667 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6668 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6673 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
6674 _e_client_moveinfo_gather(ec, source);
6676 if (!_e_client_move_begin(ec))
6679 _e_client_action_init(ec);
6683 e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
6686 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6687 if (!ec->moving) return;
6688 _e_client_move_end(ec);
6689 _e_client_action_finish();
6693 e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, E_Pointer_Mode resize_mode)
6696 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6697 if (ec->lock_user_size || ec->shaded || ec->shading) return;
6698 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6702 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
6703 _e_client_moveinfo_gather(ec, source);
6705 if (resize_mode != E_POINTER_RESIZE_NONE)
6707 ec->resize_mode = resize_mode;
6711 /* Use canvas.x, canvas.y of event.
6712 * Transformed coordinates has to be considered for accurate resize_mode
6713 * rather than absolute coordinates. */
6714 if ((ev->canvas.x > (ec->x + ec->w / 5)) &&
6715 (ev->canvas.x < (ec->x + ec->w * 4 / 5)))
6717 if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_T;
6718 else ec->resize_mode = E_POINTER_RESIZE_B;
6720 else if (ev->canvas.x < (ec->x + ec->w / 2))
6722 if ((ev->canvas.y > (ec->y + ec->h / 5)) && (ev->canvas.y < (ec->y + ec->h * 4 / 5))) ec->resize_mode = E_POINTER_RESIZE_L;
6723 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TL;
6724 else ec->resize_mode = E_POINTER_RESIZE_BL;
6728 if ((ev->canvas.y > (ec->y + ec->h / 5)) && (ev->canvas.y < (ec->y + ec->h * 4 / 5))) ec->resize_mode = E_POINTER_RESIZE_R;
6729 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TR;
6730 else ec->resize_mode = E_POINTER_RESIZE_BR;
6734 if (!e_client_resize_begin(ec))
6736 _e_client_action_init(ec);
6740 e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
6743 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6744 if (e_client_util_resizing_get(ec))
6746 _e_client_resize_end(ec);
6747 ec->changes.reset_gravity = 1;
6748 if (!e_object_is_del(E_OBJECT(ec)))
6751 _e_client_action_finish();
6755 e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
6758 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6762 e_client_act_close_begin(E_Client *ec)
6765 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6766 if (ec->lock_close) return;
6767 if (ec->icccm.delete_request)
6769 ec->delete_requested = 1;
6770 evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
6772 else if (e_config->kill_if_close_not_possible)
6774 e_client_act_kill_begin(ec);
6779 e_client_act_kill_begin(E_Client *ec)
6782 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6783 if (ec->internal) return;
6784 if (ec->lock_close) return;
6785 if ((ec->netwm.pid > 1) && (e_config->kill_process))
6787 kill(ec->netwm.pid, SIGINT);
6788 ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
6789 _e_client_cb_kill_timer, ec);
6792 evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
6795 ////////////////////////////////////////////
6798 e_client_ping(E_Client *ec)
6801 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6803 if (!e_config->ping_clients) return;
6805 EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
6808 evas_object_smart_callback_call(ec->frame, "ping", NULL);
6809 ec->ping = ecore_loop_time_get();
6810 if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
6811 ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
6812 e_config->ping_clients_interval,
6813 _e_client_cb_ping_poller, ec);
6816 ////////////////////////////////////////////
6818 e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y)
6820 // TODO: remove(deprecate) this e_client_cursor_map_apply.
6824 e_client_move_cancel(void)
6826 if (!ecmove) return;
6827 if (ecmove->cur_mouse_action)
6832 e_object_ref(E_OBJECT(ec));
6833 if (ec->cur_mouse_action->func.end_mouse)
6834 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
6835 else if (ec->cur_mouse_action->func.end)
6836 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
6837 e_object_unref(E_OBJECT(ec->cur_mouse_action));
6838 ec->cur_mouse_action = NULL;
6839 e_object_unref(E_OBJECT(ec));
6842 _e_client_move_end(ecmove);
6846 e_client_resize_cancel(void)
6848 if (!ecresize) return;
6849 if (ecresize->cur_mouse_action)
6854 e_object_ref(E_OBJECT(ec));
6855 if (ec->cur_mouse_action->func.end_mouse)
6856 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
6857 else if (ec->cur_mouse_action->func.end)
6858 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
6859 e_object_unref(E_OBJECT(ec->cur_mouse_action));
6860 ec->cur_mouse_action = NULL;
6861 e_object_unref(E_OBJECT(ec));
6864 _e_client_resize_end(ecresize);
6868 e_client_resize_begin(E_Client *ec)
6870 if ((ec->shaded) || (ec->shading) ||
6871 (ec->fullscreen) || (ec->lock_user_size))
6873 if (!_e_client_action_input_win_new()) goto error;
6875 if (ec->manage_resize.enable_aspect_ratio)
6877 ELOGF("RESIZE", "Set resize aspect ratio.. ratio(%dx%d)", ec, ec->w, ec->h);
6878 ec->manage_resize.aw = ec->w;
6879 ec->manage_resize.ah = ec->h - ec->manage_resize.header_h - ec->manage_resize.footer_h;
6882 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
6883 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
6884 if (ec->transformed)
6885 _e_client_transform_resize_begin(ec);
6886 if (!e_client_util_resizing_get(ec))
6888 if (ecresize == ec) ecresize = NULL;
6889 _e_client_action_input_win_del();
6892 if (!ec->lock_user_stacking)
6894 if (e_config->border_raise_on_mouse_action)
6899 e_comp_client_override_add(ec);
6903 ec->resize_mode = E_POINTER_RESIZE_NONE;
6908 ////////////////////////////////////////////
6911 e_client_frame_recalc(E_Client *ec)
6913 EINA_SAFETY_ON_NULL_RETURN(ec);
6914 if (!ec->frame) return;
6915 evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
6918 ////////////////////////////////////////////
6921 e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
6924 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6926 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6927 _e_client_moveinfo_gather(ec, sig);
6928 if (!_e_client_move_begin(ec)) return;
6932 e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
6935 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6936 if (!ec->moving) return;
6937 _e_client_move_end(ec);
6941 e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
6943 int resize_mode = E_POINTER_RESIZE_BR;
6946 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6948 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6949 if (!strcmp(dir, "tl"))
6951 resize_mode = E_POINTER_RESIZE_TL;
6953 else if (!strcmp(dir, "t"))
6955 resize_mode = E_POINTER_RESIZE_T;
6957 else if (!strcmp(dir, "tr"))
6959 resize_mode = E_POINTER_RESIZE_TR;
6961 else if (!strcmp(dir, "r"))
6963 resize_mode = E_POINTER_RESIZE_R;
6965 else if (!strcmp(dir, "br"))
6967 resize_mode = E_POINTER_RESIZE_BR;
6969 else if (!strcmp(dir, "b"))
6971 resize_mode = E_POINTER_RESIZE_B;
6973 else if (!strcmp(dir, "bl"))
6975 resize_mode = E_POINTER_RESIZE_BL;
6977 else if (!strcmp(dir, "l"))
6979 resize_mode = E_POINTER_RESIZE_L;
6981 ec->resize_mode = resize_mode;
6982 _e_client_moveinfo_gather(ec, sig);
6983 if (!e_client_resize_begin(ec))
6988 e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
6991 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6992 if (!e_client_util_resizing_get(ec)) return;
6993 _e_client_resize_handle(ec);
6994 _e_client_resize_end(ec);
6995 ec->changes.reset_gravity = 1;
6999 ////////////////////////////////////////////
7002 e_client_resize_limit(E_Client *ec, int *w, int *h)
7008 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7010 inc_h = (*h - ec->h > 0);
7012 e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
7015 if ((ec->icccm.base_w >= 0) &&
7016 (ec->icccm.base_h >= 0))
7020 tw = *w - ec->icccm.base_w;
7021 th = *h - ec->icccm.base_h;
7024 a = (double)(tw) / (double)(th);
7025 if ((ec->icccm.min_aspect != 0.0) &&
7026 (a < ec->icccm.min_aspect))
7029 tw = th * ec->icccm.min_aspect;
7031 th = tw / ec->icccm.max_aspect;
7032 *w = tw + ec->icccm.base_w;
7033 *h = th + ec->icccm.base_h;
7035 else if ((ec->icccm.max_aspect != 0.0) &&
7036 (a > ec->icccm.max_aspect))
7038 tw = th * ec->icccm.max_aspect;
7039 *w = tw + ec->icccm.base_w;
7044 a = (double)*w / (double)*h;
7045 if ((ec->icccm.min_aspect != 0.0) &&
7046 (a < ec->icccm.min_aspect))
7049 *w = *h * ec->icccm.min_aspect;
7051 *h = *w / ec->icccm.min_aspect;
7053 else if ((ec->icccm.max_aspect != 0.0) &&
7054 (a > ec->icccm.max_aspect))
7055 *w = *h * ec->icccm.max_aspect;
7057 if (ec->icccm.step_w > 0)
7059 if (ec->icccm.base_w >= 0)
7060 *w = ec->icccm.base_w +
7061 (((*w - ec->icccm.base_w) / ec->icccm.step_w) *
7064 *w = ec->icccm.min_w +
7065 (((*w - ec->icccm.min_w) / ec->icccm.step_w) *
7068 if (ec->icccm.step_h > 0)
7070 if (ec->icccm.base_h >= 0)
7071 *h = ec->icccm.base_h +
7072 (((*h - ec->icccm.base_h) / ec->icccm.step_h) *
7075 *h = ec->icccm.min_h +
7076 (((*h - ec->icccm.min_h) / ec->icccm.step_h) *
7083 if ((ec->icccm.max_w > 0) && (*w > ec->icccm.max_w)) *w = ec->icccm.max_w;
7084 else if (*w < ec->icccm.min_w)
7085 *w = ec->icccm.min_w;
7086 if ((ec->icccm.max_h > 0) && (*h > ec->icccm.max_h)) *h = ec->icccm.max_h;
7087 else if (*h < ec->icccm.min_h)
7088 *h = ec->icccm.min_h;
7091 e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
7094 ////////////////////////////////////////////
7099 e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
7103 /* We need to ensure that we can get the comp window for the
7104 * zone of either the given desk or the desk of the excluded
7105 * window, so return if neither is given */
7107 e_input_device_pointer_xy_get(NULL, &x, &y);
7109 e_input_device_pointer_xy_get(NULL, &x, &y);
7115 desk = exclude->desk;
7119 desk = e_desk_current_get(exclude->zone);
7121 desk = e_desk_current_get(e_zone_current_get());
7125 return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
7128 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
7130 if (!desk) return NULL;
7132 return _e_client_under_pointer_helper(desk, exclude, x, y);
7135 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
7137 if (!desk) return NULL;
7139 return _e_client_under_pointer_input_helper(desk, x, y);
7143 e_client_input_rect_under_pointer_get(E_Desk *desk, E_Client *exclude)
7147 /* We need to ensure that we can get the comp window for the
7148 * zone of either the given desk or the desk of the excluded
7149 * window, so return if neither is given */
7151 e_input_device_pointer_xy_get(NULL, &x, &y);
7153 e_input_device_pointer_xy_get(NULL, &x, &y);
7159 desk = exclude->desk;
7163 desk = e_desk_current_get(exclude->zone);
7165 desk = e_desk_current_get(e_zone_current_get());
7169 return desk ? _e_client_input_rect_under_pointer_helper(desk, exclude, x, y) : NULL;
7172 ////////////////////////////////////////////
7174 ////////////////////////////////////////////
7177 e_client_redirected_set(E_Client *ec, Eina_Bool set)
7179 EINA_SAFETY_ON_NULL_RETURN(ec);
7180 if (ec->input_only) return;
7182 if (ec->redirected == set) return;
7185 e_client_frame_recalc(ec);
7187 wl_signal_emit_mutable(&PRI(ec)->events.redirect, NULL);
7188 if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
7192 wl_signal_emit_mutable(&PRI(ec)->events.unredirect, NULL);
7193 if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
7195 e_comp_object_redirected_set(ec->frame, set);
7196 ec->redirected = !!set;
7199 ////////////////////////////////////////////
7202 e_client_is_stacking(const E_Client *ec)
7204 return e_comp->layers[e_comp_canvas_layer_map(ec->layer)].obj == ec->frame;
7207 ////////////////////////////////////////////
7210 e_client_transform_update(E_Client *ec)
7212 if (e_client_util_resizing_get(ec))
7213 _e_client_transform_resize(ec);
7216 ////////////////////////////////////////////
7219 e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy)
7222 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
7226 if (e_comp_wl_subsurface_check(ec))
7229 /* check if it's different with current state */
7230 if ((ec->transform.angle == angle) &&
7231 (ec->transform.zoom == zoom) &&
7232 (ec->transform.center.x == cx) &&
7233 (ec->transform.center.y == cy))
7236 /* use previous value if any required value is invalid */
7238 angle = ec->transform.angle;
7240 zoom = ec->transform.zoom;
7241 if (!E_INSIDE(cx, cy,
7242 ec->client.x, ec->client.y,
7243 ec->client.w, ec->client.h))
7245 cx = ec->transform.center.x;
7246 cy = ec->transform.center.y;
7249 if ((angle == 0) && (zoom == 1.0))
7251 e_client_transform_clear(ec);
7255 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
7256 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
7258 e_map_util_rotate(map, angle, cx, cy);
7259 _e_client_transform_geometry_save(ec, map);
7261 e_map_util_zoom(map, zoom, zoom, cx, cy);
7263 e_map_util_object_move_sync_set(map, EINA_TRUE);
7264 e_client_map_set(ec, map);
7265 e_client_map_enable_set(ec, EINA_TRUE);
7267 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
7268 _e_client_transform_sub_apply(subc, ec, zoom);
7269 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
7270 _e_client_transform_sub_apply(subc, ec, zoom);
7274 ec->transform.zoom = zoom;
7275 ec->transform.angle = angle;
7276 ec->transform.center.x = cx;
7277 ec->transform.center.y = cy;
7278 ec->transformed = EINA_TRUE;
7281 ////////////////////////////////////////////
7284 e_client_transform_clear(E_Client *ec)
7286 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
7290 e_client_map_enable_set(ec, EINA_FALSE);
7291 e_client_map_set(ec, NULL);
7293 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
7294 _e_client_transform_sub_apply(subc, ec, 1.0);
7295 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
7296 _e_client_transform_sub_apply(subc, ec, 1.0);
7298 ec->transform.zoom = 1.0;
7299 ec->transform.angle = 0.0;
7300 ec->transformed = EINA_FALSE;
7304 e_client_transform_core_enable_get(E_Client *ec)
7306 if (!ec) return EINA_FALSE;
7307 return ec->transform_core.result.enable;
7311 e_client_transform_core_add(E_Client *ec, E_Util_Transform *transform)
7314 if (!transform) return;
7316 // duplication check
7317 if (ec->transform_core.transform_list &&
7318 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
7323 ec->transform_core.transform_list = eina_list_append(ec->transform_core.transform_list, transform);
7324 ec->transform_core.changed = EINA_TRUE;
7325 e_util_transform_ref(transform);
7326 // e_client_transform_core_update(ec);
7330 e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform)
7333 if (!transform) return;
7335 if (ec->transform_core.transform_list &&
7336 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
7338 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
7339 e_util_transform_unref(transform);
7340 ec->transform_core.changed = EINA_TRUE;
7343 e_client_transform_core_update(ec);
7347 e_client_transform_core_update(E_Client *ec)
7350 if (ec->new_client) return;
7351 if (!_e_client_transform_core_check_change(ec)) return;
7353 if (ec->transform_core.transform_list || ec->transform_core.parent.enable)
7355 E_Util_Transform_Rect source_rect;
7356 E_Util_Transform_Matrix matrix, boundary_matrix;
7357 E_Util_Transform_Zoom zoom;
7359 Eina_Bool background;
7360 E_Util_Transform *temp_trans;
7363 ec->transform_core.result.enable = EINA_TRUE;
7364 e_util_transform_rect_client_rect_get(&source_rect, ec);
7365 e_util_transform_init(&ec->transform_core.result.transform);
7367 // 2. merge transform
7368 EINA_LIST_FOREACH(ec->transform_core.transform_list, l, temp_trans)
7370 e_util_transform_merge(&ec->transform_core.result.transform, temp_trans);
7372 zoom = ec->transform_core.result.transform.zoom;
7374 // 2.5 check viewport
7375 if (e_util_transform_viewport_flag_get(&ec->transform_core.result.transform))
7377 int vx = 0, vy = 0, vw = 0, vh = 0;
7378 e_util_transform_viewport_get(&ec->transform_core.result.transform, &vx, &vy, &vw, &vh);
7379 e_util_transform_rect_init(&source_rect, vx, vy, vw, vh);
7382 // 3. apply background transform
7383 matrix = e_util_transform_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
7385 if (e_util_transform_bg_transform_flag_get(&ec->transform_core.result.transform))
7387 boundary_matrix = e_util_transform_bg_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
7388 background = EINA_TRUE;
7392 background = EINA_FALSE;
7393 boundary_matrix = matrix;
7396 if (background != ec->transform_core.background)
7400 e_comp_object_transform_bg_set(ec->frame, EINA_TRUE);
7404 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
7407 ec->transform_core.background = background;
7410 // 3.1 if 24bit window then set transp rect
7415 e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle);
7418 if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect
7419 e_comp_object_transform_transp_set(ec->frame, EINA_TRUE);
7421 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7424 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7426 // 3.5 parent matrix multiply
7427 if (ec->transform_core.parent.enable)
7429 matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
7431 boundary_matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
7434 ec->transform_core.result.transform.use_zoom = EINA_TRUE;
7435 zoom.zoom_x *= ec->transform_core.parent.zoom.zoom_x;
7436 zoom.zoom_y *= ec->transform_core.parent.zoom.zoom_y;
7437 zoom.cx += ec->transform_core.parent.zoom.cx;
7438 zoom.cy += ec->transform_core.parent.zoom.cy;
7441 // 4. apply matrix to vertices
7442 ec->transform_core.result.matrix = matrix;
7443 ec->transform_core.result.inv_matrix = e_util_transform_matrix_inverse_get(&matrix);
7444 ec->transform_core.result.vertices = e_util_transform_rect_to_vertices(&source_rect);
7445 ec->transform_core.result.boundary.vertices = e_util_transform_rect_to_vertices(&source_rect);
7446 ec->transform_core.result.vertices = e_util_transform_matrix_multiply_rect_vertex(&matrix,
7447 &ec->transform_core.result.vertices);
7448 ec->transform_core.result.boundary.vertices = e_util_transform_matrix_multiply_rect_vertex(&boundary_matrix,
7449 &ec->transform_core.result.boundary.vertices);
7450 ec->transform_core.result.transform.zoom = zoom;
7452 // 5. apply vertices
7453 if (ec->transform_core.result.transform.use_zoom)
7455 // TODO: apply zoom values to vertices
7456 e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices,
7457 ec->transform_core.result.transform.zoom);
7458 e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices,
7459 ec->transform_core.result.transform.zoom);
7460 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
7461 _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform,
7462 ec->transform_core.result.transform.zoom);
7466 e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices);
7467 e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices);
7468 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
7469 _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform);
7472 // 6. subsurface update
7473 _e_client_transform_core_sub_update(ec, &ec->transform_core.result.vertices);
7475 if (!e_object_is_del(E_OBJECT(ec)))
7477 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
7478 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
7483 if (ec->transform_core.result.enable)
7485 ec->transform_core.result.enable = EINA_FALSE;
7486 _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL);
7487 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
7488 ec->transform_core.background = EINA_FALSE;
7489 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7490 _e_client_transform_core_sub_update(ec, NULL);
7492 if (!e_object_is_del(E_OBJECT(ec)))
7494 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
7495 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
7500 e_comp_visibility_calculation_set(EINA_TRUE);
7504 e_client_transform_core_transform_count_get(E_Client *ec)
7507 if (!ec->transform_core.transform_list) return 0;
7508 return eina_list_count(ec->transform_core.transform_list);
7511 E_API E_Util_Transform*
7512 e_client_transform_core_transform_get(E_Client *ec, int index)
7514 if (!ec) return NULL;
7515 if (!ec->transform_core.transform_list) return NULL;
7516 if (index < 0 || index >= e_client_transform_core_transform_count_get(ec))
7519 return (E_Util_Transform*)eina_list_nth(ec->transform_core.transform_list, index);
7523 e_client_transform_core_input_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7525 E_Util_Transform_Vertex vertex, result_vertex;
7528 if (!e_client_transform_core_enable_get(ec)) return;
7530 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
7532 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.inv_matrix, &vertex);
7533 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
7537 e_client_transform_core_input_inv_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7539 E_Util_Transform_Vertex vertex, result_vertex;
7542 if (!e_client_transform_core_enable_get(ec)) return;
7544 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
7546 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.matrix, &vertex);
7547 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
7551 e_client_transform_core_input_inv_rect_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7555 if (!e_client_transform_core_enable_get(ec)) return;
7556 e_client_geometry_get(ec, NULL, NULL, &gw, &gh);
7558 e_util_transform_matrix_inv_rect_coords_get(&ec->transform_core.result.transform,
7559 &ec->transform_core.result.vertices,
7561 x, y, out_x, out_y);
7565 e_client_transform_core_direct_render_set(E_Client *ec, Eina_Bool set)
7567 EINA_SAFETY_ON_NULL_RETURN(ec);
7569 if (ec->transform_core.direct_render == set) return;
7571 ec->transform_core.direct_render = set;
7572 ec->transform_core.changed = EINA_TRUE;
7574 e_client_transform_core_update(ec);
7578 e_client_pixmap_change(E_Client *ec, E_Pixmap *newcp)
7580 E_Pixmap_Type oldtype, newtype;
7583 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
7584 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->pixmap, NULL);
7585 EINA_SAFETY_ON_NULL_RETURN_VAL(newcp, NULL);
7589 oldtype = e_pixmap_type_get(oldcp);
7590 if (oldtype >= E_PIXMAP_TYPE_MAX) return NULL;
7592 newtype = e_pixmap_type_get(newcp);
7593 if (newtype >= E_PIXMAP_TYPE_MAX) return NULL;
7595 if (eina_hash_find(clients_hash[oldtype], &oldcp))
7596 eina_hash_del_by_key(clients_hash[oldtype], &oldcp);
7597 e_pixmap_client_set(oldcp, NULL);
7600 e_pixmap_client_set(newcp, ec);
7602 eina_hash_add(clients_hash[newtype], &newcp, ec);
7608 e_client_window_role_set(E_Client *ec, const char *role)
7610 EINA_SAFETY_ON_NULL_RETURN(ec);
7612 if (eina_stringshare_replace(&ec->icccm.window_role, role))
7614 wl_signal_emit_mutable(&PRI(ec)->events.window_role_change, NULL);
7615 _e_client_hook_call(E_CLIENT_HOOK_WINDOW_ROLE_CHANGE, ec);
7620 e_client_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
7624 res = e_comp_wl_key_send(ec, keycode, pressed, dev, time);
7630 e_client_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, unsigned int time)
7634 res = e_comp_wl_key_cancel(ec, keycode, dev, time);
7640 e_client_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, unsigned int time)
7644 res = e_comp_wl_touch_send(ec, idx, x, y, pressed, dev, radius_x, radius_y, pressure, angle, time);
7650 e_client_touch_update_send(E_Client *ec, int idx, int x, int y, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, unsigned int time)
7654 res = e_comp_wl_touch_update_send(ec, idx, x, y, dev, radius_x, radius_y, pressure, angle, time);
7660 e_client_touch_cancel_send(E_Client *ec)
7664 res = e_comp_wl_touch_cancel_send(ec);
7670 e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
7674 res = e_comp_wl_mouse_button_send(ec, buttons, pressed, dev, time);
7680 e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
7684 res = e_comp_wl_mouse_move_send(ec, x, y, dev, time);
7690 e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time)
7694 res = e_comp_wl_mouse_wheel_send(ec, direction, z, dev, time);
7700 e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
7704 res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
7710 e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
7714 res = e_comp_wl_mouse_out_send(ec, dev, time);
7720 e_client_video_client_has(E_Client *ec)
7722 return e_comp_wl_video_subsurface_has(ec);
7726 e_client_normal_client_has(E_Client *ec)
7728 return e_comp_wl_normal_subsurface_has(ec);
7732 e_client_cursor_hide(E_Client *ec)
7734 return e_comp_wl_cursor_hide(ec);
7738 e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
7742 ELOGF("TZVIS", "VIS_FORCE_OBSCURED :%d", ec, set);
7744 ec->visibility.force_obscured = set;
7745 e_comp_visibility_calculation_set(EINA_TRUE);
7748 EINTERN E_Capture_Save_State
7749 e_client_image_save(E_Client *ec, const char *dir, const char *name, E_Capture_Client_Save_End_Cb func_end, void *data, Eina_Bool skip_child)
7751 return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
7755 _e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *subc)
7757 E_Client *ec, *parent;
7763 ec->base_output_resolution.use = 0;
7764 ec->base_output_resolution.w = 0;
7765 ec->base_output_resolution.h = 0;
7766 if (ec->base_output_resolution.transform)
7768 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
7769 E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
7770 ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
7773 /* Update transform for toplevel surface.
7774 * The transform of subsurface will be updated by its parent accordingly. */
7775 parent = e_comp_wl_topmost_parent_get(ec);
7778 parent->transform_core.changed = EINA_TRUE;
7779 e_client_transform_core_update(parent);
7782 /* TODO: Do we need to apply it again if subsurface is destroyed? */
7786 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
7789 ec->base_output_resolution.use = 1;
7790 ec->base_output_resolution.w = width;
7791 ec->base_output_resolution.h = height;
7792 ec->base_output_resolution.transform = e_util_transform_new();
7793 e_util_transform_role_set(ec->base_output_resolution.transform, "base_output_resolution");
7794 e_client_transform_core_add(ec, ec->base_output_resolution.transform);
7796 if (!ec->base_output_resolution.hook_subsurf_create)
7798 ec->base_output_resolution.hook_subsurf_create =
7799 e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
7800 _e_client_base_output_resolution_hook_subsurf_create,
7806 e_client_base_output_resolution_transform_adjust(E_Client *ec)
7810 EINA_SAFETY_ON_NULL_RETURN(ec);
7811 if (!ec->base_output_resolution.use) return;
7812 if (!ec->base_output_resolution.transform) return;
7814 desk = e_comp_desk_find_by_ec(ec);
7815 EINA_SAFETY_ON_NULL_RETURN(desk);
7817 ELOGF("POL_APPINFO", "Apply TRANSFORM... desk:(%dx%d), ec:(%dx%d)",
7818 ec, desk->geom.w, desk->geom.h, ec->w, ec->h);
7820 e_util_transform_scale(ec->base_output_resolution.transform,
7821 (double)desk->geom.w /(double)ec->base_output_resolution.w,
7822 (double)desk->geom.h /(double)ec->base_output_resolution.h,
7824 e_client_transform_core_update(ec);
7828 e_client_base_output_resolution_update(E_Client *ec)
7830 E_Appinfo *eai = NULL;
7831 int configured_width, configured_height;
7835 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
7837 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
7838 if (ec->base_output_resolution.use) return EINA_TRUE;
7840 /* Check whether it's subsurface or not
7841 * The resolution of subsurface will follow the resolution of its toplevel surface.
7842 * Transform for subsurface will be applied when toplevel surface does by
7843 * implementation of e_client_transform_core.
7845 if (e_comp_wl_subsurface_check(ec))
7848 desk = e_comp_desk_find_by_ec(ec);
7849 EINA_SAFETY_ON_NULL_RETURN_VAL(desk, EINA_FALSE);
7851 configured_width = e_config->configured_output_resolution.w;
7852 configured_height = e_config->configured_output_resolution.h;
7856 ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec,
7857 configured_width, configured_height, ec->netwm.pid);
7858 goto use_configured;
7861 eai = e_appinfo_find_with_pid(ec->netwm.pid);
7864 ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec,
7865 configured_width, configured_height, ec->netwm.pid);
7866 goto use_configured;
7869 if (!e_appinfo_base_output_resolution_get(eai, &width, &height))
7871 ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec,
7872 configured_width, configured_height, ec->netwm.pid);
7873 goto use_configured;
7876 if ((width == 0) && (height == 0))
7878 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution size:(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
7882 if ((desk->geom.w == width) && (desk->geom.h == height))
7884 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), pid:%d", ec, width, height, ec->netwm.pid);
7888 /* set the base_output_resolution of the e_client */
7889 _e_client_base_output_resolution_set(ec, width, height);
7891 ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
7897 if ((desk->geom.w == configured_width) && (desk->geom.h == configured_height))
7899 ELOGF("POL_APPINFO", "SKIP use configured_output_resolution (same with desk size:(%d,%d), pid:%d)", ec, configured_width, configured_height, ec->netwm.pid);
7903 /* set the base_output_resolution of the e_client as a default */
7904 _e_client_base_output_resolution_set(ec, configured_width, configured_height);
7911 e_client_base_output_resolution_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
7916 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
7918 zone = e_comp_zone_find_by_ec(ec);
7919 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
7921 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
7928 if (ec->base_output_resolution.use)
7930 if (w) *w = ec->base_output_resolution.w;
7931 if (h) *h = ec->base_output_resolution.h;
7938 e_client_base_output_resolution_desk_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h, Eina_Bool consider_obstacle_area)
7943 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
7945 zone = e_comp_zone_find_by_ec(ec);
7946 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
7948 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, consider_obstacle_area);
7955 if (ec->base_output_resolution.use)
7957 // TODO: Consider obstacle area
7958 if (w) *w = ec->base_output_resolution.w;
7959 if (h) *h = ec->base_output_resolution.h;
7965 /* change the base_output_resolution of the bind_ec by checking the base_output_resolution of provider_ec's appinfo */
7967 e_client_base_output_resolution_rsm_update(E_Client *bind_ec, E_Client *provider_ec)
7969 E_Appinfo *epai = NULL;
7970 int configured_width, configured_height;
7972 E_Desk *bind_ec_desk;
7974 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec, EINA_FALSE);
7975 EINA_SAFETY_ON_NULL_RETURN_VAL(provider_ec, EINA_FALSE);
7977 bind_ec_desk = e_comp_desk_find_by_ec(bind_ec);
7978 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec_desk, EINA_FALSE);
7980 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
7982 configured_width = e_config->configured_output_resolution.w;
7983 configured_height = e_config->configured_output_resolution.h;
7985 if (bind_ec->base_output_resolution.use)
7987 ELOGF("POL_APPINFO", "DELETE EXISTED BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
7988 bind_ec->base_output_resolution.w, bind_ec->base_output_resolution.h, bind_ec->netwm.pid);
7990 bind_ec->base_output_resolution.use = 0;
7991 bind_ec->base_output_resolution.w = 0;
7992 bind_ec->base_output_resolution.h = 0;
7993 e_client_transform_core_remove(bind_ec, bind_ec->base_output_resolution.transform);
7994 E_FREE_FUNC(bind_ec->base_output_resolution.transform, e_util_transform_del);
7997 if (!provider_ec->netwm.pid)
7999 ELOGF("POL_APPINFO", "NO PROVIDER PID... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8000 configured_width, configured_height, provider_ec->netwm.pid);
8001 goto use_configured;
8004 epai = e_appinfo_find_with_pid(provider_ec->netwm.pid);
8007 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8008 configured_width, configured_height, provider_ec->netwm.pid);
8009 goto use_configured;
8012 if (!e_appinfo_base_output_resolution_get(epai, &width, &height))
8014 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8015 configured_width, configured_height, provider_ec->netwm.pid);
8016 goto use_configured;
8019 if ((width == 0) && (height == 0))
8021 ELOGF("POL_APPINFO", "NO PROVIDER WIDTH and HEIGHT... SKIP base_output_resolution due to size:(%d,%d) provider_pid:%d", provider_ec,
8022 width, height, provider_ec->netwm.pid);
8026 if ((bind_ec_desk->geom.w == width) && (bind_ec_desk->geom.h == height))
8028 ELOGF("POL_APPINFO", "SKIP SET BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
8029 width, height, bind_ec->netwm.pid);
8033 /* set the base_output_resolution of the e_client */
8034 _e_client_base_output_resolution_set(bind_ec, width, height);
8035 e_client_base_output_resolution_transform_adjust(bind_ec);
8037 ELOGF("POL_APPINFO", "USE BINDER base_output_resolution(%d,%d) bind_pid:%d", bind_ec, width, height, bind_ec->netwm.pid);
8043 if ((bind_ec_desk->geom.w == configured_width) && (bind_ec_desk->geom.h == configured_height))
8045 ELOGF("POL_APPINFO", "SKIP BINDER use configured_output_resolution (same with desk size:(%d,%d), bind_pid:%d)", bind_ec,
8046 configured_width, configured_height, bind_ec->netwm.pid);
8050 /* set the base_output_resolution of the e_client as a default */
8051 _e_client_base_output_resolution_set(bind_ec, configured_width, configured_height);
8057 /* tizen_move_resize */
8059 e_client_pending_geometry_has(E_Client *ec)
8061 if (!eina_list_count(ec->surface_sync.pending_geometry))
8064 return ec->surface_sync.wait_commit;
8068 e_client_pending_geometry_flush(E_Client *ec)
8070 E_Client_Pending_Geometry *geo;
8072 if (!eina_list_count(ec->surface_sync.pending_geometry))
8074 EINA_LIST_FREE(ec->surface_sync.pending_geometry, geo)
8078 ec->surface_sync.wait_commit = EINA_FALSE;
8079 ELOGF("POSSIZE", "pending geometry has flushed", ec);
8084 e_client_pending_geometry_last_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
8087 E_Client_Pending_Geometry *geo;
8093 EINA_LIST_REVERSE_FOREACH(ec->surface_sync.pending_geometry, l, geo)
8109 e_client_frame_focus_set(E_Client *ec, Eina_Bool focus)
8112 evas_object_focus_set(ec->frame, focus);
8116 e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h)
8120 if (ec->internal || ec->input_only)
8122 evas_object_geometry_set(ec->frame, x, y, w, h);
8126 if ((ec->w != w) || (ec->h != h))
8128 ELOGF("POSSIZE", "Set move_after_resize. old(%d,%d,%dx%d), new(%d,%d,%dx%d)", ec, ec->x, ec->y, ec->w, ec->h, x, y, w, h);
8129 ec->move_after_resize = EINA_TRUE;
8131 e_client_pos_set(ec, x, y);
8132 evas_object_resize(ec->frame, w, h);
8135 evas_object_geometry_set(ec->frame, x, y, w, h);
8140 e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
8144 if (ec->internal || ec->input_only)
8146 e_client_util_move_without_frame(ec, x, y);
8147 e_client_util_resize_without_frame(ec, w, h);
8151 if ((ec->w != w) || (ec->h != h))
8153 ELOGF("POSSIZE", "Set move_after_resize. old(%d,%d,%dx%d), new(%d,%d,%dx%d)", ec, ec->x, ec->y, ec->w, ec->h, x, y, w, h);
8154 ec->move_after_resize = EINA_TRUE;
8156 e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
8157 e_client_pos_set(ec, x, y);
8158 e_client_util_resize_without_frame(ec, w, h);
8162 e_client_util_move_without_frame(ec, x, y);
8163 e_client_util_resize_without_frame(ec, w, h);
8169 e_client_layer_set(E_Client *ec,
8172 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8173 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8174 if (!ec->frame) return EINA_FALSE;
8176 if (e_comp_canvas_client_layer_map(layer) == 9999)
8177 return EINA_FALSE; //invalid layer is not allowed
8179 if (ec->desk_area.enable)
8181 if (e_client_layer_set_by_desk_area(ec, layer))
8183 // restack according to desk group rule
8184 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
8188 ec->desk_area.layer_backup = layer;
8190 evas_object_layer_set(ec->frame, layer);
8191 if (ec->layer != layer)
8193 /* check exceptional case */
8194 if ((ec->fullscreen) &&
8195 (ec->saved.layer != layer))
8197 ELOGF("LAYER", "(%d) fail to backup at saved.layer for fullscreen", ec, layer);
8200 // if e_comp_object fail to change ec->layer due to ec->layer_pending or block
8201 // leave log and apply ec->layer according to set
8202 // as a result it restores back to given layer when pending or block is free
8203 ELOGF("LAYER", "change layer from %d to %d if in case layer pending(%d) or block(%d)",
8204 ec, ec->layer, layer, ec->layer_pending, ec->layer_block);
8205 if (ec->layer_pending || ec->layer_block)
8212 wl_signal_emit_mutable(&PRI(ec)->events.layer_set, NULL);
8218 e_client_layer_get(E_Client *ec)
8222 E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM);
8223 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM);
8224 if (!ec->frame) return E_LAYER_BOTTOM;
8226 layer = evas_object_layer_get(ec->frame);
8227 if (ec->layer != layer)
8229 /* client could be on temperory layer while pending or block,
8230 * in that case, client restores back to ec->layer after pending/block finish */
8231 if (ec->layer_block || ec->layer_pending)
8234 /* otherwise, client is on unexpected layer */
8235 ELOGF("LAYER", "layer dismatch ec->layer %d | evas obj layer %d ",
8236 ec, ec->layer, layer);
8238 if (e_comp_canvas_client_layer_map(layer) == 9999)
8239 return E_LAYER_BOTTOM; //not on E_LAYER_CLIENT
8246 _e_client_desk_area_original_layer_save(E_Client *ec, E_Layer layer)
8249 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
8250 ec->desk_area.layer_backup = layer;
8254 e_client_layer_set_by_desk_area(E_Client *ec, E_Layer layer)
8260 if (!ec) return EINA_FALSE;
8261 if (!ec->frame) return EINA_FALSE;
8262 if (!ec->desk_area.enable) return EINA_FALSE;
8263 if (!ec->desk_area.desk_area) return EINA_FALSE;
8265 eda = ec->desk_area.desk_area;
8267 // save original layer
8268 _e_client_desk_area_original_layer_save(ec, layer);
8270 // get desk_area layer
8271 edg_layer = (E_Layer)e_desk_area_layer_get(eda);
8272 org_layer = e_client_desk_area_original_layer_get(ec);
8274 ELOGF("EDG", "layer_set by desk_area... layer:%d, org_layer:%d, new_layer:%d", ec, layer, org_layer, edg_layer);
8275 if (org_layer == edg_layer)
8281 evas_object_layer_set(ec->frame, edg_layer);
8282 if (edg_layer == ec->layer)
8290 e_client_desk_area_original_layer_restore(E_Client *ec)
8294 // Do we need to check ec->desk_area.enable?
8295 // if ec->desk_area.enable is true, then e_client_layer_set calls
8296 // e_desk_area_ec_edg_layer_set(). that's too bad. :(
8297 // so, we MUST make a policy for ordering of the desk group layer restore
8298 // and the desk group enable.
8299 if (ec->desk_area.enable) return;
8300 e_client_layer_set(ec, ec->desk_area.layer_backup);
8304 e_client_desk_area_original_layer_get(E_Client *ec)
8306 if (!ec) return E_LAYER_DESKTOP;
8308 if (ec->desk_area.enable)
8309 return ec->desk_area.layer_backup;
8315 e_client_desk_area_client_layer_set(E_Client *ec, E_Desk_Area_Client_Layer edgc_layer)
8317 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8318 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8319 if ((edgc_layer < E_DESK_AREA_CLIENT_LAYER_DESKTOP) ||
8320 (edgc_layer >= E_DESK_AREA_CLIENT_LAYER_MAX))
8323 ec->desk_area.edgc_layer = edgc_layer;
8327 EINTERN E_Desk_Area_Client_Layer
8328 e_client_desk_area_client_layer_get(E_Client *ec)
8330 E_OBJECT_CHECK_RETURN(ec, E_DESK_AREA_CLIENT_LAYER_DESKTOP);
8332 return ec->desk_area.edgc_layer;
8335 #ifdef REFACTOR_ZONE_DESK
8338 e_client_desk_area_enable_set(E_Client *ec, Eina_Bool enable)
8340 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8341 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8343 ec->desk_area.enable = enable;
8345 ELOGF("EDG", "Desk group enable set to %d", ec, enable);
8348 if (!ec->desk_area.transform)
8350 ec->desk_area.transform = e_util_transform_new();
8351 e_util_transform_role_set(ec->desk_area.transform, "desk_area");
8356 if (ec->desk_area.transform)
8358 e_util_transform_del(ec->desk_area.transform);
8359 ec->desk_area.transform = NULL;
8363 e_desk_area_ec_update(ec->desk_area.desk_area, ec);
8368 //FIXME: use e_desk_area_ec_reassign(eda, ec) instead of this api
8370 e_client_desk_area_set(E_Client *ec, E_Desk_Area *eda)
8372 E_Desk_Area *old_edg;
8374 if (!ec) return EINA_FALSE;
8376 #if 0 // if this is removed.. then below if (eda != old_edg) is removed also...
8377 if (ec->desk_area.desk_area == eda)
8381 ELOGF("EDG", "Desk Group Set (new:%p, old:%p)", ec, eda, ec->desk_area.desk_area);
8382 old_edg = ec->desk_area.desk_area;
8384 e_desk_area_ec_remove(old_edg, ec);
8386 ec->desk_area.desk_area = eda;
8387 e_desk_area_ec_add(eda, ec);
8389 #if 0 // if this is removed.. then above if (ec->desk_area.desk_area == eda) is removed also...
8393 e_desk_area_ec_update(eda, ec);
8394 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
8401 _raise_between_sibling_under_parent(E_Client *ec)
8403 ELOGF("POL", "RAISE child window between sibling. So, stack below under the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
8404 e_client_stack_below(ec, ec->parent);
8408 _raise_between_sibling_on_parent(E_Client *ec)
8410 E_Client *top_child = NULL;
8411 top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
8414 ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
8415 e_client_stack_above(ec, ec->parent);
8419 if (top_child != ec)
8421 ELOGF("POL", "RAISE child window between sibling... Stack above on the top child (win:%zx, ec:%p)", ec, e_client_util_win_get(top_child), top_child);
8422 e_client_stack_above(ec, top_child);
8425 ELOGF("POL", "RAISE child window between sibling... already on the top. STAY", ec);
8430 _raise_belong_to_parent(E_Client *ec)
8432 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
8433 _raise_between_sibling_under_parent(ec);
8435 _raise_between_sibling_on_parent(ec);
8439 e_client_raise(E_Client *ec)
8443 if (ec->desk_area.enable)
8446 eda = ec->desk_area.desk_area;
8449 e_desk_area_ec_raise(eda, ec);
8454 if (ec->parent && e_client_is_belong_to_parent(ec))
8455 _raise_belong_to_parent(ec);
8457 evas_object_raise(ec->frame);
8459 wl_signal_emit_mutable(&PRI(ec)->events.raise, NULL);
8463 _e_client_transient_for_below_group_make(E_Client *ec, Eina_List **list)
8465 // list : Head is the bottommost child
8471 EINA_LIST_REVERSE_FOREACH(ec->transients, l, child)
8473 if (!child) continue;
8474 if (e_client_transient_policy_get(child) != E_TRANSIENT_BELOW) continue;
8475 if (!e_client_is_belong_to_parent(child)) continue;
8477 *list = eina_list_prepend(*list, child);
8478 _e_client_transient_for_group_make(child, list);
8483 e_client_transient_child_bottom_get(E_Client *ec)
8485 E_Client *bottom_ec = NULL;
8486 Eina_List *transient_below_list = NULL;
8487 Eina_List *l = NULL;
8489 _e_client_transient_for_below_group_make(ec, &transient_below_list);
8491 if (transient_below_list)
8493 E_Client *temp_ec = NULL;
8494 E_Client *temp_ec2 = NULL;
8496 E_CLIENT_FOREACH(temp_ec)
8498 if (bottom_ec) break;
8506 EINA_LIST_FOREACH(transient_below_list, l, temp_ec2)
8508 if (temp_ec == temp_ec2)
8510 bottom_ec = temp_ec2;
8515 eina_list_free(transient_below_list);
8521 _lower_between_sibling_under_parent(E_Client *ec)
8523 E_Client *bottom_child = NULL;
8524 bottom_child = e_client_transient_child_bottom_get(ec->parent);
8527 ELOGF("POL", "LOWER child window between sibling... Stack below under the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
8528 e_client_stack_below(ec, ec->parent);
8532 if (bottom_child != ec)
8534 ELOGF("POL", "LOWER child window between sibling... Stack below under the bottom child (win:%zx, ec:%p)", ec, e_client_util_win_get(bottom_child), bottom_child);
8535 e_client_stack_below(ec, bottom_child);
8538 ELOGF("POL", "LOWER child window between sibling... already under the bottom. STAY", ec);
8543 _lower_between_sibling_on_parent(E_Client *ec)
8545 ELOGF("POL", "LOWER child window between sibling... So, stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
8546 e_client_stack_above(ec, ec->parent);
8550 _lower_belong_to_parent(E_Client *ec)
8552 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
8553 _lower_between_sibling_under_parent(ec);
8555 _lower_between_sibling_on_parent(ec);
8559 e_client_lower(E_Client *ec)
8563 if (ec->desk_area.enable)
8566 eda = ec->desk_area.desk_area;
8569 e_desk_area_ec_lower(eda, ec);
8570 #ifdef REFACTOR_FOCUS_POLICY
8571 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
8577 if (ec->parent && e_client_is_belong_to_parent(ec))
8578 _lower_belong_to_parent(ec);
8580 evas_object_lower(ec->frame);
8582 #ifdef REFACTOR_FOCUS_POLICY
8583 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
8588 e_client_stack_above(E_Client *ec, E_Client *above)
8591 if (!ec->frame) return;
8593 if (!above->frame) return;
8595 if (ec->desk_area.enable)
8598 eda = ec->desk_area.desk_area;
8601 e_desk_area_ec_stack_above(eda, ec, above);
8606 evas_object_stack_above(ec->frame, above->frame);
8608 wl_signal_emit_mutable(&PRI(ec)->events.stack_above, NULL);
8612 e_client_stack_below(E_Client *ec, E_Client *below)
8615 if (!ec->frame) return;
8617 if (!below->frame) return;
8619 if (ec->desk_area.enable)
8622 eda = ec->desk_area.desk_area;
8625 e_desk_area_ec_stack_below(eda, ec, below);
8630 evas_object_stack_below(ec->frame, below->frame);
8632 wl_signal_emit_mutable(&PRI(ec)->events.stack_below, NULL);
8636 e_client_show_pending_set(E_Client *ec)
8640 ec->show_pending.count++;
8641 ELOGF("E_CLIENT", "SET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
8642 return ec->show_pending.count;
8646 e_client_show_pending_unset(E_Client *ec)
8649 if (ec->show_pending.count <= 0) return 0;
8651 ec->show_pending.count--;
8652 ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
8653 if (ec->show_pending.count == 0 && ec->show_pending.running)
8655 ec->show_pending.running = EINA_FALSE;
8658 ELOGF("E_CLIENT", "evas_object_show by unset show_pending", ec);
8659 evas_object_show(ec->frame);
8660 //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
8665 return ec->show_pending.count;
8669 _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
8673 Eina_Bool res = EINA_TRUE;
8674 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
8679 EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc)
8681 res = _e_client_surface_tree_foreach_helper(subc, func, data);
8688 res = func(data, ec);
8691 EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc)
8693 res = _e_client_surface_tree_foreach_helper(subc,
8706 e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
8708 EINA_SAFETY_ON_NULL_RETURN(ec);
8709 EINA_SAFETY_ON_NULL_RETURN(func);
8711 _e_client_surface_tree_foreach_helper(ec, func, data);
8714 EINTERN E_Comp_Wl_Client_Data *
8715 e_client_cdata_new(E_Client *ec)
8717 E_Comp_Wl_Client_Data *cdata;
8719 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
8721 if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1)))
8723 ERR("Could not allocate new E_Comp_Wl_Client_Data structure");
8726 ec->comp_data = cdata;
8732 e_client_cdata_free(E_Client *ec)
8734 EINA_SAFETY_ON_NULL_RETURN(ec);
8735 if (!ec->comp_data) return;
8737 E_FREE(ec->comp_data);
8740 EINTERN E_Comp_Wl_Client_Data *
8741 e_client_cdata_get(E_Client *ec)
8743 if (!ec) return NULL;
8745 return ec->comp_data;
8749 e_client_map_set(E_Client *ec, E_Map *em)
8751 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8753 return e_map_set_to_comp_object(em, ec->frame);
8757 e_client_map_get(const E_Client *ec)
8759 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
8761 return e_map_get_from_comp_object(ec->frame);
8765 e_client_map_enable_set(E_Client *ec, Eina_Bool enable)
8767 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8768 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE);
8770 evas_object_map_enable_set(ec->frame, enable);
8776 e_client_belong_to_parent_set(E_Client *ec, Eina_Bool set)
8779 ec->belong_to_parent = set;
8783 e_client_is_belong_to_parent(E_Client *ec)
8785 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8786 return ec->belong_to_parent;
8790 e_client_transient_policy_set(E_Client *ec, E_Transient policy)
8793 ec->transient_policy = policy;
8797 e_client_transient_policy_get(E_Client *ec)
8799 if (!ec) return E_TRANSIENT_ABOVE;
8800 return ec->transient_policy;
8804 e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb)
8806 if (_e_client_resize_object_create_cb && cb)
8807 CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!");
8808 _e_client_resize_object_create_cb = cb;
8812 e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
8816 // FYI, we consider 0 and 1 to be the same value as a default unit size.
8817 ec->manage_resize.unit_size = unit_size;
8821 e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
8824 ec->desk_zoom.enable = enable;
8828 e_client_desk_zoom_enable_get(E_Client *ec)
8830 if (!ec) return EINA_FALSE;
8831 return ec->desk_zoom.enable;
8835 e_client_layout_apply(E_Client *ec, Eina_Bool apply)
8838 ec->apply_layout = apply;
8842 e_client_is_layout_apply(E_Client *ec)
8844 if (!ec) return EINA_FALSE;
8845 return ec->apply_layout;
8849 e_client_from_surface_resource(struct wl_resource *surface_resource)
8851 EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, NULL);
8853 return e_comp_wl_util_client_from_surface_resource(surface_resource);
8857 e_client_fps_update(E_Client *ec)
8862 EINA_SAFETY_ON_NULL_RETURN(ec);
8864 if (!ec->fps.enabled) return;
8866 tim = ecore_time_get();
8868 dt = tim - ec->fps.frametimes[0];
8870 ec->fps.frametimes[0] = tim;
8874 if (ec->fps.lapse == 0.0)
8876 ec->fps.lapse = tim;
8877 ec->fps.flapse = ec->fps.cframes;
8879 else if ((tim - ec->fps.lapse) >= 0.5)
8881 ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
8882 (tim - ec->fps.lapse);
8883 ec->fps.lapse = tim;
8884 ec->fps.flapse = ec->fps.cframes;
8890 e_client_fps_get(E_Client *ec, double *fps)
8892 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8894 if (ec->fps.old_fps == ec->fps.fps)
8897 if (ec->fps.fps > 0.0)
8900 ec->fps.old_fps = ec->fps.fps;
8908 e_client_fps_enable(E_Client *ec, Eina_Bool enable)
8910 EINA_SAFETY_ON_NULL_RETURN(ec);
8912 ec->fps.enabled = enable;
8916 e_client_explicit_sync_get(E_Client *ec)
8918 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8920 return ec->explicit_sync;
8924 e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable)
8926 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8928 ec->explicit_sync = enable;
8934 e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec)
8936 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, -1);
8938 return ec->acquire_fence_fd;
8942 e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd)
8944 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8946 ec->acquire_fence_fd = fd;
8951 #ifdef REFACTOR_ZONE_DESK
8953 e_client_intercept_hook_auto_placement_call(E_Client *ec)
8955 // no need to call the intercept hook if ec is NULL.
8956 if (!ec) return EINA_FALSE;
8958 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
8960 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT Intercepted.", ec);
8968 e_client_iconify_event_send(E_Client *ec)
8970 EINA_SAFETY_ON_NULL_RETURN(ec);
8972 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
8976 e_client_uniconify_event_send(E_Client *ec)
8978 EINA_SAFETY_ON_NULL_RETURN(ec);
8980 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
8985 e_client_stack_transient_for_done_notify(E_Client *ec)
8987 EINA_SAFETY_ON_NULL_RETURN(ec);
8989 wl_signal_emit_mutable(&PRI(ec)->events.stack_transient_for_done, NULL);
8993 e_client_eval_pre_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
8996 wl_signal_add(&priv->events.eval_pre_fetch, listener);
8999 EINTERN struct wl_listener *
9000 e_client_eval_pre_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9002 API_ENTRY_VAL(NULL);
9003 return wl_signal_get(&priv->events.eval_pre_fetch, notify);
9007 e_client_eval_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9010 wl_signal_add(&priv->events.eval_fetch, listener);
9013 EINTERN struct wl_listener *
9014 e_client_eval_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9016 API_ENTRY_VAL(NULL);
9017 return wl_signal_get(&priv->events.eval_fetch, notify);
9021 e_client_eval_pre_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9024 wl_signal_add(&priv->events.eval_pre_post_fetch, listener);
9027 EINTERN struct wl_listener *
9028 e_client_eval_pre_post_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9030 API_ENTRY_VAL(NULL);
9031 return wl_signal_get(&priv->events.eval_pre_post_fetch, notify);
9035 e_client_eval_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9038 wl_signal_add(&priv->events.eval_post_fetch, listener);
9041 EINTERN struct wl_listener *
9042 e_client_eval_post_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9044 API_ENTRY_VAL(NULL);
9045 return wl_signal_get(&priv->events.eval_post_fetch, notify);
9049 e_client_eval_pre_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
9052 wl_signal_add(&priv->events.eval_pre_frame_assign, listener);
9055 EINTERN struct wl_listener *
9056 e_client_eval_pre_frame_assign_listener_get(E_Client *ec, wl_notify_func_t notify)
9058 API_ENTRY_VAL(NULL);
9059 return wl_signal_get(&priv->events.eval_pre_frame_assign, notify);
9063 e_client_eval_post_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
9066 wl_signal_add(&priv->events.eval_post_frame_assign, listener);
9069 EINTERN struct wl_listener *
9070 e_client_eval_post_frame_assign_listener_get(E_Client *ec, wl_notify_func_t notify)
9072 API_ENTRY_VAL(NULL);
9073 return wl_signal_get(&priv->events.eval_post_frame_assign, notify);
9077 e_client_eval_pre_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9080 wl_signal_add(&priv->events.eval_pre_new_client, listener);
9083 EINTERN struct wl_listener *
9084 e_client_eval_pre_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9086 API_ENTRY_VAL(NULL);
9087 return wl_signal_get(&priv->events.eval_pre_new_client, notify);
9091 e_client_eval_post_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9094 wl_signal_add(&priv->events.eval_post_new_client, listener);
9097 EINTERN struct wl_listener *
9098 e_client_eval_post_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9100 API_ENTRY_VAL(NULL);
9101 return wl_signal_get(&priv->events.eval_post_new_client, notify);
9105 e_client_eval_visibility_listener_add(E_Client *ec, struct wl_listener *listener)
9108 wl_signal_add(&priv->events.eval_visibility, listener);
9111 EINTERN struct wl_listener *
9112 e_client_eval_visibility_listener_get(E_Client *ec, wl_notify_func_t notify)
9114 API_ENTRY_VAL(NULL);
9115 return wl_signal_get(&priv->events.eval_visibility, notify);
9119 e_client_eval_visibility_end_listener_add(E_Client *ec, struct wl_listener *listener)
9122 wl_signal_add(&priv->events.eval_visibility_end, listener);
9125 EINTERN struct wl_listener *
9126 e_client_eval_visibility_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9128 API_ENTRY_VAL(NULL);
9129 return wl_signal_get(&priv->events.eval_visibility_end, notify);
9133 e_client_eval_end_listener_add(E_Client *ec, struct wl_listener *listener)
9136 wl_signal_add(&priv->events.eval_end, listener);
9139 EINTERN struct wl_listener *
9140 e_client_eval_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9142 API_ENTRY_VAL(NULL);
9143 return wl_signal_get(&priv->events.eval_end, notify);
9147 e_client_move_begin_listener_add(E_Client *ec, struct wl_listener *listener)
9150 wl_signal_add(&priv->events.move_begin, listener);
9153 EINTERN struct wl_listener *
9154 e_client_move_begin_listener_get(E_Client *ec, wl_notify_func_t notify)
9156 API_ENTRY_VAL(NULL);
9157 return wl_signal_get(&priv->events.move_begin, notify);
9161 e_client_move_update_listener_add(E_Client *ec, struct wl_listener *listener)
9164 wl_signal_add(&priv->events.move_update, listener);
9167 EINTERN struct wl_listener *
9168 e_client_move_update_listener_get(E_Client *ec, wl_notify_func_t notify)
9170 API_ENTRY_VAL(NULL);
9171 return wl_signal_get(&priv->events.move_update, notify);
9175 e_client_move_end_listener_add(E_Client *ec, struct wl_listener *listener)
9178 wl_signal_add(&priv->events.move_end, listener);
9181 EINTERN struct wl_listener *
9182 e_client_move_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9184 API_ENTRY_VAL(NULL);
9185 return wl_signal_get(&priv->events.move_end, notify);
9189 e_client_move_resize_begin_listener_add(E_Client *ec, struct wl_listener *listener)
9192 wl_signal_add(&priv->events.move_resize_begin, listener);
9195 EINTERN struct wl_listener *
9196 e_client_move_resize_begin_listener_get(E_Client *ec, wl_notify_func_t notify)
9198 API_ENTRY_VAL(NULL);
9199 return wl_signal_get(&priv->events.move_resize_begin, notify);
9203 e_client_move_resize_update_listener_add(E_Client *ec, struct wl_listener *listener)
9206 wl_signal_add(&priv->events.move_resize_update, listener);
9209 EINTERN struct wl_listener *
9210 e_client_move_resize_update_listener_get(E_Client *ec, wl_notify_func_t notify)
9212 API_ENTRY_VAL(NULL);
9213 return wl_signal_get(&priv->events.move_resize_update, notify);
9217 e_client_move_resize_end_listener_add(E_Client *ec, struct wl_listener *listener)
9220 wl_signal_add(&priv->events.move_resize_end, listener);
9223 EINTERN struct wl_listener *
9224 e_client_move_resize_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9226 API_ENTRY_VAL(NULL);
9227 return wl_signal_get(&priv->events.move_resize_end, notify);
9231 e_client_destroy_listener_add(E_Client *ec, struct wl_listener *listener)
9234 wl_signal_add(&priv->events.destroy, listener);
9237 EINTERN struct wl_listener *
9238 e_client_destroy_listener_get(E_Client *ec, wl_notify_func_t notify)
9240 API_ENTRY_VAL(NULL);
9241 return wl_signal_get(&priv->events.destroy, notify);
9245 e_client_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9248 wl_signal_add(&priv->events.new_client, listener);
9251 EINTERN struct wl_listener *
9252 e_client_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9254 API_ENTRY_VAL(NULL);
9255 return wl_signal_get(&priv->events.new_client, notify);
9259 e_client_new_client_post_listener_add(E_Client *ec, struct wl_listener *listener)
9262 wl_signal_add(&priv->events.new_client_post, listener);
9265 EINTERN struct wl_listener *
9266 e_client_new_client_post_listener_get(E_Client *ec, wl_notify_func_t notify)
9268 API_ENTRY_VAL(NULL);
9269 return wl_signal_get(&priv->events.new_client_post, notify);
9273 e_client_unredirect_listener_add(E_Client *ec, struct wl_listener *listener)
9276 wl_signal_add(&priv->events.unredirect, listener);
9279 EINTERN struct wl_listener *
9280 e_client_unredirect_listener_get(E_Client *ec, wl_notify_func_t notify)
9282 API_ENTRY_VAL(NULL);
9283 return wl_signal_get(&priv->events.unredirect, notify);
9287 e_client_redirect_listener_add(E_Client *ec, struct wl_listener *listener)
9290 wl_signal_add(&priv->events.redirect, listener);
9293 EINTERN struct wl_listener *
9294 e_client_redirect_listener_get(E_Client *ec, wl_notify_func_t notify)
9296 API_ENTRY_VAL(NULL);
9297 return wl_signal_get(&priv->events.redirect, notify);
9301 e_client_aux_hint_change_listener_add(E_Client *ec, struct wl_listener *listener)
9304 wl_signal_add(&priv->events.aux_hint_change, listener);
9307 EINTERN struct wl_listener *
9308 e_client_aux_hint_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9310 API_ENTRY_VAL(NULL);
9311 return wl_signal_get(&priv->events.aux_hint_change, notify);
9315 e_client_window_role_change_listener_add(E_Client *ec, struct wl_listener *listener)
9318 wl_signal_add(&priv->events.window_role_change, listener);
9321 EINTERN struct wl_listener *
9322 e_client_window_role_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9324 API_ENTRY_VAL(NULL);
9325 return wl_signal_get(&priv->events.window_role_change, notify);
9329 e_client_transform_change_listener_add(E_Client *ec, struct wl_listener *listener)
9332 wl_signal_add(&priv->events.transform_change, listener);
9335 EINTERN struct wl_listener *
9336 e_client_transform_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9338 API_ENTRY_VAL(NULL);
9339 return wl_signal_get(&priv->events.transform_change, notify);
9343 e_client_activate_done_listener_add(E_Client *ec, struct wl_listener *listener)
9346 wl_signal_add(&priv->events.activate_done, listener);
9349 EINTERN struct wl_listener *
9350 e_client_activate_done_listener_get(E_Client *ec, wl_notify_func_t notify)
9352 API_ENTRY_VAL(NULL);
9353 return wl_signal_get(&priv->events.activate_done, notify);
9357 e_client_mouse_in_listener_add(E_Client *ec, struct wl_listener *listener)
9360 wl_signal_add(&priv->events.mouse_in, listener);
9363 EINTERN struct wl_listener *
9364 e_client_mouse_in_listener_get(E_Client *ec, wl_notify_func_t notify)
9366 API_ENTRY_VAL(NULL);
9367 return wl_signal_get(&priv->events.mouse_in, notify);
9371 e_client_mouse_out_listener_add(E_Client *ec, struct wl_listener *listener)
9374 wl_signal_add(&priv->events.mouse_out, listener);
9377 EINTERN struct wl_listener *
9378 e_client_mouse_out_listener_get(E_Client *ec, wl_notify_func_t notify)
9380 API_ENTRY_VAL(NULL);
9381 return wl_signal_get(&priv->events.mouse_out, notify);
9385 e_client_mouse_down_listener_add(E_Client *ec, struct wl_listener *listener)
9388 wl_signal_add(&priv->events.mouse_down, listener);
9391 EINTERN struct wl_listener *
9392 e_client_mouse_down_listener_get(E_Client *ec, wl_notify_func_t notify)
9394 API_ENTRY_VAL(NULL);
9395 return wl_signal_get(&priv->events.mouse_down, notify);
9399 e_client_focus_set_listener_add(E_Client *ec, struct wl_listener *listener)
9402 wl_signal_add(&priv->events.focus_set, listener);
9405 EINTERN struct wl_listener *
9406 e_client_focus_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9408 API_ENTRY_VAL(NULL);
9409 return wl_signal_get(&priv->events.focus_set, notify);
9413 e_client_focus_unset_listener_add(E_Client *ec, struct wl_listener *listener)
9416 wl_signal_add(&priv->events.focus_unset, listener);
9419 EINTERN struct wl_listener *
9420 e_client_focus_unset_listener_get(E_Client *ec, wl_notify_func_t notify)
9422 API_ENTRY_VAL(NULL);
9423 return wl_signal_get(&priv->events.focus_unset, notify);
9427 e_client_focus_defer_set_listener_add(E_Client *ec, struct wl_listener *listener)
9430 wl_signal_add(&priv->events.focus_defer_set, listener);
9433 EINTERN struct wl_listener *
9434 e_client_focus_defer_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9436 API_ENTRY_VAL(NULL);
9437 return wl_signal_get(&priv->events.focus_defer_set, notify);
9441 e_client_focus_latest_set_listener_add(E_Client *ec, struct wl_listener *listener)
9444 wl_signal_add(&priv->events.focus_latest_set, listener);
9447 EINTERN struct wl_listener *
9448 e_client_focus_latest_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9450 API_ENTRY_VAL(NULL);
9451 return wl_signal_get(&priv->events.focus_latest_set, notify);
9455 e_client_iconify_listener_add(E_Client *ec, struct wl_listener *listener)
9458 wl_signal_add(&priv->events.iconify, listener);
9461 EINTERN struct wl_listener *
9462 e_client_iconify_listener_get(E_Client *ec, wl_notify_func_t notify)
9464 API_ENTRY_VAL(NULL);
9465 return wl_signal_get(&priv->events.iconify, notify);
9469 e_client_uniconify_listener_add(E_Client *ec, struct wl_listener *listener)
9472 wl_signal_add(&priv->events.uniconify, listener);
9475 EINTERN struct wl_listener *
9476 e_client_uniconify_listener_get(E_Client *ec, wl_notify_func_t notify)
9478 API_ENTRY_VAL(NULL);
9479 return wl_signal_get(&priv->events.uniconify, notify);
9483 e_client_maximize_listener_add(E_Client *ec, struct wl_listener *listener)
9486 wl_signal_add(&priv->events.maximize, listener);
9489 EINTERN struct wl_listener *
9490 e_client_maximize_listener_get(E_Client *ec, wl_notify_func_t notify)
9492 API_ENTRY_VAL(NULL);
9493 return wl_signal_get(&priv->events.maximize, notify);
9497 e_client_unmaximize_listener_add(E_Client *ec, struct wl_listener *listener)
9500 wl_signal_add(&priv->events.unmaximize, listener);
9503 EINTERN struct wl_listener *
9504 e_client_unmaximize_listener_get(E_Client *ec, wl_notify_func_t notify)
9506 API_ENTRY_VAL(NULL);
9507 return wl_signal_get(&priv->events.unmaximize, notify);
9511 e_client_fullscreen_pre_listener_add(E_Client *ec, struct wl_listener *listener)
9514 wl_signal_add(&priv->events.fullscreen_pre, listener);
9517 EINTERN struct wl_listener *
9518 e_client_fullscreen_pre_listener_get(E_Client *ec, wl_notify_func_t notify)
9520 API_ENTRY_VAL(NULL);
9521 return wl_signal_get(&priv->events.fullscreen_pre, notify);
9525 e_client_fullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
9528 wl_signal_add(&priv->events.fullscreen, listener);
9531 EINTERN struct wl_listener *
9532 e_client_fullscreen_listener_get(E_Client *ec, wl_notify_func_t notify)
9534 API_ENTRY_VAL(NULL);
9535 return wl_signal_get(&priv->events.fullscreen, notify);
9539 e_client_unfullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
9542 wl_signal_add(&priv->events.unfullscreen, listener);
9545 EINTERN struct wl_listener *
9546 e_client_unfullscreen_listener_get(E_Client *ec, wl_notify_func_t notify)
9548 API_ENTRY_VAL(NULL);
9549 return wl_signal_get(&priv->events.unfullscreen, notify);
9553 e_client_move_listener_add(E_Client *ec, struct wl_listener *listener)
9556 wl_signal_add(&priv->events.move, listener);
9559 EINTERN struct wl_listener *
9560 e_client_move_listener_get(E_Client *ec, wl_notify_func_t notify)
9562 API_ENTRY_VAL(NULL);
9563 return wl_signal_get(&priv->events.move, notify);
9567 e_client_raise_listener_add(E_Client *ec, struct wl_listener *listener)
9570 wl_signal_add(&priv->events.raise, listener);
9573 EINTERN struct wl_listener *
9574 e_client_raise_listener_get(E_Client *ec, wl_notify_func_t notify)
9576 API_ENTRY_VAL(NULL);
9577 return wl_signal_get(&priv->events.raise, notify);
9581 e_client_lower_listener_add(E_Client *ec, struct wl_listener *listener)
9584 wl_signal_add(&priv->events.lower, listener);
9587 EINTERN struct wl_listener *
9588 e_client_lower_listener_get(E_Client *ec, wl_notify_func_t notify)
9590 API_ENTRY_VAL(NULL);
9591 return wl_signal_get(&priv->events.lower, notify);
9595 e_client_stack_below_listener_add(E_Client *ec, struct wl_listener *listener)
9598 wl_signal_add(&priv->events.stack_below, listener);
9601 EINTERN struct wl_listener *
9602 e_client_stack_below_listener_get(E_Client *ec, wl_notify_func_t notify)
9604 API_ENTRY_VAL(NULL);
9605 return wl_signal_get(&priv->events.stack_below, notify);
9609 e_client_stack_above_listener_add(E_Client *ec, struct wl_listener *listener)
9612 wl_signal_add(&priv->events.stack_above, listener);
9615 EINTERN struct wl_listener *
9616 e_client_stack_above_listener_get(E_Client *ec, wl_notify_func_t notify)
9618 API_ENTRY_VAL(NULL);
9619 return wl_signal_get(&priv->events.stack_above, notify);
9623 e_client_layer_set_listener_add(E_Client *ec, struct wl_listener *listener)
9626 wl_signal_add(&priv->events.layer_set, listener);
9629 EINTERN struct wl_listener *
9630 e_client_layer_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9632 API_ENTRY_VAL(NULL);
9633 return wl_signal_get(&priv->events.layer_set, notify);
9637 e_client_stack_transient_for_done_listener_add(E_Client *ec, struct wl_listener *listener)
9640 wl_signal_add(&priv->events.stack_transient_for_done, listener);
9643 EINTERN struct wl_listener *
9644 e_client_stack_transient_for_done_listener_get(E_Client *ec, wl_notify_func_t notify)
9646 API_ENTRY_VAL(NULL);
9647 return wl_signal_get(&priv->events.stack_transient_for_done, notify);
9651 e_client_stick_listener_add(E_Client *ec, struct wl_listener *listener)
9654 wl_signal_add(&priv->events.stick, listener);
9657 EINTERN struct wl_listener *
9658 e_client_stick_listener_get(E_Client *ec, wl_notify_func_t notify)
9660 API_ENTRY_VAL(NULL);
9661 return wl_signal_get(&priv->events.stick, notify);
9665 e_client_unstick_listener_add(E_Client *ec, struct wl_listener *listener)
9668 wl_signal_add(&priv->events.unstick, listener);
9671 EINTERN struct wl_listener *
9672 e_client_unstick_listener_get(E_Client *ec, wl_notify_func_t notify)
9674 API_ENTRY_VAL(NULL);
9675 return wl_signal_get(&priv->events.unstick, notify);