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 //#ifdef REFACTOR_ZONE_DESK
180 [E_CLIENT_HOOK_FULLSCREEN] = NULL,
181 [E_CLIENT_HOOK_UNFULLSCREEN] = NULL,
183 [E_CLIENT_HOOK_DEL] = NULL,
184 [E_CLIENT_HOOK_UNREDIRECT] = NULL,
185 [E_CLIENT_HOOK_REDIRECT] = NULL,
186 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
187 [E_CLIENT_HOOK_NEW_CLIENT_POST] = NULL,
189 [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL,
190 [E_CLIENT_HOOK_ICONIFY] = NULL,
191 [E_CLIENT_HOOK_UNICONIFY] = NULL,
192 [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL,
193 [E_CLIENT_HOOK_WINDOW_ROLE_CHANGE] = NULL,
194 [E_CLIENT_HOOK_TRANSFORM_CHANGE] = NULL,
195 [E_CLIENT_HOOK_ACTIVATE_DONE] = NULL,
196 [E_CLIENT_HOOK_EVAL_VISIBILITY_END] = NULL,
197 //#ifdef REFACTOR_FOCUS_POLICY
198 [E_CLIENT_HOOK_MOUSE_IN] = NULL,
199 [E_CLIENT_HOOK_MOUSE_OUT] = NULL,
200 [E_CLIENT_HOOK_MOUSE_DOWN] = NULL,
201 [E_CLIENT_HOOK_LOWER] = NULL,
202 [E_CLIENT_HOOK_MOVE] = NULL,
203 [E_CLIENT_HOOK_FOCUS_DEFER_SET] = NULL,
204 [E_CLIENT_HOOK_FOCUS_LATEST_SET] = NULL,
206 //#ifdef REFACTOR_ZONE_DESK
207 [E_CLIENT_HOOK_STICK] = NULL,
208 [E_CLIENT_HOOK_UNSTICK] = NULL,
209 [E_CLIENT_HOOK_MAXIMIZE] = NULL,
210 [E_CLIENT_HOOK_UNMAXIMIZE] = NULL,
214 static Eina_Inlist *_e_client_intercept_hooks[] =
216 [E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT] = NULL,
217 [E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT] = NULL,
220 ///////////////////////////////////////////
223 _e_client_hooks_clean(void)
229 for (x = 0; x < E_CLIENT_HOOK_LAST; x++)
230 EINA_INLIST_FOREACH_SAFE(_e_client_hooks[x], l, ch)
232 if (!ch->delete_me) continue;
233 _e_client_hooks[x] = eina_inlist_remove(_e_client_hooks[x], EINA_INLIST_GET(ch));
239 _e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
243 e_object_ref(E_OBJECT(ec));
244 _e_client_hooks_walking++;
245 EINA_INLIST_FOREACH(_e_client_hooks[hookpoint], ch)
247 if (ch->delete_me) continue;
248 ch->func(ch->data, ec);
249 if ((hookpoint != E_CLIENT_HOOK_DEL) &&
250 (hookpoint != E_CLIENT_HOOK_MOVE_END) &&
251 (hookpoint != E_CLIENT_HOOK_RESIZE_END) &&
252 (hookpoint != E_CLIENT_HOOK_FOCUS_UNSET) &&
253 e_object_is_del(E_OBJECT(ec)))
256 _e_client_hooks_walking--;
257 if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
258 _e_client_hooks_clean();
259 return !!e_object_unref(E_OBJECT(ec));
262 ///////////////////////////////////////////
265 _e_client_intercept_hooks_clean(void)
268 E_Client_Intercept_Hook *ch;
271 for (x = 0; x < E_CLIENT_INTERCEPT_HOOK_LAST; x++)
272 EINA_INLIST_FOREACH_SAFE(_e_client_intercept_hooks[x], l, ch)
274 if (!ch->delete_me) continue;
275 _e_client_intercept_hooks[x] =
276 eina_inlist_remove(_e_client_intercept_hooks[x], EINA_INLIST_GET(ch));
282 _e_client_intercept_hook_call(E_Client_Intercept_Hook_Point hookpoint, E_Client *ec)
284 E_Client_Intercept_Hook *ch;
285 Eina_Bool ret = EINA_TRUE;
287 if (e_object_is_del(E_OBJECT(ec)))
289 if (hookpoint != E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT)
295 e_object_ref(E_OBJECT(ec));
296 _e_client_intercept_hooks_walking++;
297 EINA_INLIST_FOREACH(_e_client_intercept_hooks[hookpoint], ch)
299 if (ch->delete_me) continue;
300 if (!(ch->func(ch->data, ec)))
306 _e_client_intercept_hooks_walking--;
307 if ((_e_client_intercept_hooks_walking == 0) &&
308 (_e_client_intercept_hooks_delete > 0))
309 _e_client_intercept_hooks_clean();
311 e_object_unref(E_OBJECT(ec));
316 _e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
319 e_object_unref(E_OBJECT(ev->ec));
324 _e_client_event_simple(E_Client *ec, int type)
328 ev = E_NEW(E_Event_Client, 1);
332 e_object_ref(E_OBJECT(ec));
333 ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
337 _e_client_event_add(E_Client *ec)
342 ec->reg_ev.add = EINA_TRUE;
343 ELOGF("COMP", "SEND E_EVENT_CLIENT_ADD event", ec);
344 _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
348 _e_client_event_remove(E_Client *ec)
353 ec->reg_ev.add = EINA_FALSE;
354 ELOGF("COMP", "SEND E_EVENT_CLIENT_REMOVE event", ec);
355 _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
359 _e_client_event_show(E_Client *ec)
364 ec->reg_ev.show = EINA_TRUE;
365 _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
369 _e_client_event_hide(E_Client *ec)
371 if (!ec->reg_ev.show)
374 ec->reg_ev.show = EINA_FALSE;
375 _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
379 _e_client_event_property(E_Client *ec, int prop)
381 E_Event_Client_Property *ev;
383 ev = E_NEW(E_Event_Client_Property, 1);
388 e_object_ref(E_OBJECT(ec));
389 ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
392 #ifdef REFACTOR_ZONE_DESK
395 _e_client_event_desk_set_free(void *d EINA_UNUSED, E_Event_Client_Desk_Set *ev)
398 e_object_unref(E_OBJECT(ev->ec));
399 e_object_unref(E_OBJECT(ev->desk));
404 _e_client_event_zone_set_free(void *d EINA_UNUSED, E_Event_Client_Zone_Set *ev)
407 e_object_unref(E_OBJECT(ev->ec));
408 e_object_unref(E_OBJECT(ev->zone));
412 ////////////////////////////////////////////////
415 _e_client_action_input_win_del(void)
417 if (!comp_grabbed) return 0;
419 e_comp_ungrab_input(1, 1);
425 _e_client_action_finish(void)
428 _e_client_action_input_win_del();
430 E_FREE_FUNC(action_timer, ecore_timer_del);
431 E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
434 action_client->keyboard_resizing = 0;
436 action_client = NULL;
440 _e_client_transform_point_transform(int cx, int cy, double angle, int x, int y, int *tx, int *ty)
442 double s = sin(angle * M_PI / 180);
443 double c = cos(angle * M_PI / 180);
450 ry = - x * s + y * c;
460 _e_client_transform_geometry_save(E_Client *ec, E_Map *map)
466 for (i = 0; i < 4; i ++)
468 e_map_point_precise_coord_get(map, i,
469 &ec->transform.saved[i].x,
470 &ec->transform.saved[i].y,
471 &ec->transform.saved[i].z);
476 _e_client_transform_resize(E_Client *ec)
480 double dx = 0, dy = 0;
485 if (!ec->transformed) return;
487 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
493 cx = ec->client.x + pw / 2;
494 cy = ec->client.y + ph / 2;
496 /* step 1: Rotate resized object and get map points */
497 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
498 e_map_util_points_populate_from_geometry(map,
499 ec->client.x, ec->client.y,
502 e_map_util_rotate(map, ec->transform.angle, cx, cy);
503 e_map_util_zoom(map, ec->transform.zoom, ec->transform.zoom, cx, cy);
505 for (i = 0; i < 4; i++)
506 e_map_point_precise_coord_get(map, i, &px[i], &py[i], NULL);
510 /* step 2: get adjusted values to keep up fixed position according
512 switch (ec->resize_mode)
514 case E_POINTER_RESIZE_R:
515 case E_POINTER_RESIZE_BR:
516 dx = ec->transform.saved[0].x - px[0];
517 dy = ec->transform.saved[0].y - py[0];
519 case E_POINTER_RESIZE_BL:
520 case E_POINTER_RESIZE_B:
521 dx = ec->transform.saved[1].x - px[1];
522 dy = ec->transform.saved[1].y - py[1];
524 case E_POINTER_RESIZE_TL:
525 case E_POINTER_RESIZE_L:
526 dx = ec->transform.saved[2].x - px[2];
527 dy = ec->transform.saved[2].y - py[2];
529 case E_POINTER_RESIZE_T:
530 case E_POINTER_RESIZE_TR:
531 dx = ec->transform.saved[3].x - px[3];
532 dy = ec->transform.saved[3].y - py[3];
538 ec->transform.adjusted.x = dx;
539 ec->transform.adjusted.y = dy;
541 /* step 3: set each points of the quadrangle */
542 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
543 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
545 for (i = 0; i < 4; i++)
546 e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0);
548 e_client_map_set(ec, map);
549 e_client_map_enable_set(ec, EINA_TRUE);
554 _e_client_transform_resize_handle(E_Client *ec)
557 int new_x, new_y, new_w, new_h;
561 Evas_Point current, moveinfo;
564 if (e_object_is_del(E_OBJECT(ec))) return;
565 if (e_client_util_ignored_get(ec)) return;
566 if (!ec->transformed) return;
568 zone = e_comp_zone_find_by_ec(ec);
571 button_id = ec->moveinfo.down.button;
573 org_w = ec->mouse.last_down[button_id - 1].w;
574 org_h = ec->mouse.last_down[button_id - 1].h;
576 new_w = ec->client.w;
577 new_h = ec->client.h;
578 new_x = ec->client.x;
579 new_y = ec->client.y;
581 /* step 1: get center coordinate its' based on original object geometry*/
582 cx = ec->client.x + org_w / 2;
583 cy = ec->client.y + org_h / 2;
585 /* step 2: transform coordinates of mouse position
586 * subtract adjusted value from mouse position is needed */
587 current.x = ec->mouse.current.mx - ec->transform.adjusted.x;
588 current.y = ec->mouse.current.my - ec->transform.adjusted.y;
589 moveinfo.x = ec->moveinfo.down.mx - ec->transform.adjusted.x;
590 moveinfo.y = ec->moveinfo.down.my - ec->transform.adjusted.y;
592 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
593 current.x, current.y,
594 ¤t.x, ¤t.y);
595 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
596 moveinfo.x, moveinfo.y,
597 &moveinfo.x, &moveinfo.y);
599 /* step 3: calculate new size */
600 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
601 (ec->resize_mode == E_POINTER_RESIZE_R) ||
602 (ec->resize_mode == E_POINTER_RESIZE_BR))
604 if ((button_id >= 1) && (button_id <= 3))
605 new_w = org_w + (current.x - moveinfo.x);
607 new_w = ec->moveinfo.down.w + (current.x - moveinfo.x);
609 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
610 (ec->resize_mode == E_POINTER_RESIZE_L) ||
611 (ec->resize_mode == E_POINTER_RESIZE_BL))
613 if ((button_id >= 1) && (button_id <= 3))
614 new_w = org_w - (current.x - moveinfo.x);
616 new_w = ec->moveinfo.down.w - (current.x - moveinfo.x);
619 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
620 (ec->resize_mode == E_POINTER_RESIZE_T) ||
621 (ec->resize_mode == E_POINTER_RESIZE_TR))
623 if ((button_id >= 1) && (button_id <= 3))
624 new_h = org_h - (current.y - moveinfo.y);
626 new_h = ec->moveinfo.down.h - (current.y - moveinfo.y);
628 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
629 (ec->resize_mode == E_POINTER_RESIZE_B) ||
630 (ec->resize_mode == E_POINTER_RESIZE_BR))
632 if ((button_id >= 1) && (button_id <= 3))
633 new_h = org_h + (current.y - moveinfo.y);
635 new_h = ec->moveinfo.down.h + (current.y - moveinfo.y);
638 new_w = MIN(new_w, zone->w);
639 new_h = MIN(new_h, zone->h);
641 /* step 4: move to new position */
642 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
643 (ec->resize_mode == E_POINTER_RESIZE_L) ||
644 (ec->resize_mode == E_POINTER_RESIZE_BL))
645 new_x += (new_w - org_w);
646 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
647 (ec->resize_mode == E_POINTER_RESIZE_T) ||
648 (ec->resize_mode == E_POINTER_RESIZE_TR))
649 new_y += (new_h - org_h);
651 /* step 5: set geometry to new value */
652 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
656 _e_client_transform_resize_begin(E_Client *ec)
659 if (!ec->transformed) return;
661 map = e_client_map_get(ec);
662 _e_client_transform_geometry_save(ec, map);
667 _e_client_transform_resize_end(E_Client *ec)
670 int new_x = 0, new_y = 0;
673 if (!ec->transformed) return;
675 map = e_client_map_get(ec);
678 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
684 cx = ec->client.x + pw / 2 + ec->transform.adjusted.x;
685 cy = ec->client.y + ph / 2 + ec->transform.adjusted.y;
687 if (ec->transform.zoom != 1.0)
691 tmp_map = e_map_dup(map);
692 e_map_util_zoom(tmp_map,
693 1 / ec->transform.zoom,
694 1 / ec->transform.zoom,
697 _e_client_transform_geometry_save(ec, tmp_map);
702 _e_client_transform_geometry_save(ec, map);
705 /* move original object to adjusted position after resizing */
706 _e_client_transform_point_transform(cx, cy,
708 ec->transform.saved[0].x,
709 ec->transform.saved[0].y,
711 e_client_util_move_without_frame(ec, new_x, new_y);
712 e_map_util_object_move_sync_set(map, EINA_TRUE);
717 _e_client_transform_move_end(E_Client *ec)
721 double dx, dy, px, py;
724 if (!ec->transformed) return;
726 map = e_client_map_get(ec);
729 if (ec->transform.zoom != 1.0)
731 e_map_point_precise_coord_get(map, 0, &px, &py, NULL);
733 dx = px - ec->transform.saved[0].x;
734 dy = py - ec->transform.saved[0].y;
736 for (i = 0; i < 4; i++)
738 ec->transform.saved[i].x += dx;
739 ec->transform.saved[i].y += dy;
743 _e_client_transform_geometry_save(ec, map);
748 e_client_intercept_hook_focus_revert_call(E_Client *ec)
750 // no need to call the intercept hook if ec is NULL.
751 if (!ec) return EINA_FALSE;
753 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
755 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT Intercepted.", ec);
763 e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
765 E_Client *above = NULL;
767 int x = 0, y = 0, w = 0, h = 0;
768 int ax = 0, ay = 0, aw = 0, ah = 0;
770 if (!ec) return NULL;
772 e_client_geometry_get(ec, &x, &y, &w, &h);
774 zone = e_comp_zone_find_by_ec(ec);
776 E_RECTS_CLIP_TO_RECT(x, y, w, h, zone->x, zone->y, zone->w, zone->h);
778 above = e_client_above_get(ec);
782 (above->layer <= ec->layer))
784 above = e_client_above_get(above);
788 if ((!e_object_is_del(E_OBJECT(above))) &&
789 (!e_client_util_ignored_get(above)) &&
791 (!above->iconic || e_policy_visibility_client_is_uniconic(above)) &&
792 (!above->bg_state) &&
794 (!above->visibility.force_obscured) &&
797 e_client_geometry_get(above, &ax, &ay, &aw, &ah);
798 if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h))
801 above = e_client_above_get(above);
808 e_client_check_obscured_by_children_group(E_Client *ec)
810 E_Client *cec = NULL;
811 Eina_List *transients = NULL, *l = NULL;
813 _e_client_transient_for_group_make(ec, &transients);
814 if (!transients) return NULL;
816 EINA_LIST_FOREACH(transients, l, cec)
818 if (E_CONTAINS(cec->x, cec->y, cec->w, cec->h, ec->x, ec->y, ec->w, ec->h))
820 if (!cec->argb) break;
821 if (cec->visibility.opaque > 0) break;
825 eina_list_free(transients);
831 e_client_check_really_iconified(E_Client *ec)
833 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
835 if (!ec->iconic) return EINA_FALSE;
837 return ((!e_policy_visibility_client_is_uniconic(ec) &&
838 !e_policy_visibility_client_is_uniconify_render_running(ec)) ||
839 (e_client_is_iconified_by_client(ec)));
842 #ifdef REFACTOR_FOCUS_POLICY
845 _e_client_focus_can_take_by_vis_obscured(E_Client *ec)
847 switch (ec->visibility.obscured)
849 case E_VISIBILITY_UNKNOWN:
850 if (e_client_check_really_iconified(ec))
853 if (!evas_object_visible_get(ec->frame) &&
854 !eina_list_data_find(defer_focus_stack, ec))
858 case E_VISIBILITY_FULLY_OBSCURED:
859 if (e_client_check_really_iconified(ec))
862 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
864 if (!evas_object_visible_get(ec->frame))
866 ELOGF("FOCUS", "client is hidden, skip focus", ec);
872 case E_VISIBILITY_UNOBSCURED:
873 case E_VISIBILITY_PARTIALLY_OBSCURED:
874 case E_VISIBILITY_PRE_UNOBSCURED:
882 _e_client_focus_can_take(E_Client *ec)
885 E_Client *child_ec = NULL;
886 E_Client *above_ec = NULL;
887 int x = 0, y = 0, w = 0, h = 0;
889 if (!ec) return EINA_FALSE;
890 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
891 if (e_client_util_ignored_get(ec)) return EINA_FALSE;
893 if (!(ec->icccm.accepts_focus || ec->icccm.take_focus)) return EINA_FALSE;
894 if (ec->lock_focus_in || ec->lock_focus_out) return EINA_FALSE;
896 if (!ec->visible) return EINA_FALSE;
897 if (ec->bg_state) return EINA_FALSE;
898 if (ec->visibility.force_obscured) return EINA_FALSE;
899 if (!_e_client_focus_can_take_by_vis_obscured(ec)) return EINA_FALSE;
901 zone = e_comp_zone_find_by_ec(ec);
904 e_client_geometry_get(ec, &x, &y, &w, &h);
905 if (!E_INTERSECTS(zone->x, zone->y, zone->w, zone->h, x, y, w, h))
909 above_ec = e_client_check_fully_contain_by_above(ec, EINA_FALSE);
912 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
914 if (!evas_object_visible_get(above_ec->frame))
918 child_ec = e_client_check_obscured_by_children_group(ec);
919 if (!child_ec) return EINA_FALSE;
920 if (above_ec != child_ec) return EINA_FALSE;
922 if (_e_client_focus_can_take(child_ec))
924 else if (e_client_check_fully_contain_by_above(child_ec, EINA_FALSE))
932 e_client_focus_can_take(E_Client *ec)
934 return _e_client_focus_can_take(ec);
938 _e_client_focus_topmost_focusable_get(void)
942 E_CLIENT_REVERSE_FOREACH(ec)
944 if (_e_client_focus_can_take(ec))
951 _e_client_find_next_focus(E_Client *ec)
954 E_Client *temp_ec = NULL;
956 // call the intercept hook of the revert focus
957 if (e_client_intercept_hook_focus_revert_call(ec))
960 EINA_LIST_FOREACH(focus_stack, l, temp_ec)
962 if (_e_client_focus_can_take(temp_ec))
970 _e_client_revert_focus_get(E_Client *ec)
972 E_Client *pec = NULL, *focus_ec = NULL;
976 if (stopping) return NULL;
978 return _e_client_find_next_focus(NULL);
980 zone = e_comp_zone_find_by_ec(ec);
981 if (!zone) return NULL;
982 desk = e_desk_current_get(zone);
983 if (!desk) return NULL;
984 if (!e_comp_client_zone_is_displaying(ec)) return NULL;
986 if (e_config->focus_policy == E_FOCUS_MOUSE)
988 // set mouse over focus
989 pec = e_client_under_pointer_get(desk, ec);
992 /* no autoraise/revert here because it's probably annoying */
995 focus_ec = _e_client_find_next_focus(ec);
1002 _e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client)
1004 E_Event_Client_Focus_Skip_Set *ev;
1006 ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1);
1010 ev->by_client = by_client;
1011 e_object_ref(E_OBJECT(ec));
1013 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
1017 _e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client)
1019 E_Event_Client_Focus_Skip_Unset *ev;
1021 ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1);
1025 ev->by_client = by_client;
1026 e_object_ref(E_OBJECT(ec));
1028 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
1032 e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client)
1038 if (ec->icccm.accepts_focus)
1040 ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client);
1041 ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
1042 ec->changes.accepts_focus = 1;
1045 _e_client_event_focus_skip_set(ec, by_client);
1050 if (!ec->icccm.accepts_focus)
1052 ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client);
1053 ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
1054 ec->changes.accepts_focus = 1;
1057 _e_client_event_focus_skip_unset(ec, by_client);
1062 #ifdef REFACTOR_FOCUS_POLICY
1065 e_client_revert_focus(E_Client *ec)
1067 E_Client *focus_ec = NULL;
1069 // check topmost focus policy
1070 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
1072 focus_ec = _e_client_focus_topmost_focusable_get();
1073 if (focused == focus_ec) return;
1077 if (!focus_ec->iconic || focus_ec->exp_iconify.buffer_flush)
1079 ELOGF("FOCUS", "focus set | topmost_focus", focus_ec);
1080 if (focused) e_client_frame_focus_set(focused, EINA_FALSE);
1081 e_client_frame_focus_set(focus_ec, EINA_TRUE);
1086 ELOGF("FOCUS", "focus unset | No focusable ec", focused);
1087 e_client_frame_focus_set(focused, EINA_FALSE);
1093 focus_ec = _e_client_revert_focus_get(ec);
1094 if (!focus_ec) return;
1098 e_client_focus_defer_unset(ec);
1099 ELOGF("FOCUS", "focus unset | revert_focus", ec);
1100 e_client_frame_focus_set(ec, EINA_FALSE);
1103 if (!focus_ec->iconic || focus_ec->exp_iconify.buffer_flush)
1105 ELOGF("FOCUS", "focus set | revert_focus", focus_ec);
1106 e_client_frame_focus_set(focus_ec, EINA_TRUE);
1112 e_client_check_above_focused(E_Client *ec)
1114 E_Client *focus = NULL;
1115 E_Client *above = NULL;
1117 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
1119 focus = e_client_focused_get();
1120 if (!focus) return EINA_FALSE;
1122 above = e_client_above_get(ec);
1128 above = e_client_above_get(above);
1135 _e_client_private_init(E_Client *ec)
1137 E_Client_Private *priv;
1139 priv = E_NEW(E_Client_Private, 1);
1143 wl_signal_init(&priv->events.eval_pre_fetch);
1144 wl_signal_init(&priv->events.eval_fetch);
1145 wl_signal_init(&priv->events.eval_pre_post_fetch);
1146 wl_signal_init(&priv->events.eval_post_fetch);
1147 wl_signal_init(&priv->events.eval_pre_frame_assign);
1148 wl_signal_init(&priv->events.eval_post_frame_assign);
1149 wl_signal_init(&priv->events.eval_pre_new_client);
1150 wl_signal_init(&priv->events.eval_post_new_client);
1151 wl_signal_init(&priv->events.eval_visibility);
1152 wl_signal_init(&priv->events.eval_visibility_end);
1153 wl_signal_init(&priv->events.eval_end);
1154 wl_signal_init(&priv->events.move_begin);
1155 wl_signal_init(&priv->events.move_update);
1156 wl_signal_init(&priv->events.move_end);
1157 wl_signal_init(&priv->events.move_resize_begin);
1158 wl_signal_init(&priv->events.move_resize_update);
1159 wl_signal_init(&priv->events.move_resize_end);
1160 wl_signal_init(&priv->events.destroy);
1161 wl_signal_init(&priv->events.new_client);
1162 wl_signal_init(&priv->events.new_client_post);
1163 wl_signal_init(&priv->events.unredirect);
1164 wl_signal_init(&priv->events.redirect);
1165 wl_signal_init(&priv->events.aux_hint_change);
1166 wl_signal_init(&priv->events.window_role_change);
1167 wl_signal_init(&priv->events.transform_change);
1168 wl_signal_init(&priv->events.activate_done);
1169 wl_signal_init(&priv->events.mouse_in);
1170 wl_signal_init(&priv->events.mouse_out);
1171 wl_signal_init(&priv->events.mouse_down);
1172 wl_signal_init(&priv->events.focus_set);
1173 wl_signal_init(&priv->events.focus_unset);
1174 wl_signal_init(&priv->events.focus_defer_set);
1175 wl_signal_init(&priv->events.focus_latest_set);
1176 wl_signal_init(&priv->events.iconify);
1177 wl_signal_init(&priv->events.uniconify);
1178 wl_signal_init(&priv->events.maximize);
1179 wl_signal_init(&priv->events.unmaximize);
1180 wl_signal_init(&priv->events.fullscreen_pre);
1181 wl_signal_init(&priv->events.fullscreen);
1182 wl_signal_init(&priv->events.unfullscreen);
1183 wl_signal_init(&priv->events.move);
1184 wl_signal_init(&priv->events.layer_set);
1185 wl_signal_init(&priv->events.raise);
1186 wl_signal_init(&priv->events.lower);
1187 wl_signal_init(&priv->events.stack_below);
1188 wl_signal_init(&priv->events.stack_above);
1189 wl_signal_init(&priv->events.stack_transient_for_done);
1190 wl_signal_init(&priv->events.stick);
1191 wl_signal_init(&priv->events.unstick);
1193 e_object_data_set(E_OBJECT(ec), priv);
1199 _e_client_private_finish(E_Client *ec)
1201 E_Client_Private *priv;
1204 e_object_data_set(E_OBJECT(ec), NULL);
1210 _e_client_free(E_Client *ec)
1212 e_comp_object_redirected_set(ec->frame, 0);
1213 e_comp_object_render_update_del(ec->frame);
1215 E_OBJECT(ec)->references++;
1216 #ifdef REFACTOR_ZONE_DESK
1220 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
1221 if (!ec->desk->fullscreen_clients)
1222 e_comp_render_queue();
1226 e_comp->new_clients--;
1228 if (ec->e.state.video_parent && ec->e.state.video_parent_client)
1230 ec->e.state.video_parent_client->e.state.video_child =
1231 eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
1233 if (ec->e.state.video_child)
1237 EINA_LIST_FREE(ec->e.state.video_child, tmp)
1238 tmp->e.state.video_parent_client = NULL;
1240 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1241 E_FREE_LIST(ec->pending_resize, free);
1243 E_FREE_FUNC(ec->map_timer, ecore_timer_del);
1245 ec->transients = eina_list_free(ec->transients);
1246 if (ec->netwm.icons)
1249 for (i = 0; i < ec->netwm.num_icons; i++)
1250 free(ec->netwm.icons[i].data);
1251 E_FREE(ec->netwm.icons);
1253 E_FREE(ec->netwm.extra_types);
1254 eina_stringshare_replace(&ec->border.name, NULL);
1255 eina_stringshare_replace(&ec->bordername, NULL);
1256 eina_stringshare_replace(&ec->icccm.name, NULL);
1257 #if defined(__cplusplus) || defined(c_plusplus)
1258 eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
1260 eina_stringshare_replace(&ec->icccm.class, NULL);
1262 eina_stringshare_replace(&ec->icccm.title, NULL);
1263 eina_stringshare_replace(&ec->icccm.icon_name, NULL);
1264 eina_stringshare_replace(&ec->icccm.machine, NULL);
1265 eina_stringshare_replace(&ec->icccm.window_role, NULL);
1266 if ((ec->icccm.command.argc > 0) && (ec->icccm.command.argv))
1270 for (i = 0; i < ec->icccm.command.argc; i++)
1271 free(ec->icccm.command.argv[i]);
1272 E_FREE(ec->icccm.command.argv);
1274 eina_stringshare_replace(&ec->netwm.name, NULL);
1275 eina_stringshare_replace(&ec->netwm.icon_name, NULL);
1276 eina_stringshare_replace(&ec->internal_icon, NULL);
1277 eina_stringshare_replace(&ec->internal_icon_key, NULL);
1279 #ifdef REFACTOR_FOCUS_POLICY
1280 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1282 focus_stack = eina_list_remove(focus_stack, ec);
1283 e_client_focus_defer_unset(ec);
1286 E_FREE_FUNC(ec->frame, evas_object_del);
1288 #ifdef REFACTOR_FOCUS_POLICY
1289 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_topmost.c and e_focus_policy_history.c
1293 ELOGF("COMP", "CRITICAL. focused is deleted ec.", ec);
1294 ELOGF("FOCUS", "CLIENT FOCUS_SET", NULL);
1295 g_mutex_lock(&focused_ec_mutex);
1297 g_mutex_unlock(&focused_ec_mutex);
1301 E_OBJECT(ec)->references--;
1302 ELOGF("COMP", "CLIENT FREE", ec);
1304 e_uuid_store_entry_del(ec->uuid);
1305 #ifdef REFACTOR_ZONE_DESK
1307 e_desk_client_del(ec->desk, ec);
1310 _e_client_private_finish(ec);
1315 _e_client_del(E_Client *ec)
1322 #ifdef REFACTOR_FOCUS_POLICY
1323 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1325 focus_stack = eina_list_remove(focus_stack, ec);
1326 e_client_focus_defer_unset(ec);
1328 #ifdef REFACTOR_ZONE_DESK
1330 e_desk_visible_client_iconified_list_remove(ec->desk, ec);
1332 if (ec == e_comp_object_dim_client_get())
1334 INF("[DIM] client deleted\n");
1335 e_comp_object_dim_client_set(NULL);
1338 if (ec->cur_mouse_action)
1340 if (ec->cur_mouse_action->func.end)
1341 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1343 if (action_client == ec) _e_client_action_finish();
1347 e_client_comp_hidden_set(ec, 1);
1348 evas_object_pass_events_set(ec->frame, 1);
1350 #ifdef REFACTOR_FOCUS_POLICY
1351 // This code is executed at E_CLIENT_HOOK_DEL callback at e_focus_policy_history.c
1354 e_client_revert_focus(ec);
1357 E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
1359 wl_signal_emit_mutable(&PRI(ec)->events.destroy, NULL);
1361 /* must be called before parent/child clear */
1362 _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
1364 _e_client_event_remove(ec);
1366 ELOGF("COMP", "CLIENT DEL", ec);
1370 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
1373 EINA_LIST_FREE(ec->transients, child)
1374 child->parent = NULL;
1376 type = e_pixmap_type_get(ec->pixmap);
1377 if (type < E_PIXMAP_TYPE_MAX)
1378 eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
1379 e_comp->clients = eina_list_remove(e_comp->clients, ec);
1380 e_comp_object_render_update_del(ec->frame);
1381 e_comp_post_update_purge(ec);
1382 if (e_pixmap_free(ec->pixmap))
1383 e_pixmap_client_set(ec->pixmap, NULL);
1386 // base_output_resolution
1387 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
1388 e_util_transform_del(ec->base_output_resolution.transform);
1389 ec->base_output_resolution.transform = NULL;
1390 E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
1392 #ifdef REFACTOR_ZONE_DESK
1395 e_client_transform_core_remove(ec, ec->desk_zoom.transform);
1396 e_util_transform_del(ec->desk_zoom.transform);
1397 ec->desk_zoom.transform = NULL;
1398 E_FREE_FUNC(ec->desk_zoom.hook_subsurf_create, e_comp_wl_hook_del);
1401 if (ec->transform_core.transform_list)
1403 E_Util_Transform *transform;
1405 EINA_LIST_FREE(ec->transform_core.transform_list, transform)
1407 e_util_transform_unref(transform);
1411 ec->transform_core.result.enable = EINA_FALSE;
1413 #ifdef REFACTOR_ZONE_DESK
1415 e_client_desk_area_set(ec, NULL);
1416 e_util_transform_del(ec->desk_area.transform);
1417 ec->desk_area.transform = NULL;
1420 _e_client_resize_object_del(ec);
1422 e_comp_visibility_calculation_set(EINA_TRUE);
1425 ///////////////////////////////////////////
1428 _e_client_cb_kill_timer(void *data)
1430 E_Client *ec = data;
1432 // dont wait until it's hung -
1435 if (ec->netwm.pid > 1)
1436 kill(ec->netwm.pid, SIGKILL);
1438 ec->kill_timer = NULL;
1439 return ECORE_CALLBACK_CANCEL;
1443 _e_client_cb_ping_poller(void *data)
1448 if (e_object_is_del(E_OBJECT(ec)))
1450 ec->ping_poller = NULL;
1451 return ECORE_CALLBACK_CANCEL;
1459 evas_object_smart_callback_call(ec->frame, "unhung", NULL);
1460 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1465 /* if time between last ping and now is greater
1466 * than half the ping interval... */
1467 if ((ecore_loop_time_get() - ec->ping) >
1468 ((e_config->ping_clients_interval *
1469 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
1474 evas_object_smart_callback_call(ec->frame, "hung", NULL);
1475 /* FIXME: if below dialog is up - hide it now */
1477 if (ec->delete_requested)
1479 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
1480 e_client_act_kill_begin(ec);
1484 ec->ping_poller = NULL;
1486 return ECORE_CALLBACK_CANCEL;
1489 ///////////////////////////////////////////
1492 _e_client_action_input_win_new(void)
1496 CRI("DOUBLE COMP GRAB! ACK!!!!");
1499 comp_grabbed = e_comp_grab_input(1, 1);
1500 if (!comp_grabbed) _e_client_action_input_win_del();
1501 return comp_grabbed;
1505 _e_client_action_init(E_Client *ec)
1507 action_orig.x = ec->x;
1508 action_orig.y = ec->y;
1509 action_orig.w = ec->w;
1510 action_orig.h = ec->h;
1514 action_client->keyboard_resizing = 0;
1520 _e_client_move_begin(E_Client *ec)
1522 if ((ec->fullscreen) || (ec->lock_user_location))
1525 if (!_e_client_action_input_win_new()) return 0;
1529 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
1530 _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
1533 if (ecmove == ec) ecmove = NULL;
1534 _e_client_action_input_win_del();
1537 if (!ec->lock_user_stacking)
1539 if (e_config->border_raise_on_mouse_action)
1544 e_comp_client_override_add(ec);
1550 _e_client_move_end(E_Client *ec)
1553 _e_client_action_input_win_del();
1555 wl_signal_emit_mutable(&PRI(ec)->events.move_end, NULL);
1556 _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
1558 if (ec->transformed)
1559 _e_client_transform_move_end(ec);
1562 e_comp_client_override_del(ec);
1569 _e_client_action_move_timeout(void *data EINA_UNUSED)
1571 _e_client_move_end(action_client);
1572 _e_client_action_finish();
1573 return ECORE_CALLBACK_CANCEL;
1577 _e_client_action_move_timeout_add(void)
1579 E_FREE_FUNC(action_timer, ecore_timer_del);
1580 if (e_config->border_keyboard.timeout)
1581 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
1585 _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1587 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1590 ERR("no action_client!");
1592 if (action_client) _e_client_move_end(action_client);
1593 _e_client_action_finish();
1594 return ECORE_CALLBACK_DONE;
1598 _e_client_moveinfo_gather(E_Client *ec, const char *source)
1600 if (e_util_glob_match(source, "mouse,*,1"))
1601 ec->moveinfo.down.button = 1;
1602 else if (e_util_glob_match(source, "mouse,*,2"))
1603 ec->moveinfo.down.button = 2;
1604 else if (e_util_glob_match(source, "mouse,*,3"))
1605 ec->moveinfo.down.button = 3;
1607 ec->moveinfo.down.button = 0;
1608 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1610 ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
1611 ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
1615 ec->moveinfo.down.mx = ec->mouse.current.mx;
1616 ec->moveinfo.down.my = ec->mouse.current.my;
1621 _e_client_move_handle(E_Client *ec)
1625 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1627 x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
1628 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1629 y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
1630 (ec->mouse.current.my - ec->moveinfo.down.my);
1634 x = ec->moveinfo.down.x +
1635 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1636 y = ec->moveinfo.down.y +
1637 (ec->mouse.current.my - ec->moveinfo.down.my);
1640 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1641 _e_client_stay_within_canvas(ec, x, y, &x, &y);
1644 _e_client_stay_within_canvas_margin(ec, x, y, &x, &y);
1646 evas_object_move(ec->frame, x, y);
1648 if (e_client_transform_core_enable_get(ec))
1650 e_client_transform_core_update(ec);
1654 static Evas_Object *
1655 _e_client_resize_object_rectangle_get(E_Client *ec)
1657 Evas_Object *resize_obj = NULL;
1659 resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame));
1660 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1662 if (e_config->resize_object.customize)
1664 evas_object_color_set(resize_obj,
1665 e_config->resize_object.r,
1666 e_config->resize_object.g,
1667 e_config->resize_object.b,
1668 e_config->resize_object.a);
1671 evas_object_color_set(resize_obj, 128, 128, 128, 100);
1676 static Evas_Object *
1677 _e_client_resize_object_image_get(E_Client *ec)
1680 Evas_Object *resize_obj = NULL;
1682 if (!e_config->resize_object.image_path)
1684 ELOGF("COMP", "NO resize_object image! Make default resize_object", ec);
1688 resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame));
1689 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1691 evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL);
1692 err = evas_object_image_load_error_get(resize_obj);
1693 if (err != EVAS_LOAD_ERROR_NONE)
1695 ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object",
1696 ec, e_config->resize_object.image_path, err);
1697 evas_object_del(resize_obj);
1702 evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h);
1703 evas_object_image_filled_set(resize_obj, EINA_TRUE);
1705 evas_object_image_border_set(resize_obj,
1706 e_config->resize_object.border_width.l,
1707 e_config->resize_object.border_width.r,
1708 e_config->resize_object.border_width.t,
1709 e_config->resize_object.border_width.b);
1714 return _e_client_resize_object_rectangle_get(ec);
1717 static Evas_Object *
1718 _e_client_resize_object_create(E_Client *ec)
1720 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL);
1722 Evas_Object *resize_obj = NULL;
1724 if (_e_client_resize_object_create_cb)
1725 resize_obj = _e_client_resize_object_create_cb(ec);
1728 if (e_config->resize_object.type == 1) // image object
1730 resize_obj = _e_client_resize_object_image_get(ec);
1734 resize_obj = _e_client_resize_object_rectangle_get(ec);
1737 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1739 evas_object_pass_events_set(resize_obj, EINA_TRUE);
1740 evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame));
1741 evas_object_stack_above(resize_obj, ec->frame);
1742 evas_object_name_set(resize_obj, "resize_object");
1748 _e_client_resize_object_del(E_Client *ec)
1750 if (ec == NULL) return;
1751 if (ec->manage_resize.resize_obj == NULL) return;
1753 evas_object_hide(ec->manage_resize.resize_obj);
1754 evas_object_del(ec->manage_resize.resize_obj);
1755 ec->manage_resize.resize_obj = NULL;
1759 _e_client_resize_handle(E_Client *ec)
1762 int new_x, new_y, new_w, new_h;
1764 int trans_x = 0, trans_y = 0;
1765 int trans_w = 0, trans_h = 0;
1767 if (ec->transformed)
1769 _e_client_transform_resize_handle(ec);
1778 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
1779 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1780 (ec->resize_mode == E_POINTER_RESIZE_BR))
1782 if ((ec->moveinfo.down.button >= 1) &&
1783 (ec->moveinfo.down.button <= 3))
1784 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
1785 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1787 w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
1789 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1790 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1791 (ec->resize_mode == E_POINTER_RESIZE_BL))
1793 if ((ec->moveinfo.down.button >= 1) &&
1794 (ec->moveinfo.down.button <= 3))
1795 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
1796 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1798 w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
1801 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1802 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1803 (ec->resize_mode == E_POINTER_RESIZE_TR))
1805 if ((ec->moveinfo.down.button >= 1) &&
1806 (ec->moveinfo.down.button <= 3))
1807 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
1808 (ec->mouse.current.my - ec->moveinfo.down.my);
1810 h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
1812 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
1813 (ec->resize_mode == E_POINTER_RESIZE_B) ||
1814 (ec->resize_mode == E_POINTER_RESIZE_BR))
1816 if ((ec->moveinfo.down.button >= 1) &&
1817 (ec->moveinfo.down.button <= 3))
1818 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
1819 (ec->mouse.current.my - ec->moveinfo.down.my);
1821 h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
1826 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1827 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1828 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1829 (ec->resize_mode == E_POINTER_RESIZE_BL))
1831 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1832 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1833 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1834 (ec->resize_mode == E_POINTER_RESIZE_TR))
1841 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1844 zone = e_comp_zone_find_by_ec(ec);
1847 w = MIN(w, zone->w);
1848 h = MIN(h, zone->h);
1851 e_client_resize_limit(ec, &new_w, &new_h);
1853 if (ec->manage_resize.enable_aspect_ratio)
1855 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1856 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1857 (ec->resize_mode == E_POINTER_RESIZE_BL) ||
1858 (ec->resize_mode == E_POINTER_RESIZE_TR) ||
1859 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1860 (ec->resize_mode == E_POINTER_RESIZE_BR))
1862 new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w;
1864 else if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1865 (ec->resize_mode == E_POINTER_RESIZE_B))
1867 new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h;
1869 new_h += ec->manage_resize.header_h;
1870 new_h += ec->manage_resize.footer_h;
1873 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1874 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1875 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1876 (ec->resize_mode == E_POINTER_RESIZE_BL))
1877 new_x += (w - new_w);
1878 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1879 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1880 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1881 (ec->resize_mode == E_POINTER_RESIZE_TR))
1882 new_y += (h - new_h);
1884 if (e_config->interactive_resize)
1886 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
1890 if (ec->manage_resize.resize_obj == NULL)
1892 ec->manage_resize.resize_obj = _e_client_resize_object_create(ec);
1893 EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj);
1896 if (e_client_transform_core_enable_get(ec))
1898 e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y);
1899 e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h);
1900 evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h);
1903 evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h);
1904 evas_object_show(ec->manage_resize.resize_obj);
1906 ec->manage_resize.x = new_x;
1907 ec->manage_resize.y = new_y;
1908 ec->manage_resize.w = new_w;
1909 ec->manage_resize.h = new_h;
1914 _e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
1916 if (ppu <= 1) return size;
1918 unsigned int remainder = size % ppu;
1919 if (remainder == 0) return size;
1921 int gap = size - start_size;
1922 int new_size = size;
1924 new_size = size + (ppu - remainder);
1926 new_size = size - remainder;
1932 _e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
1936 if (prev_pos == pos)
1939 new_pos = (prev_pos + prev_size) - size;
1945 _e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
1947 if (ec->manage_resize.unit_size <= 1) return;
1949 ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
1950 ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
1952 ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
1953 ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
1957 _e_client_resize_end(E_Client *ec)
1959 ec->resize_mode = E_POINTER_RESIZE_NONE;
1960 _e_client_action_input_win_del();
1962 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_end, NULL);
1963 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
1965 if (ec->transformed)
1966 _e_client_transform_resize_end(ec);
1969 e_comp_client_override_del(ec);
1973 if (!e_config->interactive_resize)
1975 if (ec->manage_resize.resize_obj)
1977 if (ec->manage_resize.unit_size > 1)
1978 _e_client_adjust_geometry_by_resize_ppu(ec);
1980 e_client_frame_geometry_set(ec,
1981 ec->manage_resize.x,
1982 ec->manage_resize.y,
1983 ec->manage_resize.w,
1984 ec->manage_resize.h);
1985 _e_client_resize_object_del(ec);
1993 _e_client_action_resize_timeout(void *data EINA_UNUSED)
1995 _e_client_resize_end(action_client);
1996 _e_client_action_finish();
1997 return ECORE_CALLBACK_CANCEL;
2001 _e_client_action_resize_timeout_add(void)
2003 E_FREE_FUNC(action_timer, ecore_timer_del);
2004 if (e_config->border_keyboard.timeout)
2005 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
2009 _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
2011 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
2014 ERR("no action_client!");
2016 if (action_client) _e_client_resize_end(action_client);
2017 _e_client_action_finish();
2018 return ECORE_CALLBACK_DONE;
2021 ////////////////////////////////////////////////
2024 _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty)
2027 Eina_Bool res = EINA_FALSE;
2028 Eina_List *list = NULL, *l;
2029 Eina_Rectangle *data;
2031 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
2033 e_client_geometry_get(ec, &x, &y, &w, &h);
2034 e_comp_object_input_rect_get(ec->frame, &list);
2037 EINA_LIST_FOREACH(list, l, data)
2039 if ((tx >= x + data->x) && (tx <= x + data->x + data->w) &&
2040 (ty >= y + data->y) && (ty <= y + data->y + data->h))
2046 list = eina_list_free(list);
2050 if ((tx >= x) && (tx <= x + w) &&
2051 (ty >= y) && (ty <= y + h))
2061 _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *client)
2063 /* If a border was specified which should be excluded from the list
2064 * (because it will be closed shortly for example), skip */
2065 if (e_client_util_ignored_get(client) || (!e_desk_has_ec(desk, client))) return EINA_TRUE;
2066 if (!evas_object_visible_get(client->frame)) return EINA_TRUE;
2067 if (e_policy_client_is_cursor(client)) return EINA_TRUE;
2073 _e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
2075 E_Client *ec = NULL, *cec;
2077 E_CLIENT_REVERSE_FOREACH(cec)
2079 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
2080 if ((exclude) && (cec == exclude)) continue;
2081 if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
2083 /* If the layer is higher, the position of the window is higher
2084 * (always on top vs always below) */
2085 if (!ec || (cec->layer > ec->layer))
2092 _e_client_input_rect_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
2094 E_Client *ec = NULL, *cec;
2097 E_CLIENT_REVERSE_FOREACH(cec)
2099 /* If a border was specified which should be excluded from the list
2100 * (because it will be closed shortly for example), skip */
2101 if (e_client_util_ignored_get(cec) || (!e_desk_has_ec(desk, cec))) continue;
2102 if (!evas_object_visible_get(cec->frame)) continue;
2103 if (e_policy_client_is_cursor(cec)) continue;
2104 if ((exclude) && (cec == exclude)) continue;
2105 e_client_geometry_get(cec, &cx, &cy, &cw, &ch);
2106 if (!E_INSIDE(x, y, cx, cy, cw, ch))
2108 /* If the layer is higher, the position of the window is higher
2109 * (always on top vs always below) */
2110 if (ec && (cec->layer <= ec->layer)) continue;
2111 if (_e_client_position_inside_input_rect(cec, x, y))
2119 _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
2121 E_Client *ec = NULL, *cec;
2123 E_CLIENT_REVERSE_FOREACH(cec)
2125 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
2127 Eina_List *list = NULL;
2128 Eina_Rectangle *rect;
2129 Eina_Bool inside = EINA_FALSE;
2130 e_comp_object_input_rect_get(cec->frame, &list);
2133 EINA_LIST_FREE(list, rect)
2135 if (E_INSIDE(x, y, rect->x, rect->y, rect->w, rect->h))
2139 else if (E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
2144 if (!inside) continue;
2145 /* If the layer is higher, the position of the window is higher
2146 * (always on top vs always below) */
2147 if (!ec || (cec->layer > ec->layer))
2154 ////////////////////////////////////////////////
2157 _e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
2160 E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
2163 zone = e_comp_zone_find_by_ec(ec);
2170 if (eina_list_count(e_comp->zones) == 1)
2179 zone_left = e_comp_zone_xy_get((x - w + 5), y);
2180 zone_right = e_comp_zone_xy_get((x + w + 5), y);
2181 zone_above = e_comp_zone_xy_get(x, (y - h + 5));
2182 zone_below = e_comp_zone_xy_get(x, (y + h + 5));
2184 if (!(zone_above) && (y))
2185 zone_above = e_comp_zone_xy_get(x, (h - 5));
2187 if (!(zone_left) && (x))
2188 zone_left = e_comp_zone_xy_get((x - 5), y);
2191 w = zone_right->x + zone_right->w;
2194 w = zone->x + zone->w;
2197 h = zone_below->y + zone_below->h;
2200 h = zone->y + zone->h;
2202 if ((zone_left) && (zone_right))
2203 w = zone->w + zone_right->x;
2205 if ((zone_above) && (zone_below))
2206 h = zone->h + zone_below->y;
2208 if (x) x -= zone->w;
2209 if (y) y -= zone->h;
2211 if (zx) *zx = x > 0 ? x : 0;
2212 if (zy) *zy = y > 0 ? y : 0;
2218 _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
2220 int new_x_max, new_y_max;
2225 zone = e_comp_zone_find_by_ec(ec);
2228 if (new_x) *new_x = x;
2229 if (new_y) *new_y = y;
2233 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
2235 new_x_max = zw - ec->w;
2236 new_y_max = zh - ec->h;
2237 lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
2238 lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
2272 _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
2274 int new_x_max, new_y_max, new_x_min, new_y_min;
2275 int margin_w, margin_h;
2280 zone = e_comp_zone_find_by_ec(ec);
2283 if (new_x) *new_x = x;
2284 if (new_y) *new_y = y;
2291 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
2296 new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
2297 new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
2298 new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
2299 new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
2303 else if (x <= new_x_min)
2308 else if (y <= new_y_min)
2313 ////////////////////////////////////////////////
2314 #ifdef REFACTOR_ZONE_DESK
2317 _e_client_zone_update(E_Client *ec)
2322 /* still within old zone - leave it there */
2323 zone = e_comp_zone_find_by_ec(ec);
2324 if (zone && E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2325 zone->x, zone->y, zone->w, zone->h))
2328 /* find a new zone */
2329 EINA_LIST_FOREACH(e_comp->zones, l, zone)
2331 if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2332 zone->x, zone->y, zone->w, zone->h))
2334 e_client_zone_set(ec, zone);
2340 ////////////////////////////////////////////////
2343 _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set)
2345 if (ec->transform_core.activate == set) return;
2347 ec->transform_core.activate = set;
2351 if (ec->transform_core.result.enable)
2352 e_client_map_enable_set(ec, EINA_TRUE);
2356 e_client_map_enable_set(ec, EINA_FALSE);
2361 _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2363 E_Client *ec = data;
2365 if (stopping) return; //ignore all of this if we're shutting down!
2366 if (e_object_is_del(data)) return; //client is about to die
2367 if (ec->cur_mouse_action)
2369 if (ec->cur_mouse_action->func.end_mouse)
2370 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
2371 else if (ec->cur_mouse_action->func.end)
2372 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
2373 E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
2375 if (action_client == ec) _e_client_action_finish();
2377 ec->want_focus = ec->take_focus = 0;
2379 _e_client_transform_core_activate_set(ec, EINA_FALSE);
2381 if (ec->new_client) return;
2382 _e_client_event_hide(ec);
2388 _e_client_cb_evas_shade_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2390 E_Client *ec = data;
2392 if (e_object_is_del(data)) return;
2395 ec->shaded = !(ec->shaded);
2396 ec->changes.shaded = 1;
2397 ec->changes.shading = 1;
2398 e_client_comp_hidden_set(ec, ec->shaded);
2402 _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2404 E_Client *ec = data;
2408 if (e_object_is_del(data)) return;
2410 ec->pre_res_change.valid = 0;
2412 _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
2414 #ifdef REFACTOR_ZONE_DESK
2416 _e_client_zone_update(ec);
2418 evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
2419 if ((e_config->transient.move) && (ec->transients))
2421 Eina_List *list = eina_list_clone(ec->transients);
2424 EINA_LIST_FREE(list, child)
2426 if (child->vkbd.vkbd) continue;
2428 evas_object_move(child->frame,
2429 child->x + x - ec->pre_cb.x,
2430 child->y + y - ec->pre_cb.y);
2433 if (ec->moving || (ecmove == ec))
2435 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2436 _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
2439 if ((!ec->moving) && (ec->transformed))
2441 map = e_client_map_get(ec);
2442 _e_client_transform_geometry_save(ec, map);
2446 ec->pre_cb.x = x; ec->pre_cb.y = y;
2448 #ifdef REFACTOR_FOCUS_POLICY
2449 // This code is executed at E_CLIENT_HOOK_MOVE callback
2450 // at e_focus_policy_topmost.c and at e_focus_policy_history.c
2452 wl_signal_emit_mutable(&PRI(ec)->events.move, NULL);
2453 _e_client_hook_call(E_CLIENT_HOOK_MOVE, ec);
2458 zone = e_comp_zone_find_by_ec(ec);
2459 if (zone && !E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
2460 zone->x, zone->y, zone->w, zone->h))
2462 e_client_revert_focus(ec);
2467 e_comp_visibility_calculation_set(EINA_TRUE);
2471 _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2473 E_Client *ec = data;
2474 Evas_Coord x, y, w, h;
2476 if (e_object_is_del(data)) return;
2478 ec->pre_res_change.valid = 0;
2480 _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
2482 #ifdef REFACTOR_ZONE_DESK
2484 _e_client_zone_update(ec);
2486 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
2487 if ((e_config->transient.resize) && (ec->transients))
2489 Eina_List *list = eina_list_clone(ec->transients);
2492 EINA_LIST_FREE(list, child)
2494 Evas_Coord nx, ny, nw, nh;
2496 if ((ec->pre_cb.w > 0) && (ec->pre_cb.h > 0))
2498 nx = x + (((child->x - x) * w) / ec->pre_cb.w);
2499 ny = y + (((child->y - y) * h) / ec->pre_cb.h);
2500 nw = (child->w * w) / ec->pre_cb.w;
2501 nh = (child->h * h) / ec->pre_cb.h;
2502 nx += ((nw - child->w) / 2);
2503 ny += ((nh - child->h) / 2);
2504 evas_object_move(child->frame, nx, ny);
2509 if (e_client_util_resizing_get(ec) || (ecresize == ec))
2511 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2512 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
2514 ec->pre_cb.w = w; ec->pre_cb.h = h;
2516 e_client_transform_core_update(ec);
2517 e_comp_visibility_calculation_set(EINA_TRUE);
2521 _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2523 E_Client *ec = data;
2525 if (e_object_is_del(data)) return;
2527 _e_client_transform_core_activate_set(ec, EINA_TRUE);
2529 _e_client_event_show(ec);
2534 _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2536 E_Client *ec = data;
2537 E_Comp_Wl_Client_Data *child_cdata = NULL;
2539 if (e_object_is_del(data)) return;
2540 if (ec->layer_block) return;
2541 if (ec->layer_pending) return;
2542 if (e_config->transient.raise && ec->transients)
2544 Eina_List *list = eina_list_clone(ec->transients);
2545 E_Client *child, *below = NULL, *above = NULL;
2546 E_Transient transient_policy;
2548 E_LIST_REVERSE_FREE(list, child)
2550 child_cdata = e_client_cdata_get(child);
2551 if (child_cdata && !child_cdata->mapped)
2553 ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child));
2557 /* Don't stack iconic transients. If the user wants these shown,
2558 * that's another option.
2560 if (child->iconic && e_client_is_iconified_by_client(child)) continue;
2562 transient_policy = e_client_transient_policy_get(child);
2563 if (transient_policy == E_TRANSIENT_ABOVE)
2566 e_client_stack_below(child, below);
2568 e_client_stack_above(child, ec);
2571 else if (transient_policy == E_TRANSIENT_BELOW)
2574 e_client_stack_below(child, above);
2576 e_client_stack_below(child, ec);
2582 if (ec->unredirected_single) return;
2583 _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
2585 e_comp_visibility_calculation_set(EINA_TRUE);
2588 ////////////////////////////////////////////////
2590 #ifdef REFACTOR_ZONE_DESK
2593 _e_client_maximize(E_Client *ec, E_Maximize max)
2595 int x1, yy1, x2, y2;
2598 int ecx, ecy, ecw, ech;
2599 int desk_x, desk_y, desk_w, desk_h;
2600 Eina_Bool override = ec->maximize_override;
2603 zx = zy = zw = zh = 0;
2604 ec->maximize_override = 1;
2606 zone = e_comp_zone_find_by_ec(ec);
2609 if (ec->desk_area.enable && ec->desk_area.desk_area)
2611 desk_x = ec->desk_area.desk_area->x;
2612 desk_y = ec->desk_area.desk_area->y;
2613 desk_w = ec->desk_area.desk_area->w;
2614 desk_h = ec->desk_area.desk_area->h;
2618 desk_x = ec->desk->geom.x;
2619 desk_y = ec->desk->geom.y;
2620 desk_w = ec->desk->geom.w;
2621 desk_h = ec->desk->geom.h;
2624 switch (max & E_MAXIMIZE_TYPE)
2626 case E_MAXIMIZE_NONE:
2630 case E_MAXIMIZE_FULLSCREEN:
2634 e_client_resize_limit(ec, &w, &h);
2635 /* center x-direction */
2636 x1 = desk_x + (desk_w - w) / 2;
2637 /* center y-direction */
2638 yy1 = desk_y + (desk_h - h) / 2;
2640 switch (max & E_MAXIMIZE_DIRECTION)
2642 case E_MAXIMIZE_BOTH:
2643 e_client_maximized_geometry_set(ec, x1, yy1, w, h);
2646 case E_MAXIMIZE_VERTICAL:
2647 e_client_maximized_geometry_set(ec, ec->x, yy1, ec->w, h);
2650 case E_MAXIMIZE_HORIZONTAL:
2651 e_client_maximized_geometry_set(ec, x1, ec->y, w, ec->h);
2654 case E_MAXIMIZE_LEFT:
2655 e_client_maximized_geometry_set(ec, desk_x, desk_y, w / 2, h);
2658 case E_MAXIMIZE_RIGHT:
2659 e_client_maximized_geometry_set(ec, x1, desk_y, w / 2, h);
2664 case E_MAXIMIZE_SMART:
2665 case E_MAXIMIZE_EXPAND:
2666 if (ec->desk->visible)
2668 // base_output_resolution
2669 if (ec->base_output_resolution.use)
2673 zw = ec->base_output_resolution.w;
2674 zh = ec->base_output_resolution.h;
2678 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, EINA_TRUE);
2685 x2 = desk_x + desk_w;
2686 y2 = desk_y + desk_h;
2687 e_maximize_client_shelf_fill(ec, &x1, &yy1, &x2, &y2, max);
2694 evas_object_smart_callback_call(ec->frame, "maximize", NULL);
2695 e_comp_object_frame_xy_unadjust(ec->frame, ec->x, ec->y, &ecx, &ecy);
2696 e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &ecw, &ech);
2704 if (ecx < zx) // window left not useful coordinates
2706 else if (ecx + ecw > zx + zw) // window right not useful coordinates
2708 else // window normal position
2711 if (ecy < zy) // window top not useful coordinates
2713 else if (ecy + ech > zy + zh) // window bottom not useful coordinates
2714 yy1 = zy + zh - ech;
2715 else // window normal position
2718 switch (max & E_MAXIMIZE_DIRECTION)
2720 case E_MAXIMIZE_BOTH:
2721 e_client_maximized_geometry_set(ec, zx, zy, zw, zh);
2724 case E_MAXIMIZE_VERTICAL:
2725 e_client_maximized_geometry_set(ec, ec->x, zy, ec->w, zh);
2728 case E_MAXIMIZE_HORIZONTAL:
2729 e_client_maximized_geometry_set(ec, zx, ec->y, zw, ec->h);
2732 case E_MAXIMIZE_LEFT:
2733 e_client_maximized_geometry_set(ec, zx, zy, zw / 2, zh);
2736 case E_MAXIMIZE_RIGHT:
2737 e_client_maximized_geometry_set(ec, zx + zw / 2, zy, zw / 2, zh);
2743 case E_MAXIMIZE_FILL:
2746 x2 = desk_x + desk_w;
2747 y2 = desk_y + desk_h;
2749 /* walk through all shelves */
2750 e_maximize_client_shelf_fill(ec, &x1, &yy1, &x2, &y2, max);
2752 /* walk through all windows */
2753 e_maximize_client_client_fill(ec, &x1, &yy1, &x2, &y2, max);
2759 e_client_resize_limit(ec, &w, &h);
2760 /* center x-direction */
2761 x1 = x1 + (pw - w) / 2;
2762 /* center y-direction */
2763 yy1 = yy1 + (ph - h) / 2;
2765 switch (max & E_MAXIMIZE_DIRECTION)
2767 case E_MAXIMIZE_BOTH:
2768 e_client_maximized_geometry_set(ec, x1, yy1, w, h);
2771 case E_MAXIMIZE_VERTICAL:
2772 e_client_maximized_geometry_set(ec, ec->x, yy1, ec->w, h);
2775 case E_MAXIMIZE_HORIZONTAL:
2776 e_client_maximized_geometry_set(ec, x1, ec->y, w, ec->h);
2779 case E_MAXIMIZE_LEFT:
2780 e_client_maximized_geometry_set(ec, desk_x, desk_y, w / 2, h);
2783 case E_MAXIMIZE_RIGHT:
2784 e_client_maximized_geometry_set(ec, x1, desk_y, w / 2, h);
2789 if (ec->maximize_override)
2790 ec->maximize_override = override;
2794 ////////////////////////////////////////////////
2796 _e_client_aux_hint_eval(E_Client *ec)
2800 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2802 E_Comp_Wl_Aux_Hint *hint;
2804 if (cdata && cdata->aux_hint.changed)
2806 wl_signal_emit_mutable(&PRI(ec)->events.aux_hint_change, NULL);
2807 _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
2809 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
2811 hint->changed = EINA_FALSE;
2814 ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec, hint->id, hint->hint, hint->val);
2815 if (hint->hint) eina_stringshare_del(hint->hint);
2816 if (hint->val) eina_stringshare_del(hint->val);
2817 cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
2821 cdata->aux_hint.changed = 0;
2825 #ifdef REFACTOR_ZONE_DESK
2828 _e_client_apply_auto_placement(E_Client *ec)
2830 Eina_List *skiplist = NULL;
2831 int new_x, new_y, t = 0;
2833 E_Client *parent_ec;
2836 // intercept auto placement policy
2837 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
2839 ELOGF("POL", "Intercepted auto_placement policy.", ec);
2843 int zx = 0, zy = 0, zw = 0, zh = 0;
2845 zone = e_comp_zone_find_by_ec(ec);
2848 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
2850 unsigned int seed = (unsigned int)time(NULL);
2853 new_x = zx + (rand_r(&seed) % (zw - ec->w));
2857 new_y = zy + (rand_r(&seed) % (zh - ec->h));
2861 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
2863 parent_ec = ec->parent;
2867 new_x = parent_ec->x;
2868 new_y = parent_ec->y;
2870 else if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) || (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET))
2873 skiplist = eina_list_append(skiplist, ec);
2875 e_place_desk_region_smart(ec->desk, skiplist,
2876 ec->x, ec->y, ec->w, ec->h,
2879 e_place_zone_region_smart(zone, skiplist,
2880 ec->x, ec->y, ec->w, ec->h,
2883 eina_list_free(skiplist);
2885 else if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL)
2888 e_place_zone_manual(zone, ec->w, t, &new_x, &new_y);
2893 e_place_zone_cursor(zone, ec->x, ec->y, ec->w, ec->h,
2897 ELOGF("POL", "Apply auto placement (type:%d). (%d,%d) -> (%d,%d).", ec, type, ec->x, ec->y, new_x, new_y);
2898 e_client_pos_set(ec, new_x, new_y);
2899 ec->changes.pos = 1;
2901 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2906 _e_client_eval(E_Client *ec)
2909 unsigned int prop = 0;
2910 #ifdef REFACTOR_ZONE_DESK
2918 if (e_object_is_del(E_OBJECT(ec)))
2920 CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
2925 TRACE_DS_BEGIN(CLIENT:EVAL);
2927 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_new_client, NULL);
2928 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec))
2934 #ifdef REFACTOR_ZONE_DESK
2935 if ((ec->new_client) && (!e_client_util_ignored_get(ec)))
2937 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2938 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2945 zone = e_comp_zone_find_by_ec(ec);
2946 if ((ec->new_client) && (!e_client_util_ignored_get(ec)) && (zone))
2948 int zx = 0, zy = 0, zw = 0, zh = 0;
2950 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
2951 /* enforce wm size hints for initial sizing */
2952 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
2954 tw = MIN(ec->w, zone->w);
2955 th = MIN(ec->h, zone->h);
2956 e_client_size_set(ec, tw, th);
2961 e_client_resize_limit(ec, &nw, &nh);
2962 e_client_size_set(ec, nw, nh);
2966 int x = ec->x, y = ec->y;
2967 if (ec->x) e_comp_object_frame_xy_adjust(ec->frame, ec->x, 0, &ec->x, NULL);
2968 if (ec->y) e_comp_object_frame_xy_adjust(ec->frame, 0, ec->y, NULL, &ec->y);
2969 if ((x != ec->x) || (y != ec->y)) ec->changes.pos = 1;
2971 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2977 tx = zx + ((zw - ec->w) / 2);
2978 ty = zy + ((zh - ec->h) / 2);
2979 e_client_pos_set(ec, tx, ty);
2981 ec->changes.pos = 1;
2983 ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;
2988 eai = e_appinfo_find_with_pid(ec->netwm.pid);
2992 _e_client_apply_auto_placement(ec);
2996 if (e_appinfo_auto_placement_get(eai))
2997 _e_client_apply_auto_placement(ec);
3000 /* Recreate state */
3001 if (ec->e.state.centered)
3003 tx = zx + (zw - ec->w) / 2;
3004 ty = zy + (zh - ec->h) / 2;
3005 e_client_pos_set(ec, tx, ty);
3006 ec->changes.pos = 1;
3009 /* if the explicit geometry request asks for the app to be
3010 * in another zone - well move it there */
3012 E_Zone *zone1 = NULL;
3017 if ((!ec->re_manage) && ((ec->x != x) || (ec->y != y)))
3018 zone1 = e_comp_zone_xy_get(x, y);
3022 zone1 = e_comp_zone_xy_get(ec->x + (ec->w / 2), ec->y + (ec->h / 2));
3025 E_Zone *z2 = e_comp_zone_xy_get(ec->x, ec->y);
3027 if (z2 && (z2 != zone1))
3033 EINA_LIST_FOREACH(e_comp->zones, l, z2)
3037 x = ec->x, y = ec->y, w = ec->w, h = ec->h;
3038 E_RECTS_CLIP_TO_RECT(x, y, w, h, z2->x, z2->y, z2->w, z2->h);
3039 if (w * h == z2->w * z2->h)
3041 /* client fully covering zone */
3045 if ((unsigned)(w * h) > psz)
3056 zone1 = e_comp_zone_xy_get(ec->x, ec->y);
3058 zone1 = e_comp_zone_xy_get(ec->x + ec->w - 1, ec->y);
3060 zone1 = e_comp_zone_xy_get(ec->x + ec->w - 1, ec->y + ec->h - 1);
3062 zone1 = e_comp_zone_xy_get(ec->x, ec->y + ec->h - 1);
3063 if ((zone1) && (zone1 != zone))
3064 e_client_zone_set(ec, zone1);
3068 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
3069 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
3076 /* effect changes to the window border itself */
3077 if ((ec->changes.shading))
3079 /* show at start of unshade (but don't hide until end of shade) */
3080 ec->changes.shading = 0;
3083 if (ec->changes.shaded) send_event = 0;
3084 if ((ec->changes.shaded) && (ec->changes.pos) && (ec->changes.size))
3086 ec->changes.shaded = 0;
3088 else if ((ec->changes.shaded) && (ec->changes.pos))
3090 ec->changes.size = 1;
3091 ec->changes.shaded = 0;
3093 else if ((ec->changes.shaded) && (ec->changes.size))
3095 ec->changes.shaded = 0;
3097 else if (ec->changes.shaded)
3099 ec->changes.shaded = 0;
3102 if (ec->changes.size)
3104 ec->changes.size = 0;
3105 if ((!ec->shaded) && (!ec->shading))
3106 evas_object_resize(ec->frame, ec->w, ec->h);
3108 prop |= E_CLIENT_PROPERTY_SIZE;
3110 if (ec->changes.pos)
3112 ec->changes.tz_position = 0;
3113 ec->changes.pos = 0;
3114 evas_object_move(ec->frame, ec->x, ec->y);
3115 prop |= E_CLIENT_PROPERTY_POS;
3118 if (ec->changes.reset_gravity)
3120 ec->changes.reset_gravity = 0;
3121 prop |= E_CLIENT_PROPERTY_GRAVITY;
3124 if (ec->changes.title)
3126 ec->changes.title = 0;
3127 prop |= E_CLIENT_PROPERTY_TITLE;
3130 if ((ec->changes.visible) && (ec->visible) && (ec->new_client) && (!ec->iconic))
3134 e_input_device_pointer_xy_get(NULL, &x, &y);
3135 if ((!ec->placed) && (!ec->re_manage) &&
3136 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
3137 (!((ec->icccm.transient_for != 0) ||
3139 (!ecmove) && (!ecresize))
3141 /* Set this window into moving state */
3143 ec->cur_mouse_action = e_action_find("window_move");
3144 if (ec->cur_mouse_action)
3146 if ((!ec->cur_mouse_action->func.end_mouse) &&
3147 (!ec->cur_mouse_action->func.end))
3148 ec->cur_mouse_action = NULL;
3149 if (ec->cur_mouse_action)
3152 tx = x - (ec->w >> 1);
3153 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
3155 e_client_pos_set(ec, tx, ty);
3157 ec->changes.pos = 1;
3162 evas_object_show(ec->frame);
3163 if (evas_object_visible_get(ec->frame))
3165 #ifdef REFACTOR_FOCUS_POLICY
3166 // It is useless, Nothing to do.
3168 if (ec->cur_mouse_action)
3170 ec->moveinfo.down.x = ec->x;
3171 ec->moveinfo.down.y = ec->y;
3172 ec->moveinfo.down.w = ec->w;
3173 ec->moveinfo.down.h = ec->h;
3174 ec->mouse.current.mx = x;
3175 ec->mouse.current.my = y;
3176 ec->moveinfo.down.button = 0;
3177 ec->moveinfo.down.mx = x;
3178 ec->moveinfo.down.my = y;
3180 e_object_ref(E_OBJECT(ec->cur_mouse_action));
3181 ec->cur_mouse_action->func.go(E_OBJECT(ec), NULL);
3182 if (e_config->border_raise_on_mouse_action)
3184 if (e_config->focus_policy_ext != E_FOCUS_EXT_TOP_STACK)
3186 ELOGF("FOCUS", "focus set | client eval", ec);
3187 e_client_frame_focus_set(ec, EINA_TRUE);
3191 ec->changes.visible = 0;
3192 _e_client_event_show(ec);
3195 else if ((ec->changes.visible) && (ec->new_client))
3197 ec->changes.visible = 0;
3199 _e_client_event_hide(ec);
3202 if (ec->changes.icon)
3204 ec->changes.icon = 0;
3208 e_comp->new_clients--;
3210 ec->changed = ec->changes.pos || ec->changes.size ||
3211 ec->changes.stack || ec->changes.prop || ec->changes.border ||
3212 ec->changes.reset_gravity || ec->changes.shading || ec->changes.shaded ||
3213 ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
3214 ec->changes.internal_state ||
3215 ec->changes.need_maximize || ec->changes.need_unmaximize;
3216 ec->changes.stack = 0;
3218 #ifdef REFACTOR_FOCUS_POLICY
3219 // This code executes at E_CLIENT_HOOK_EVAL_END callback at e_focus_policy_topmost.c and e_focus_policy_history.c
3221 zone = e_comp_zone_find_by_ec(ec);
3222 if ((!ec->input_only) && (!ec->iconic) &&
3223 ((!zone) || e_desk_has_ec(e_desk_current_get(zone), ec)) &&
3224 ((ec->take_focus) || (ec->want_focus)))
3230 #if 0 // focus should be set to the top window
3231 e_client_focus_set_with_pointer(ec);
3236 /* focus window by default when it is the only one on desk */
3237 E_Client *ec2 = NULL;
3240 desk = e_zone_desk_find_by_ec(zone, ec);
3241 EINA_LIST_FOREACH(focus_stack, l, ec2)
3243 if (ec == ec2) continue;
3244 if ((!ec2->iconic) && (ec2->visible) &&
3245 ((e_desk_has_ec(desk, ec2)) || ec2->sticky))
3251 e_client_focus_set_with_pointer(ec);
3256 ec->take_focus = ec->want_focus = 0;
3259 if (ec->changes.need_maximize)
3261 E_Maximize max = ec->maximized;
3262 ec->maximized = E_MAXIMIZE_NONE;
3263 e_client_maximize(ec, max);
3264 ec->changes.need_maximize = 0;
3266 else if (ec->changes.need_unmaximize)
3268 e_client_unmaximize(ec, ec->maximized);
3269 ec->changes.need_unmaximize = 0;
3272 if (ec->need_fullscreen)
3274 e_client_fullscreen(ec, e_config->fullscreen_policy);
3275 ec->need_fullscreen = 0;
3278 if (ec->changes.accepts_focus)
3280 if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus))
3283 ec->changes.accepts_focus = 0;
3287 if (send_event && prop)
3289 _e_client_event_property(ec, prop);
3292 _e_client_aux_hint_eval(ec);
3294 e_client_transform_core_update(ec);
3296 wl_signal_emit_mutable(&PRI(ec)->events.eval_end, NULL);
3297 _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
3302 #ifdef REFACTOR_ZONE_DESK
3304 e_client_frame_update(E_Client *ec)
3307 _e_client_frame_update(E_Client *ec)
3310 const char *bordername;
3312 #ifdef REFACTOR_ZONE_DESK
3313 EINA_SAFETY_ON_NULL_RETURN(ec);
3314 if (e_object_is_del(E_OBJECT(ec))) return;
3317 ec->border.changed = 0;
3318 if (!e_comp_object_frame_allowed(ec->frame)) return;
3319 if (ec->fullscreen || ec->borderless)
3320 bordername = "borderless";
3321 else if (ec->bordername)
3322 bordername = ec->bordername;
3323 else if (ec->mwm.borderless)
3324 bordername = "borderless";
3325 else if (((ec->icccm.transient_for != 0) || (ec->dialog)) &&
3326 (ec->icccm.min_w == ec->icccm.max_w) &&
3327 (ec->icccm.min_h == ec->icccm.max_h))
3328 bordername = "noresize_dialog";
3329 else if ((ec->icccm.min_w == ec->icccm.max_w) &&
3330 (ec->icccm.min_h == ec->icccm.max_h))
3331 bordername = "noresize";
3332 else if (ec->shaped)
3333 bordername = "shaped";
3334 else if (ec->urgent)
3335 bordername = "urgent";
3336 else if (ec->netwm.state.modal)
3337 bordername = "modal";
3338 else if ((ec->netwm.state.skip_taskbar) ||
3339 (ec->netwm.state.skip_pager))
3340 bordername = "skipped";
3342 else if ((ec->internal) && (ec->icccm.class) &&
3343 (!strncmp(ec->icccm.class, "e_fwin", 6)))
3344 bordername = "internal_fileman";
3347 bordername = e_config->theme_default_border_style;
3348 if (!bordername) bordername = "default";
3350 e_client_border_set(ec, bordername);
3354 _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
3356 if (!ec || !m) return EINA_FALSE;
3357 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
3359 if ((int)ec->netwm.type != m->window_type)
3362 #if defined(__cplusplus) || defined(c_plusplus)
3365 if (!ec->icccm.cpp_class)
3368 if (!e_util_glob_match(ec->icccm.cpp_class, m->clas))
3374 if (!ec->icccm.class)
3377 if (!e_util_glob_match(ec->icccm.class, m->clas))
3384 if (ec->icccm.name && e_util_glob_match(ec->icccm.name, m->name))
3387 if (ec->icccm.title && e_util_glob_match(ec->icccm.title, m->name))
3390 if (ec->netwm.name && e_util_glob_match(ec->netwm.name, m->name))
3398 _e_client_type_get(E_Client *ec)
3400 E_Config_Client_Type *m;
3404 if (!e_config->client_types) return 0;
3406 EINA_LIST_FOREACH(e_config->client_types, l, m)
3408 if (!_e_client_type_match(ec, m)) continue;
3411 type = m->client_type;
3416 ec->client_type = type;
3418 return ec->client_type;
3422 _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom)
3424 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3428 int ox = 0, oy = 0, ow, oh;
3432 EINA_SAFETY_ON_FALSE_RETURN(e_comp_wl_subsurface_check(ec));
3434 e_comp_wl_subsurface_position_get(ec, &ox, &oy);
3435 ow = cdata->width_from_viewport;
3436 oh = cdata->height_from_viewport;
3438 map = e_client_map_get(epc);
3439 e_map_point_coord_get(map, 0, &px, &py, 0);
3442 mx = ox * zoom + px;
3443 my = oy * zoom + py;
3447 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
3448 e_map_util_points_populate_from_geometry(map, mx, my, mw, mh, 0);
3449 e_map_util_object_move_sync_set(map, EINA_TRUE);
3450 e_client_map_set(ec, map);
3451 e_client_map_enable_set(ec, EINA_TRUE);
3453 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
3454 _e_client_transform_sub_apply(subc, ec, zoom);
3455 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
3456 _e_client_transform_sub_apply(subc, ec, zoom);
3462 _e_client_transient_for_group_make(E_Client *ec, Eina_List **list)
3468 if (!e_config->transient.raise) return;
3470 EINA_LIST_FOREACH(ec->transients, l, child)
3472 if (!child) continue;
3473 if (child->iconic) continue;
3474 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
3476 *list = eina_list_prepend(*list, child);
3477 _e_client_transient_for_group_make(child, list);
3483 e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus)
3485 E_Client *top_ec = NULL;
3486 Eina_List *transient_list = NULL;
3488 _e_client_transient_for_group_make(ec, &transient_list);
3492 Eina_List *l = NULL;
3493 E_Client *temp_ec = NULL;
3494 E_Client *temp_ec2 = NULL;
3496 E_CLIENT_REVERSE_FOREACH(temp_ec)
3505 EINA_LIST_FOREACH(transient_list, l, temp_ec2)
3507 if (temp_ec == temp_ec2)
3511 if ((temp_ec2->icccm.accepts_focus) ||
3512 (temp_ec2->icccm.take_focus))
3525 eina_list_free(transient_list);
3530 #ifdef EC_IS_NOT_VISIBLE
3531 # undef EC_IS_NOT_VISIBLE
3533 #define EC_IS_NOT_VISIBLE if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED)
3536 e_client_visibility_touched_check(E_Client *ec)
3540 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
3542 tx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x);
3543 ty = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y);
3545 return _e_client_position_inside_input_rect(ec, tx, ty);
3549 e_client_visibility_change_notify(E_Client *ec)
3551 EINA_SAFETY_ON_NULL_RETURN(ec);
3553 if (ec->visibility.changed)
3554 _e_client_event_simple(ec, E_EVENT_CLIENT_VISIBILITY_CHANGE);
3556 wl_signal_emit_mutable(&PRI(ec)->events.eval_visibility, NULL);
3557 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY, ec);
3561 e_client_visibility_end_notify(void)
3563 // FIXME: This hook means that the visiblitiy calculation of a zone is done
3564 // at this idle handler.This is a hook for a zone, not for a client.
3565 // Therefore, this hook may be defined as a zone hook,
3566 // ex) E_ZONE_HOOK_EVAL_VISIBILITY_END or E_ZONE_HOOK_EVAL_VISIBILITY_DONE.
3567 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY_END, NULL);
3570 #ifdef REFACTOR_FOCUS_POLICY
3573 _e_client_merge_focus_stack_with_defer_focus(void)
3575 Eina_List *l = NULL;
3576 E_Client *ec = NULL, *defer_ec = NULL;
3577 Eina_Bool find_rel = EINA_FALSE;
3578 Eina_Bool inserted = EINA_FALSE;
3580 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
3584 focus_stack = eina_list_merge(focus_stack, defer_focus_stack);
3588 E_CLIENT_FOREACH(defer_ec)
3590 if (!eina_list_data_find(defer_focus_stack, defer_ec)) continue;
3592 find_rel = EINA_FALSE;
3593 inserted = EINA_FALSE;
3594 focus_stack = eina_list_remove(focus_stack, defer_ec);
3596 EINA_LIST_FOREACH(focus_stack, l, ec)
3598 if (ec == NULL) continue;
3603 find_rel = EINA_TRUE;
3607 if (ec->layer > defer_ec->layer) continue;
3609 focus_stack = eina_list_prepend_relative_list(focus_stack, defer_ec, l);
3610 inserted = EINA_TRUE;
3615 focus_stack = eina_list_append(focus_stack, defer_ec);
3619 defer_focus_stack = eina_list_free(defer_focus_stack);
3624 _e_client_candidate_focus(E_Zone *zone, E_Client *reverted_focus_ec)
3627 E_Client *defered_focus_ec = NULL;
3628 Eina_List *child_list = NULL;
3629 Eina_List *l = NULL;
3630 Eina_Bool child_deferred;
3633 E_CLIENT_REVERSE_FOREACH(ec)
3635 if (!eina_list_data_find(defer_focus_stack, ec)) continue;
3637 if (e_object_is_del(E_OBJECT(ec))) continue;
3638 if (e_client_util_ignored_get(ec)) continue;
3639 if (!e_zone_has_ec(zone, ec)) continue;
3640 desk = e_desk_current_get(zone);
3641 if (!desk) continue;
3642 if (!e_desk_has_ec(desk, ec)) continue;
3644 if (!(ec->icccm.accepts_focus || ec->icccm.take_focus)) continue;
3645 if (ec->lock_focus_in || ec->lock_focus_out) continue;
3646 if (!evas_object_visible_get(ec->frame)) continue;
3647 if (ec->iconic) continue;
3648 if (ec->bg_state) continue;
3650 if (!(cec = e_client_check_obscured_by_children_group(ec)) ||
3651 e_client_check_really_iconified(cec))
3653 if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED) continue;
3654 if (e_client_check_fully_contain_by_above(ec, EINA_FALSE)) continue;
3657 if (focused && (focused->layer > ec->layer)) continue;
3658 else if (!focused && reverted_focus_ec && (reverted_focus_ec->layer > ec->layer)) continue;
3660 // check transient_for child defered
3661 child_deferred = EINA_FALSE;
3662 child_list = eina_list_clone(ec->transients);
3663 EINA_LIST_FOREACH(child_list, l, cec)
3665 if (e_client_transient_policy_get(cec) == E_TRANSIENT_BELOW) continue;
3666 if (!(cec->icccm.accepts_focus || cec->icccm.take_focus)) continue;
3667 if (eina_list_data_find(defer_focus_stack, cec))
3669 child_deferred = EINA_TRUE;
3673 eina_list_free(child_list);
3674 if (child_deferred) continue;
3676 defered_focus_ec = ec;
3679 return defered_focus_ec;
3683 e_client_focus_calculate(E_Zone *zone)
3685 E_Client *defered_focus_ec = NULL, *reverted_focus_ec = NULL;
3686 E_Client *ec = NULL, *old_focused = NULL;
3688 EINA_SAFETY_ON_NULL_RETURN(zone);
3689 if (!e_zone_is_displaying(zone)) return;
3691 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
3693 ec = _e_client_focus_topmost_focusable_get();
3697 if (!ec) ELOGF("FOCUS", "focus unset | No focusable ec", focused);
3698 e_client_frame_focus_set(focused, EINA_FALSE);
3702 ELOGF("FOCUS", "focus set | topmost focus calculate", ec);
3703 e_client_frame_focus_set(ec, EINA_TRUE);
3710 (focused != eina_list_data_get(focus_stack)) ||
3711 (!_e_client_focus_can_take(focused)))
3713 reverted_focus_ec = _e_client_revert_focus_get(focused);
3714 if (!reverted_focus_ec && focused)
3716 e_client_focus_defer_unset(focused);
3717 old_focused = focused;
3721 defered_focus_ec = _e_client_candidate_focus(zone, reverted_focus_ec);
3723 if (defered_focus_ec)
3725 if (defered_focus_ec != focused)
3727 ELOGF("FOCUS", "focus set | focus calculate (defer_focus)", defered_focus_ec);
3729 e_client_focus_defer_unset(focused);
3730 e_client_frame_focus_set(defered_focus_ec, EINA_TRUE);
3733 e_client_focus_defer_unset(defered_focus_ec);
3735 _e_client_merge_focus_stack_with_defer_focus();
3737 else if(reverted_focus_ec)
3739 if (reverted_focus_ec != focused)
3741 ELOGF("FOCUS", "focus set | focus calculate (revert_focus)", reverted_focus_ec);
3743 e_client_focus_defer_unset(focused);
3744 e_client_frame_focus_set(reverted_focus_ec, EINA_TRUE);
3747 else if (old_focused)
3749 ELOGF("FOCUS", "focus unset | focus calculate", old_focused);
3750 e_client_frame_focus_set(old_focused, EINA_FALSE);
3758 _e_client_transform_core_check_change(E_Client *ec)
3762 Eina_Bool check = EINA_FALSE;
3763 if (!ec) return EINA_FALSE;
3766 evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
3768 // check client position or size change
3769 if (ec->x != ec->transform_core.backup.client_x ||
3770 ec->y != ec->transform_core.backup.client_y ||
3771 ec->w != ec->transform_core.backup.client_w ||
3772 ec->h != ec->transform_core.backup.client_h ||
3773 w != ec->transform_core.backup.frame_w ||
3774 h != ec->transform_core.backup.frame_h ||
3775 ec->argb != ec->transform_core.backup.argb)
3778 ec->transform_core.backup.client_x = ec->x;
3779 ec->transform_core.backup.client_y = ec->y;
3780 ec->transform_core.backup.client_w = ec->w;
3781 ec->transform_core.backup.client_h = ec->h;
3782 ec->transform_core.backup.frame_w = w;
3783 ec->transform_core.backup.frame_h = h;
3784 ec->transform_core.backup.argb = ec->argb;
3787 // check new transform or del transform
3788 if (ec->transform_core.changed)
3791 ec->transform_core.changed = EINA_FALSE;
3794 // check each transform change
3795 if (ec->transform_core.transform_list)
3799 E_Util_Transform *transform;
3801 EINA_LIST_FOREACH_SAFE(ec->transform_core.transform_list, l, l_next, transform)
3803 // del transform check
3804 if (e_util_transform_ref_count_get(transform) <= 1)
3806 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
3807 e_util_transform_unref(transform);
3812 // transform change test
3813 if (e_util_transform_change_get(transform))
3816 e_util_transform_change_unset(transform);
3821 if (e_comp_wl_subsurface_check(ec))
3823 // check parent matrix change
3824 E_Client *parent = e_comp_wl_subsurface_parent_get(ec);
3825 if (parent && parent->transform_core.result.enable)
3827 ec->transform_core.parent.enable = EINA_TRUE;
3829 if (!e_util_transform_matrix_equal_check(&ec->transform_core.parent.matrix,
3830 &parent->transform_core.result.matrix))
3833 ec->transform_core.parent.matrix = parent->transform_core.result.matrix;
3835 if (memcmp(&ec->transform_core.parent.zoom, &parent->transform_core.result.transform.zoom, sizeof(E_Util_Transform_Zoom)) != 0)
3838 ec->transform_core.parent.zoom = parent->transform_core.result.transform.zoom;
3841 else if (ec->transform_core.parent.enable)
3843 ec->transform_core.parent.enable = EINA_FALSE;
3844 e_util_transform_matrix_load_identity(&ec->transform_core.parent.matrix);
3845 ec->transform_core.parent.zoom.zoom_x = 1.0;
3846 ec->transform_core.parent.zoom.zoom_y = 1.0;
3847 ec->transform_core.parent.zoom.cx = 0;
3848 ec->transform_core.parent.zoom.cy = 0;
3857 _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
3859 int minx = 99999, miny = 99999;
3860 int maxx = -99999, maxy = -99999;
3865 if (!ec->frame) return;
3866 if (!ec->transform_core.result.enable) return;
3867 if (!vertices) return;
3869 for (i = 0; i < 4; ++i)
3874 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
3876 if (x < minx) minx = x;
3877 if (y < miny) miny = y;
3878 if (x > maxx) maxx = x;
3879 if (y > maxy) maxy = y;
3882 ec->transform_core.result.boundary.x = minx;
3883 ec->transform_core.result.boundary.y = miny;
3884 ec->transform_core.result.boundary.w = maxx - minx;
3885 ec->transform_core.result.boundary.h = maxy - miny;
3887 ELOGF("COMP", "[Transform][boundary][%d %d %d %d]",
3889 ec->transform_core.result.boundary.x,
3890 ec->transform_core.result.boundary.y,
3891 ec->transform_core.result.boundary.w,
3892 ec->transform_core.result.boundary.h);
3896 _e_client_transform_core_map_new(Evas_Object *obj,
3897 E_Util_Transform_Rect_Vertex *vertices,
3898 E_Util_Transform *transform,
3899 Eina_Bool direct_render)
3906 map = e_map_new_with_direct_render(direct_render);
3907 EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL);
3909 e_map_util_points_populate_from_object_full(map, obj, 0);
3910 e_map_util_points_color_set(map, 255, 255, 255, 255);
3912 for (i = 0 ; i < 4 ; ++i)
3917 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
3918 e_map_point_coord_set(map, i, x, y, 1.0);
3920 if (transform && e_util_transform_texcoord_flag_get(transform))
3925 e_util_transform_texcoord_get(transform, i, &u, &v);
3926 e_map_point_image_uv_set(map, i, u, v);
3934 _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec,
3936 E_Util_Transform_Rect_Vertex *vertices,
3937 E_Util_Transform *transform,
3938 E_Util_Transform_Zoom zoom)
3946 map = _e_client_transform_core_map_new(obj, vertices, transform,
3947 ec->transform_core.direct_render);
3948 EINA_SAFETY_ON_NULL_RETURN(map);
3950 e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy);
3952 e_comp_object_map_set(obj, map);
3954 if (ec->transform_core.activate)
3955 e_comp_object_map_enable_set(obj, EINA_TRUE);
3957 e_comp_object_map_enable_set(obj, EINA_FALSE);
3962 evas_object_map_enable_set(obj, EINA_FALSE);
3966 _e_client_transform_core_vertices_apply(E_Client *ec,
3968 E_Util_Transform_Rect_Vertex *vertices,
3969 E_Util_Transform *transform)
3977 map = _e_client_transform_core_map_new(obj, vertices, transform,
3978 ec->transform_core.direct_render);
3979 EINA_SAFETY_ON_NULL_RETURN(map);
3981 e_comp_object_map_set(obj, map);
3983 if (ec->transform_core.activate)
3984 e_comp_object_map_enable_set(obj, EINA_TRUE);
3986 e_comp_object_map_enable_set(obj, EINA_FALSE);
3991 evas_object_map_enable_set(obj, EINA_FALSE);
3995 _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
3999 E_Comp_Wl_Client_Data *cdata;
4003 cdata = e_client_cdata_get(ec);
4006 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
4007 e_client_transform_core_update(subc);
4009 EINA_LIST_FOREACH(cdata->sub.below_list, l, subc)
4010 e_client_transform_core_update(subc);
4014 _e_client_cb_hook_shell_surface_ready(void *data EINA_UNUSED, E_Client *ec)
4016 if (EINA_UNLIKELY(!ec))
4019 _e_client_aux_hint_eval(ec);
4022 // FIXME: This function has to be deleted and it remains for the backward compatibility.
4023 // Please find and fix to use e_comp_visibility_calculation_set(EINA_TRUE)
4024 // instead of e_client_visibility_calculate() call at e20 modules.
4026 e_client_visibility_calculate(void)
4028 e_comp_visibility_calculation_set(EINA_TRUE);
4032 e_client_visibility_skip_set(E_Client *ec, Eina_Bool skip)
4036 ELOGF("POL_VIS", "visibility skip set to %d", ec, skip);
4037 ec->visibility.skip = skip;
4041 e_client_post_raise_lower_set(E_Client *ec, Eina_Bool raise_set, Eina_Bool lower_set)
4045 ec->post_raise = raise_set;
4046 ec->post_lower = lower_set;
4050 e_client_first_mapped_get(E_Client *ec)
4052 if (!ec) return EINA_FALSE;
4054 return ec->first_mapped;
4057 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec)
4059 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4060 EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE);
4062 return cdata->mapped;
4066 e_client_mapped_set(E_Client *ec, Eina_Bool set)
4068 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4069 EINA_SAFETY_ON_NULL_RETURN(cdata);
4071 cdata->mapped = set;
4075 ////////////////////////////////////////////////
4077 e_client_clients_hash_exist()
4081 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4083 if (eina_hash_population(clients_hash[pix_id]))
4091 e_client_idler_before(Eina_Bool *check_focus)
4096 *check_focus = EINA_FALSE;
4098 if (!e_client_clients_hash_exist()) return;
4100 TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
4102 EINA_LIST_FOREACH(e_comp->clients, l, ec)
4106 // pass 1 - eval0. fetch properties on new or on change and
4107 // call hooks to decide what to do - maybe move/resize
4108 if (ec->ignored || (!ec->changed)) continue;
4110 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_fetch, NULL);
4111 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
4114 /* FETCH is hooked by the compositor to get client hints */
4115 wl_signal_emit_mutable(&PRI(ec)->events.eval_fetch, NULL);
4116 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
4120 client_type = ec->client_type;
4121 if (client_type != _e_client_type_get(ec))
4122 _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
4125 /* PRE_POST_FETCH calls e_remember apply for new client */
4126 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_post_fetch, NULL);
4127 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
4128 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_fetch, NULL);
4129 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
4130 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_frame_assign, NULL);
4131 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
4133 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_frame_assign, NULL);
4134 _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
4136 // pass 2 - show and hide windows needing hide and eval (main eval)
4137 E_CLIENT_FOREACH(ec)
4139 if (e_object_is_del(E_OBJECT(ec))) continue;
4142 // ignored client but needing eval (aux hint) such as remote surfaces
4145 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4146 if (cdata && cdata->first_commit)
4147 _e_client_aux_hint_eval(ec);
4152 if (ec->changes.visible)
4156 if ((!ec->new_client) &&
4157 (!ec->changes.pos) &&
4158 (!ec->changes.size))
4160 evas_object_show(ec->frame);
4161 ec->changes.visible = !evas_object_visible_get(ec->frame);
4166 evas_object_hide(ec->frame);
4167 ec->changes.visible = 0;
4174 e_comp_visibility_calculation_set(EINA_TRUE);
4175 if (ec->changes.accepts_focus)
4176 *check_focus = EINA_TRUE;
4177 ec->changes.accepts_focus = 0;
4180 if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
4182 evas_object_show(ec->frame);
4183 ec->changes.visible = !evas_object_visible_get(ec->frame);
4184 ec->changed = ec->changes.visible;
4185 e_comp_visibility_calculation_set(EINA_TRUE);
4197 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4198 clients_hash[pix_id] = eina_hash_pointer_new(NULL);
4200 E_COMP_WL_HOOK_APPEND(hooks, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _e_client_cb_hook_shell_surface_ready, NULL);
4202 #ifdef REFACTOR_FOCUS_POLICY
4204 g_mutex_init(&focused_ec_mutex);
4207 E_EVENT_CLIENT_ADD = ecore_event_type_new();
4208 E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
4209 E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
4210 E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
4211 E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
4212 E_EVENT_CLIENT_MOVE = ecore_event_type_new();
4213 E_EVENT_CLIENT_SHOW = ecore_event_type_new();
4214 E_EVENT_CLIENT_HIDE = ecore_event_type_new();
4215 E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
4216 E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
4217 E_EVENT_CLIENT_STACK = ecore_event_type_new();
4218 E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
4219 E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
4220 E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
4221 E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
4222 E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
4223 #ifdef _F_ZONE_WINDOW_ROTATION_
4224 E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
4225 E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
4226 E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new();
4227 E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = ecore_event_type_new();
4229 E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new();
4230 E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new();
4231 E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();;
4232 E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();;
4234 return (!!clients_hash[1]);
4238 e_client_shutdown(void)
4241 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
4242 E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
4244 E_FREE_LIST(hooks, e_comp_wl_hook_del);
4245 E_FREE_LIST(handlers, ecore_event_handler_del);
4247 #ifdef REFACTOR_FOCUS_POLICY
4249 g_mutex_clear(&focused_ec_mutex);
4254 e_client_unignore(E_Client *ec)
4257 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4258 if (!ec->ignored) return;
4261 _e_client_event_add(ec);
4265 e_client_new(E_Pixmap *cp, int first_map, int internal)
4270 type = e_pixmap_type_get(cp);
4271 if (type >= E_PIXMAP_TYPE_MAX) return NULL;
4272 if (eina_hash_find(clients_hash[type], &cp)) return NULL;
4274 ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
4275 if (!ec) return NULL;
4276 e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
4278 if (!_e_client_private_init(ec))
4280 e_object_del(E_OBJECT(ec));
4284 uuid_generate(ec->uuid);
4286 ec->focus_policy_override = E_FOCUS_LAST;
4287 e_client_size_set(ec, 1, 1);
4288 ec->internal = internal;
4291 e_pixmap_client_set(cp, ec);
4292 ec->resize_mode = E_POINTER_RESIZE_NONE;
4293 ec->layer = E_LAYER_CLIENT_NORMAL;
4294 ec->first_mapped = EINA_FALSE;
4295 ec->post_raise = EINA_TRUE;
4296 ec->post_lower = EINA_FALSE;
4297 ec->animatable = EINA_TRUE;
4299 /* FIXME: if first_map is 1 then we should ignore the first hide event
4300 * or ensure the window is already hidden and events flushed before we
4301 * create a border for it */
4304 ec->changes.pos = 1;
4306 // needed to be 1 for internal windw and on restart.
4307 // ec->ignore_first_unmap = 2;
4309 ec->offer_resistance = 1;
4311 e_comp->new_clients++;
4313 ec->exp_iconify.by_client = 0;
4314 ec->exp_iconify.not_raise = 0;
4315 ec->exp_iconify.skip_iconify = 0;
4316 ec->exp_iconify.skip_by_remote = 0;
4317 if (e_config->deiconify_approve)
4318 ec->exp_iconify.deiconify_update= 1;
4320 ec->exp_iconify.deiconify_update= 0;
4321 if (e_config->use_buffer_flush)
4322 ec->exp_iconify.buffer_flush = 1;
4324 ec->exp_iconify.buffer_flush = 0;
4326 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
4328 wl_signal_emit_mutable(&PRI(ec)->events.new_client, NULL);
4329 if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec))
4331 /* delete the above allocated object */
4332 //e_object_del(E_OBJECT(ec));
4336 _e_client_aux_hint_eval(ec);
4338 ec->icccm.title = NULL;
4339 ec->icccm.name = NULL;
4340 #if defined(__cplusplus) || defined(c_plusplus)
4341 ec->icccm.cpp_class = NULL;
4343 ec->icccm.class = NULL;
4345 ec->icccm.icon_name = NULL;
4346 ec->icccm.machine = NULL;
4347 ec->icccm.min_w = 1;
4348 ec->icccm.min_h = 1;
4349 ec->icccm.max_w = 32767;
4350 ec->icccm.max_h = 32767;
4351 ec->icccm.base_w = 0;
4352 ec->icccm.base_h = 0;
4353 ec->icccm.step_w = -1;
4354 ec->icccm.step_h = -1;
4355 ec->icccm.min_aspect = 0.0;
4356 ec->icccm.max_aspect = 0.0;
4359 ec->netwm.name = NULL;
4360 ec->netwm.icon_name = NULL;
4361 ec->netwm.desktop = 0;
4362 ec->netwm.state.modal = 0;
4363 ec->netwm.state.sticky = 0;
4364 ec->netwm.state.shaded = 0;
4365 ec->netwm.state.hidden = 0;
4366 ec->netwm.state.maximized_v = 0;
4367 ec->netwm.state.maximized_h = 0;
4368 ec->netwm.state.skip_taskbar = 0;
4369 ec->netwm.state.skip_pager = 0;
4370 ec->netwm.state.fullscreen = 0;
4371 ec->netwm.state.stacking = E_STACKING_NONE;
4372 ec->netwm.action.move = 0;
4373 ec->netwm.action.resize = 0;
4374 ec->netwm.action.minimize = 0;
4375 ec->netwm.action.shade = 0;
4376 ec->netwm.action.stick = 0;
4377 ec->netwm.action.maximized_h = 0;
4378 ec->netwm.action.maximized_v = 0;
4379 ec->netwm.action.fullscreen = 0;
4380 ec->netwm.action.change_desktop = 0;
4381 ec->netwm.action.close = 0;
4382 ec->netwm.opacity = 255;
4384 ec->visibility.obscured = E_VISIBILITY_UNKNOWN;
4385 ec->visibility.opaque = -1;
4386 ec->visibility.changed = 0;
4387 ec->visibility.skip = 0;
4388 ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN;
4390 ec->transform.zoom = 1.0;
4391 ec->transform.angle = 0.0;
4392 ec->transform_core.direct_render = EINA_TRUE;
4393 ec->transform_core.activate = EINA_TRUE;
4395 ec->pointer_enter_sent = EINA_FALSE;
4397 ec->acquire_fence_fd = -1;
4401 e_comp->clients = eina_list_append(e_comp->clients, ec);
4402 eina_hash_add(clients_hash[type], &ec->pixmap, ec);
4404 ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored);
4406 _e_client_event_add(ec);
4407 e_comp_object_client_add(ec);
4410 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
4411 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
4412 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
4413 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
4414 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
4415 evas_object_smart_callback_add(ec->frame, "shade_done", _e_client_cb_evas_shade_done, ec);
4418 #ifdef REFACTOR_ZONE_DESK
4421 _e_client_zone_update(ec);
4423 e_client_desk_set(ec, e_desk_current_get(e_zone_current_get()));
4426 wl_signal_emit_mutable(&PRI(ec)->events.new_client_post, NULL);
4427 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
4428 _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec);
4431 ec->manage_resize.resize_obj = NULL;
4432 ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0;
4433 ec->manage_resize.enable_aspect_ratio = EINA_FALSE;
4434 ec->manage_resize.aw = ec->manage_resize.ah = 0;
4435 ec->manage_resize.header_h = 0;
4436 ec->manage_resize.footer_h = 0;
4438 ec->visibility.ignore_geometry = e_config->calc_vis_ignore_geometry;
4443 E_API Eina_Bool e_client_is_internal(E_Client *ec)
4445 E_OBJECT_CHECK_RETURN(ec, EINA_TRUE);
4446 return ec->internal;
4449 #ifdef REFACTOR_ZONE_DESK
4452 e_client_desk_set(E_Client *ec, E_Desk *desk)
4454 E_Event_Client_Desk_Set *ev;
4459 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4460 E_OBJECT_CHECK(desk);
4461 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
4462 if (e_desk_has_ec(desk, ec)) return;
4466 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
4467 desk->fullscreen_clients = eina_list_append(desk->fullscreen_clients, ec);
4469 old_desk = ec->desk;
4471 e_desk_client_del(old_desk, ec);
4473 e_desk_client_add(desk, ec);
4474 if (!ec->new_client)
4478 e_comp_object_effect_unclip(ec->frame);
4479 e_comp_object_effect_set(ec->frame, NULL);
4481 if (desk->visible || ec->sticky)
4483 if ((!ec->hidden) && (!ec->iconic))
4484 evas_object_show(ec->frame);
4489 evas_object_hide(ec->frame);
4492 e_client_comp_hidden_set(ec, (!desk->visible) && (!ec->sticky));
4493 e_client_zone_set(ec, desk->zone);
4497 ev = E_NEW(E_Event_Client_Desk_Set, 1);
4502 e_object_ref(E_OBJECT(ec));
4503 ev->desk = old_desk;
4504 e_object_ref(E_OBJECT(old_desk));
4505 ecore_event_add(E_EVENT_CLIENT_DESK_SET, ev, (Ecore_End_Cb)_e_client_event_desk_set_free, NULL);
4508 zone = e_comp_zone_find_by_ec(ec);
4509 if (old_desk->zone == zone)
4511 e_client_res_change_geometry_save(ec);
4512 e_client_res_change_geometry_restore(ec);
4513 ec->pre_res_change.valid = 0;
4517 if (e_config->transient.desktop)
4522 EINA_LIST_FOREACH(ec->transients, l, child)
4523 e_client_desk_set(child, ec->desk);
4526 _e_client_hook_call(E_CLIENT_HOOK_DESK_SET, ec);
4527 evas_object_smart_callback_call(ec->frame, "desk_change", ec);
4529 if (ec->desk->desk_area.enable)
4531 if (!ec->desk_area.desk_area)
4534 eda = e_desk_desk_area_base_get(ec->desk);
4535 e_client_desk_area_set(ec, eda);
4538 e_client_desk_area_enable_set(ec, EINA_TRUE);
4544 e_client_desk_iconify_skip_set(E_Client *ec, Eina_Bool skip)
4547 ec->user_skip_winlist = skip;
4551 e_client_desk_iconify_skip_get(E_Client *ec)
4553 if (!ec) return EINA_FALSE;
4554 return ec->user_skip_winlist;
4558 e_client_comp_grabbed_get(void)
4560 return comp_grabbed;
4564 e_client_action_get(void)
4566 return action_client;
4570 //////////////////////////////////////////////////////////
4573 e_client_mouse_in(E_Client *ec, int x, int y)
4577 if (comp_grabbed) return;
4578 if (e_object_is_del(E_OBJECT(ec))) return;
4579 desk = e_comp_desk_find_by_ec(ec);
4580 if (desk && desk->animate_count) return;
4581 ec->mouse.current.mx = x;
4582 ec->mouse.current.my = y;
4585 #ifdef REFACTOR_FOCUS_POLICY
4586 wl_signal_emit_mutable(&PRI(ec)->events.mouse_in, NULL);
4587 _e_client_hook_call(E_CLIENT_HOOK_MOUSE_IN, ec);
4589 if ((!ec->iconic) && (!e_client_util_ignored_get(ec)))
4590 e_focus_event_mouse_in(ec);
4595 e_client_mouse_out(E_Client *ec, int x, int y)
4599 if (comp_grabbed) return;
4600 if (ec->fullscreen) return;
4601 if (e_object_is_del(E_OBJECT(ec))) return;
4602 desk = e_comp_desk_find_by_ec(ec);
4603 if (desk && desk->animate_count) return;
4605 ec->mouse.current.mx = x;
4606 ec->mouse.current.my = y;
4609 #ifdef REFACTOR_FOCUS_POLICY
4610 wl_signal_emit_mutable(&PRI(ec)->events.mouse_out, NULL);
4611 _e_client_hook_call(E_CLIENT_HOOK_MOUSE_OUT, ec);
4613 if ((!ec->iconic) && (!e_client_util_ignored_get(ec)))
4614 e_focus_event_mouse_out(ec);
4619 e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
4621 EINA_SAFETY_ON_NULL_RETURN(ec);
4622 if (action_client) return;
4623 ec->mouse.current.mx = output->x;
4624 ec->mouse.current.my = output->y;
4628 e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
4630 #ifdef REFACTOR_FOCUS_POLICY
4635 EINA_SAFETY_ON_NULL_RETURN(ec);
4636 if (action_client || ec->iconic || e_client_util_ignored_get(ec)) return;
4637 if ((button >= 1) && (button <= 3))
4639 ec->mouse.last_down[button - 1].mx = output->x;
4640 ec->mouse.last_down[button - 1].my = output->y;
4641 ec->mouse.last_down[button - 1].x = ec->x;
4642 ec->mouse.last_down[button - 1].y = ec->y;
4643 ec->mouse.last_down[button - 1].w = ec->w;
4644 ec->mouse.last_down[button - 1].h = ec->h;
4648 ec->moveinfo.down.x = ec->x;
4649 ec->moveinfo.down.y = ec->y;
4650 ec->moveinfo.down.w = ec->w;
4651 ec->moveinfo.down.h = ec->h;
4653 ec->mouse.current.mx = output->x;
4654 ec->mouse.current.my = output->y;
4655 if ((button >= 1) && (button <= 3))
4657 ec->mouse.last_down[button - 1].mx = output->x;
4658 ec->mouse.last_down[button - 1].my = output->y;
4659 ec->mouse.last_down[button - 1].x = ec->x;
4660 ec->mouse.last_down[button - 1].y = ec->y;
4661 ec->mouse.last_down[button - 1].w = ec->w;
4662 ec->mouse.last_down[button - 1].h = ec->h;
4666 ec->moveinfo.down.x = ec->x;
4667 ec->moveinfo.down.y = ec->y;
4668 ec->moveinfo.down.w = ec->w;
4669 ec->moveinfo.down.h = ec->h;
4671 ec->mouse.current.mx = output->x;
4672 ec->mouse.current.my = output->y;
4674 #ifdef REFACTOR_FOCUS_POLICY
4675 wl_signal_emit_mutable(&PRI(ec)->events.mouse_down, NULL);
4676 _e_client_hook_call(E_CLIENT_HOOK_MOUSE_DOWN, ec);
4678 focused = e_client_focused_get();
4679 if ((focused) && (ec != focused))
4681 e_focus_event_mouse_down(ec);
4687 e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
4689 EINA_SAFETY_ON_NULL_RETURN(ec);
4690 if (ec->iconic || e_client_util_ignored_get(ec)) return;
4691 if ((button >= 1) && (button <= 3))
4693 ec->mouse.last_up[button - 1].mx = output->x;
4694 ec->mouse.last_up[button - 1].my = output->y;
4695 ec->mouse.last_up[button - 1].x = ec->x;
4696 ec->mouse.last_up[button - 1].y = ec->y;
4698 ec->mouse.current.mx = output->x;
4699 ec->mouse.current.my = output->y;
4700 /* also we don't pass the same params that went in - then again that */
4701 /* should be ok as we are just ending the action if it has an end */
4702 if (ec->cur_mouse_action)
4704 if (ec->cur_mouse_action->func.end_mouse)
4705 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
4706 else if (ec->cur_mouse_action->func.end)
4707 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4708 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4709 ec->cur_mouse_action = NULL;
4712 if ((button >= 1) && (button <= 3))
4714 ec->mouse.last_up[button - 1].mx = output->x;
4715 ec->mouse.last_up[button - 1].my = output->y;
4716 ec->mouse.last_up[button - 1].x = ec->x;
4717 ec->mouse.last_up[button - 1].y = ec->y;
4722 e_client_stay_within_canvas_margin(E_Client *ec)
4729 _e_client_stay_within_canvas_margin(ec, ec->x, ec->y, &new_x, &new_y);
4731 if ((ec->x != new_x) || (ec->y != new_y))
4732 evas_object_move(ec->frame, new_x, new_y);
4737 e_client_mouse_move(E_Client *ec, Evas_Point *output)
4739 EINA_SAFETY_ON_NULL_RETURN(ec);
4740 if (ec->iconic || e_client_util_ignored_get(ec)) return;
4741 ec->mouse.current.mx = output->x;
4742 ec->mouse.current.my = output->y;
4743 if (e_client_util_moving_get(ec))
4745 _e_client_move_handle(ec);
4747 else if (e_client_util_resizing_get(ec))
4749 _e_client_resize_handle(ec);
4752 ///////////////////////////////////////////////////////
4755 e_client_res_change_geometry_save(E_Client *ec)
4758 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4760 if (ec->pre_res_change.valid) return;
4761 ec->pre_res_change.valid = 1;
4762 ec->pre_res_change.x = ec->x;
4763 ec->pre_res_change.y = ec->y;
4764 ec->pre_res_change.w = ec->w;
4765 ec->pre_res_change.h = ec->h;
4766 ec->pre_res_change.saved.x = ec->saved.x;
4767 ec->pre_res_change.saved.y = ec->saved.y;
4768 ec->pre_res_change.saved.w = ec->saved.w;
4769 ec->pre_res_change.saved.h = ec->saved.h;
4773 e_client_res_change_geometry_restore(E_Client *ec)
4779 unsigned char valid : 1;
4788 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4789 if (!ec->pre_res_change.valid) return;
4790 if (ec->new_client) return;
4792 zone = e_comp_zone_find_by_ec(ec);
4795 memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
4799 e_client_unfullscreen(ec);
4800 e_client_fullscreen(ec, e_config->fullscreen_policy);
4802 else if (ec->maximized != E_MAXIMIZE_NONE)
4806 max = ec->maximized;
4807 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
4808 e_client_maximize(ec, max);
4812 int x, y, w, h, zx, zy, zw, zh;
4814 ec->saved.x = ec->pre_res_change.saved.x;
4815 ec->saved.y = ec->pre_res_change.saved.y;
4816 ec->saved.w = ec->pre_res_change.saved.w;
4817 ec->saved.h = ec->pre_res_change.saved.h;
4819 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
4821 if (ec->saved.w > zw)
4823 if ((ec->saved.x + ec->saved.w) > (zx + zw))
4824 ec->saved.x = zx + zw - ec->saved.w;
4826 if (ec->saved.h > zh)
4828 if ((ec->saved.y + ec->saved.h) > (zy + zh))
4829 ec->saved.y = zy + zh - ec->saved.h;
4831 x = ec->pre_res_change.x;
4832 y = ec->pre_res_change.y;
4833 w = ec->pre_res_change.w;
4834 h = ec->pre_res_change.h;
4839 if ((x + w) > (zx + zw))
4841 if ((y + h) > (zy + zh))
4843 evas_object_geometry_set(ec->frame, x, y, w, h);
4845 memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
4848 #ifdef REFACTOR_ZONE_DESK
4851 e_client_zone_set(E_Client *ec, E_Zone *zone)
4853 E_Event_Client_Zone_Set *ev;
4856 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4857 E_OBJECT_CHECK(zone);
4858 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
4859 if (e_zone_has_ec(zone, ec)) return;
4861 ev = E_NEW(E_Event_Client_Zone_Set, 1);
4864 /* if the window does not lie in the new zone, move it so that it does */
4865 if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
4869 x = ec->x, y = ec->y;
4871 /* keep window from hanging off bottom and left */
4872 if (x + ec->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + ec->w);
4873 if (y + ec->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + ec->h);
4875 /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
4876 if (x < zone->x) x = zone->x;
4877 if (y < zone->y) y = zone->y;
4879 if (!E_INTERSECTS(x, y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
4881 /* still not in zone at all, so just move it to closest edge */
4882 if (x < zone->x) x = zone->x;
4883 if (x >= zone->x + zone->w) x = zone->x + zone->w - ec->w;
4884 if (y < zone->y) y = zone->y;
4885 if (y >= zone->y + zone->h) y = zone->y + zone->h - ec->h;
4887 evas_object_move(ec->frame, x, y);
4890 // TODO: NEED TO DELETE LINE BELOW
4895 e_object_ref(E_OBJECT(ec));
4897 e_object_ref(E_OBJECT(zone));
4899 ecore_event_add(E_EVENT_CLIENT_ZONE_SET, ev, (Ecore_End_Cb)_e_client_event_zone_set_free, NULL);
4901 // TODO: change all use of e_client_zone_set() to e_zone_client_add()
4902 e_zone_client_add(zone, ec);
4907 e_client_pos_set(E_Client *ec, int x, int y)
4915 e_client_pos_get(E_Client *ec, int *x, int *y)
4931 e_client_size_set(E_Client *ec, int w, int h)
4939 e_client_size_get(E_Client *ec, int *w, int *h)
4955 e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
4963 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4965 if (e_client_transform_core_enable_get(ec))
4967 gx = ec->transform_core.result.boundary.x;
4968 gy = ec->transform_core.result.boundary.y;
4969 gw = ec->transform_core.result.boundary.w;
4970 gh = ec->transform_core.result.boundary.h;
4976 evas_object_geometry_get(ec->frame, &gx, &gy, &gw, &gh);
4977 if (gw == 0 && gh == 0)
4979 /* In this case, there is no image buffer in e_comp_object, thus it
4980 * should return geometry value of ec itself. It usually happens if
4981 * new ec is not mapped yet.
5005 e_client_above_get(const E_Client *ec)
5010 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
5011 if (EINA_INLIST_GET(ec)->next) //check current layer
5013 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
5017 ELOGF("FATAL", "CHECK the ec inlist next", ec);
5020 if (!e_object_is_del(E_OBJECT(ec2)))
5024 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
5025 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
5027 /* go up the layers until we find one */
5028 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
5030 if (!e_comp->layers[x].clients) continue;
5031 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
5035 ELOGF("FATAL", "EC exist above layer. ec layer_map:%d, cur layer_map:%d",
5036 ec, e_comp_canvas_layer_map(ec->layer), x);
5039 if (!e_object_is_del(E_OBJECT(ec2)))
5047 e_client_below_get(const E_Client *ec)
5052 E_Layer ec_layer, ec_layer_cw;
5055 E_OBJECT_CHECK_RETURN(ec, NULL);
5056 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
5058 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
5059 if (EINA_INLIST_GET(ec)->prev) //check current layer
5061 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
5063 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
5066 ELOGF("FATAL", "CHECK the ec inlist prev", ec);
5069 if (!e_object_is_del(E_OBJECT(ec2)))
5074 // check layer validation
5075 ec_layer = ec->layer;
5076 if (ec->layer_block || ec->layer_pending)
5078 cw_layer = e_comp_object_layer_get(ec->frame);
5081 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
5082 if (ec_layer != ec_layer_cw)
5084 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);
5085 ec_layer = ec_layer_cw;
5090 if (ec_layer == E_LAYER_CLIENT_DESKTOP) return NULL;
5091 if (e_comp_canvas_client_layer_map(ec_layer) == 9999) return NULL;
5093 /* go down the layers until we find one */
5094 x = e_comp_canvas_layer_map(ec_layer);
5097 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
5099 if (!e_comp->layers[x].clients) continue;
5100 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
5104 ELOGF("FATAL", "EC exist below layer. ec layer_map:%d, cur layer_map:%d",
5105 ec, e_comp_canvas_layer_map(ec_layer), x);
5108 if (!e_object_is_del(E_OBJECT(ec2)))
5116 e_client_bottom_get(void)
5119 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
5123 if (!e_comp->layers[x].clients) continue;
5124 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
5125 if (!e_object_is_del(E_OBJECT(ec2)))
5132 e_client_top_get(void)
5135 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
5139 if (!e_comp->layers[x].clients) continue;
5140 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
5141 if (!e_object_is_del(E_OBJECT(ec2)))
5147 EINTERN unsigned int
5148 e_clients_count(void)
5150 return eina_list_count(e_comp->clients);
5155 * Set a callback which will be called just prior to updating the
5156 * move coordinates for a border
5159 e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
5161 ec->move_intercept_cb = cb;
5164 ///////////////////////////////////////
5166 E_API E_Client_Hook *
5167 e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
5171 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_HOOK_LAST, NULL);
5172 ch = E_NEW(E_Client_Hook, 1);
5173 if (!ch) return NULL;
5174 ch->hookpoint = hookpoint;
5176 ch->data = (void*)data;
5177 _e_client_hooks[hookpoint] = eina_inlist_append(_e_client_hooks[hookpoint], EINA_INLIST_GET(ch));
5182 e_client_hook_del(E_Client_Hook *ch)
5185 if (_e_client_hooks_walking == 0)
5187 _e_client_hooks[ch->hookpoint] = eina_inlist_remove(_e_client_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
5191 _e_client_hooks_delete++;
5194 ///////////////////////////////////////
5196 E_API E_Client_Intercept_Hook *
5197 e_client_intercept_hook_add(E_Client_Intercept_Hook_Point hookpoint, E_Client_Intercept_Hook_Cb func, const void *data)
5199 E_Client_Intercept_Hook *ch;
5201 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_INTERCEPT_HOOK_LAST, NULL);
5202 ch = E_NEW(E_Client_Intercept_Hook, 1);
5203 if (!ch) return NULL;
5204 ch->hookpoint = hookpoint;
5206 ch->data = (void*)data;
5207 _e_client_intercept_hooks[hookpoint] = eina_inlist_append(_e_client_intercept_hooks[hookpoint], EINA_INLIST_GET(ch));
5212 e_client_intercept_hook_del(E_Client_Intercept_Hook *ch)
5217 if (_e_client_intercept_hooks_walking == 0)
5219 _e_client_intercept_hooks[ch->hookpoint] =
5220 eina_inlist_remove(_e_client_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
5224 _e_client_intercept_hooks_delete++;
5227 #ifdef REFACTOR_FOCUS_POLICY
5230 e_client_focus_stack_lower(E_Client *ec)
5232 Eina_List *l = NULL;
5233 E_Client *ec2 = NULL;
5235 EINA_SAFETY_ON_NULL_RETURN(ec);
5237 focus_stack = eina_list_remove(focus_stack, ec);
5239 EINA_LIST_REVERSE_FOREACH(focus_stack, l, ec2)
5241 if (ec2 == NULL) continue;
5242 if (ec2->layer < ec->layer) continue;
5244 focus_stack = eina_list_append_relative_list(focus_stack, ec, l);
5248 focus_stack = eina_list_prepend(focus_stack, ec);
5254 e_client_focus_latest_set(E_Client *ec)
5256 EINA_SAFETY_ON_NULL_RETURN(ec);
5258 #ifdef REFACTOR_FOCUS_POLICY
5259 wl_signal_emit_mutable(&PRI(ec)->events.focus_latest_set, NULL);
5260 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_LATEST_SET, ec);
5262 focus_stack = eina_list_remove(focus_stack, ec);
5263 focus_stack = eina_list_prepend(focus_stack, ec);
5267 #ifdef REFACTOR_FOCUS_POLICY
5270 e_client_focus_stack_append_current_focused(E_Client *ec)
5272 Eina_List *l = NULL;
5273 E_Client *temp_ec = NULL;
5275 if (!ec) CRI("ACK");
5277 focus_stack = eina_list_remove(focus_stack, ec);
5279 EINA_LIST_FOREACH(focus_stack, l, temp_ec)
5281 if (temp_ec != focused) continue;
5283 focus_stack = eina_list_append_relative_list(focus_stack, ec, l);
5287 focus_stack = eina_list_prepend(focus_stack, ec);
5293 e_client_focus_defer_set(E_Client *ec)
5295 EINA_SAFETY_ON_NULL_RETURN(ec);
5296 #ifdef REFACTOR_FOCUS_POLICY
5297 wl_signal_emit_mutable(&PRI(ec)->events.focus_defer_set, NULL);
5298 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_DEFER_SET, ec);
5300 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5302 ELOGF("FOCUS", "focus defer set", ec);
5304 defer_focus_stack = eina_list_remove(defer_focus_stack, ec);
5305 defer_focus_stack = eina_list_prepend(defer_focus_stack, ec);
5309 #ifdef REFACTOR_FOCUS_POLICY
5312 e_client_focus_defer_unset(E_Client *ec)
5314 EINA_SAFETY_ON_NULL_RETURN(ec);
5315 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5317 ELOGF("FOCUS", "focus defer unset", ec);
5319 defer_focus_stack = eina_list_remove(defer_focus_stack, ec);
5323 e_client_focus_defer_clear(void)
5325 if (!defer_focus_stack) return;
5327 ELOGF("FOCUS", "focus defer clear", NULL);
5329 defer_focus_stack = eina_list_free(defer_focus_stack);
5333 e_client_refocus(void)
5339 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5341 EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec)
5343 desk = e_comp_desk_find_by_ec(ec);
5344 if (!desk) continue;
5345 if (desk->visible && (!ec->iconic))
5347 g_mutex_lock(&e_comp->input_key_grabs_mutex);
5348 if (e_comp->input_key_grabs || e_comp->input_mouse_grabs)
5350 g_mutex_unlock(&e_comp->input_key_grabs_mutex);
5353 g_mutex_unlock(&e_comp->input_key_grabs_mutex);
5354 ELOGF("FOCUS", "focus set | refocus", ec);
5355 e_client_frame_focus_set(ec, EINA_TRUE);
5363 * Sets the focus to the given client if necessary
5364 * There are 3 cases of different focus_policy-configurations:
5366 * - E_FOCUS_CLICK: just set the focus, the most simple one
5368 * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
5369 * warp the pointer to the window. If this fails (because
5370 * the pointer is already in the window), just set the focus.
5372 * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
5373 * last window which was focused, if the mouse is on the
5374 * desktop. So, we need to look if there is another window
5375 * under the pointer and warp to pointer to the right
5376 * one if so (also, we set the focus afterwards). In case
5377 * there is no window under pointer, the pointer is on the
5378 * desktop and so we just set the focus.
5381 * This function is to be called when setting the focus was not
5382 * explicitly triggered by the user (by moving the mouse or
5383 * clicking for example), but implicitly (by closing a window,
5384 * the last focused window should get focus).
5388 e_client_focus_set_with_pointer(E_Client *ec)
5391 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5392 /* note: this is here as it seems there are enough apps that do not even
5393 * expect us to emulate a look of focus but not actually set x input
5394 * focus as we do - so simply abort any focuse set on such windows */
5395 /* be strict about accepting focus hint */
5396 if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) return;
5398 if ((!ec->icccm.accepts_focus) &&
5399 (!ec->icccm.take_focus)) return;
5400 if (ec->lock_focus_out) return;
5401 if (ec == focused) return;
5403 TRACE_DS_BEGIN(CLIENT:FOCUS SET WITH POINTER);
5404 ELOGF("FOCUS", "focus set | focus with pointer", ec);
5405 e_client_frame_focus_set(ec, EINA_TRUE);
5407 if (e_config->focus_policy == E_FOCUS_CLICK)
5423 e_client_focused_set(E_Client *ec)
5425 #ifdef REFACTOR_FOCUS_POLICY
5426 E_Client *focused_ec;
5430 ELOGF("FOCUS", "CLIENT FOCUSED_SET : SET", ec);
5432 ELOGF("FOCUS", "CLIENT FOCUSED_SET : UNSET", NULL);
5434 focused_ec = e_comp_focused_ec_get();
5435 if (ec == focused_ec) return;
5437 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
5439 // unset the current focused_ec if focused_ec is not being deleted
5442 if (!e_object_is_del(E_OBJECT(focused_ec)))
5444 // FIXME: Remove focus_unset event of client.
5445 // Instead, make zone focus_unset event and use it.
5446 wl_signal_emit_mutable(&PRI(focused_ec)->events.focus_unset, NULL);
5447 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, focused_ec);
5449 if (e_object_ref_get(E_OBJECT(focused_ec)) > 0)
5451 _e_client_event_simple(focused_ec, E_EVENT_CLIENT_FOCUS_OUT);
5452 e_client_urgent_set(focused_ec, focused_ec->icccm.urgent);
5457 // clear the current focused_ec when ec is NULL
5460 zone = e_comp_zone_find_by_ec(focused_ec);
5461 e_zone_focus_clear(zone);
5466 // FIXME: Remove focus_set event of client.
5467 // Instead, make zone focus_set event and use it.
5468 // set the new current focused_ec
5469 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, NULL);
5470 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
5472 // send the client_focuse_in event
5473 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
5475 #ifdef REFACTOR_ZONE_DESK
5477 // TODO: This is not for focus, but for Window Placement policy.
5478 // Move this code to the better place.
5479 if (ec->sticky && ec->desk && (!ec->desk->visible))
5480 e_client_desk_set(ec, e_desk_current_get(zone));
5485 E_Client *ec2, *ec_unfocus = focused;
5489 if (ec == focused) return;
5491 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
5493 ELOGF("FOCUS", "CLIENT FOCUS_SET", ec);
5495 g_mutex_lock(&focused_ec_mutex);
5497 g_mutex_unlock(&focused_ec_mutex);
5499 zone = e_comp_zone_find_by_ec(ec);
5503 e_client_urgent_set(ec, 0);
5504 int x, total = zone->desk_x_count * zone->desk_y_count;
5506 for (x = 0; x < total; x++)
5508 E_Desk *desk = zone->desks[x];
5509 /* if there's any fullscreen non-parents on this desk, unfullscreen them */
5510 EINA_LIST_FOREACH_SAFE(desk->fullscreen_clients, l, ll, ec2)
5512 if (ec2 == ec) continue;
5513 if (e_object_is_del(E_OBJECT(ec2))) continue;
5514 /* but only if it's the same desk or one of the clients is sticky */
5515 if ((e_desk_has_ec(desk, ec)) || (ec->sticky || ec2->sticky))
5517 if (!eina_list_data_find(ec->transients, ec2))
5518 e_client_unfullscreen(ec2);
5524 while ((ec_unfocus) && (ec_unfocus->zone))
5526 ec_unfocus->want_focus = ec_unfocus->focused = 0;
5527 if (ec_unfocus->mouse.in && ec && (!e_client_util_is_popup(ec)) &&
5528 (e_config->focus_policy != E_FOCUS_CLICK))
5529 e_client_mouse_out(ec_unfocus, ec_unfocus->x - 1, ec_unfocus->y - 1);
5531 /* if there unfocus client is fullscreen and visible */
5532 if ((ec_unfocus->fullscreen) && (!ec_unfocus->iconic) && (!ec_unfocus->hidden) &&
5533 (ec_unfocus->zone == e_zone_current_get()) &&
5534 ((ec_unfocus->desk == e_desk_current_get(ec_unfocus->zone)) || (ec_unfocus->sticky)))
5536 Eina_Bool have_vis_child = EINA_FALSE;
5538 /* if any of its children are visible */
5539 EINA_LIST_FOREACH(ec_unfocus->transients, l, ec2)
5541 if ((ec2->zone == ec_unfocus->zone) &&
5542 ((ec2->desk == ec_unfocus->desk) ||
5543 (ec2->sticky) || (ec_unfocus->sticky)))
5545 have_vis_child = EINA_TRUE;
5549 /* if no children are visible, unfullscreen */
5550 if ((!e_object_is_del(E_OBJECT(ec_unfocus))) && (!have_vis_child))
5551 e_client_unfullscreen(ec_unfocus);
5554 if (!e_object_is_del(E_OBJECT(ec_unfocus)))
5556 wl_signal_emit_mutable(&PRI(ec)->events.focus_unset, focused_ec);
5557 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, ec_unfocus);
5559 /* only send event here if we're not being deleted */
5560 if ((!e_object_is_del(E_OBJECT(ec_unfocus))) &&
5561 (e_object_ref_get(E_OBJECT(ec_unfocus)) > 0))
5563 _e_client_event_simple(ec_unfocus, E_EVENT_CLIENT_FOCUS_OUT);
5564 e_client_urgent_set(ec_unfocus, ec_unfocus->icccm.urgent);
5567 e_client_focus_defer_unset(ec_unfocus);
5576 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, ec);
5577 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
5579 e_client_focus_latest_set(ec);
5581 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
5583 #ifdef REFACTOR_ZONE_DESK
5585 if (ec->sticky && ec->desk && (!ec->desk->visible))
5586 e_client_desk_set(ec, e_desk_current_get(zone));
5594 e_client_activate(E_Client *ec)
5597 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5599 TRACE_DS_BEGIN(CLIENT:ACTIVATE);
5601 ELOGF("COMP", "Set launching flag..", ec);
5602 ec->launching = EINA_TRUE;
5604 ec->exp_iconify.not_raise = 0;
5608 if (!ec->lock_user_iconify)
5609 e_client_uniconify(ec);
5611 ELOGF("COMP", "Un-Set ICONIFY BY CLIENT", ec);
5612 ec->exp_iconify.by_client = 0;
5613 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
5615 #ifdef REFACTOR_ZONE_DESK
5617 if ((!ec->iconic) && (!ec->sticky))
5619 e_desk_show(ec->desk);
5621 if (!ec->lock_user_stacking)
5623 if (ec->shaded || ec->shading)
5624 e_client_unshade(ec, ec->shade_dir);
5627 #ifdef REFACTOR_FOCUS_POLICY
5628 // This code will be executed at E_CLIENT_HOOK_ACTIVATE_DONE callback at e_focus_policy_history.c
5630 if (!ec->lock_focus_out)
5632 E_Client *focus_ec = NULL;
5633 E_Client *obscured_above = NULL;
5636 focus_ec = e_client_transient_child_top_get(ec, EINA_TRUE);
5642 e_client_focus_latest_set(ec);
5643 e_client_focus_latest_set(focus_ec);
5644 e_client_focus_defer_unset(ec);
5647 obscured_above = e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
5648 if (!obscured_above)
5650 if (!e_policy_visibility_client_is_uniconic(ec))
5652 e_client_focus_defer_set(focus_ec);
5653 e_client_focus_latest_set(focus_ec);
5657 if (e_config->focus_policy_ext != E_FOCUS_EXT_TOP_STACK)
5659 ELOGF("FOCUS", "focus set | client activate", focus_ec);
5660 e_client_frame_focus_set(focus_ec, EINA_TRUE);
5666 e_client_focus_defer_set(focus_ec);
5667 e_client_focus_latest_set(focus_ec);
5672 #ifdef REFACTOR_ZONE_DESK
5674 if (!e_client_desk_iconify_skip_get(ec))
5676 e_desk_visible_client_iconified_list_remove_all(ec->desk);
5680 wl_signal_emit_mutable(&PRI(ec)->events.activate_done, NULL);
5681 _e_client_hook_call(E_CLIENT_HOOK_ACTIVATE_DONE, ec);
5687 e_client_focused_get(void)
5689 #ifdef REFACTOR_FOCUS_POLICY
5690 return e_comp_focused_ec_get();
5692 E_Client *focused_ec = NULL;
5694 g_mutex_lock(&focused_ec_mutex);
5695 focused_ec = focused;
5696 g_mutex_unlock(&focused_ec_mutex);
5702 #ifdef REFACTOR_FOCUS_POLICY
5705 e_client_focus_stack_get(void)
5711 e_client_defer_focus_stack_get(void)
5713 return defer_focus_stack;
5717 e_client_focus_stack_set(Eina_List *l)
5723 e_client_focus_stack_clear(void)
5725 if (!focus_stack) return;
5727 focus_stack = eina_list_free(focus_stack);
5732 e_client_lost_windows_get(E_Zone *zone)
5734 Eina_List *list = NULL;
5737 int loss_overlap = 5;
5739 E_OBJECT_CHECK_RETURN(zone, NULL);
5740 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
5741 EINA_LIST_FOREACH(e_comp->clients, l, ec)
5743 if (!e_zone_has_ec(zone, ec)) continue;
5744 if (e_client_util_ignored_get(ec)) continue;
5746 if (!E_INTERSECTS(zone->x + loss_overlap,
5747 zone->y + loss_overlap,
5748 zone->w - (2 * loss_overlap),
5749 zone->h - (2 * loss_overlap),
5750 ec->x, ec->y, ec->w, ec->h))
5752 list = eina_list_append(list, ec);
5758 ///////////////////////////////////////
5761 e_client_shade(E_Client *ec, E_Direction dir)
5764 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5765 if ((ec->shaded) || (ec->shading) || (ec->fullscreen) ||
5766 ((ec->maximized) && (!e_config->allow_manip))) return;
5767 if (!e_util_strcmp("borderless", ec->bordername)) return;
5768 if (!e_comp_object_frame_allowed(ec->frame)) return;
5772 ec->shade_dir = dir;
5774 evas_object_smart_callback_call(ec->frame, "shaded", (uintptr_t*)dir);
5778 e_client_unshade(E_Client *ec, E_Direction dir)
5781 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5782 if ((!ec->shaded) || (ec->shading))
5788 evas_object_smart_callback_call(ec->frame, "unshaded", (uintptr_t*)dir);
5791 ///////////////////////////////////////
5794 e_client_maximized_geometry_set(E_Client *ec, int x, int y, int w, int h)
5798 ec->maximized_info.x = x;
5799 ec->maximized_info.y = y;
5800 ec->maximized_info.w = w;
5801 ec->maximized_info.h = h;
5803 e_client_frame_geometry_set(ec, x, y, w, h);
5807 e_client_maximized_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5811 if (x) *x = ec->maximized_info.x;
5812 if (y) *y = ec->maximized_info.y;
5813 if (w) *w = ec->maximized_info.w;
5814 if (h) *h = ec->maximized_info.h;
5818 e_client_maximize_update(E_Client *ec)
5823 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5827 max = ec->maximized;
5829 e_client_maximize(ec, max);
5834 e_client_maximize(E_Client *ec, E_Maximize max)
5836 #ifdef REFACTOR_ZONE_DESK
5838 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5840 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
5842 if ((ec->shaded) || (ec->shading)) return;
5844 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
5846 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
5852 ec->changes.need_maximize = 1;
5853 ec->maximized &= ~E_MAXIMIZE_TYPE;
5854 ec->maximized |= max;
5859 // store the E_Maximize value requested
5860 ec->requested_max = max;
5862 // call the maximize hook of a client
5863 wl_signal_emit_mutable(&PRI(ec)->events.maximize, &max);
5864 _e_client_hook_call(E_CLIENT_HOOK_MAXIMIZE, ec);
5866 // clear the E_Maximize value requested
5867 ec->requested_max = E_MAXIMIZE_NONE;
5869 // store the E_Maximize value
5870 ec->maximized = max;
5871 ec->changes.need_unmaximize = 0;
5873 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
5879 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5881 zone = e_comp_zone_find_by_ec(ec);
5883 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
5885 if ((ec->shaded) || (ec->shading)) return;
5887 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
5889 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
5895 ec->changes.need_maximize = 1;
5896 ec->maximized &= ~E_MAXIMIZE_TYPE;
5897 ec->maximized |= max;
5902 if (ec->desk_area.enable && ec->desk_area.desk_area)
5904 desk_x = ec->desk_area.desk_area->x;
5905 desk_y = ec->desk_area.desk_area->y;
5909 desk_x = ec->desk->geom.x;
5910 desk_y = ec->desk->geom.y;
5913 evas_object_smart_callback_call(ec->frame, "maximize_pre", NULL);
5916 e_client_unfullscreen(ec);
5917 ec->pre_res_change.valid = 0;
5918 if (!(ec->maximized & E_MAXIMIZE_HORIZONTAL))
5920 /* Horizontal hasn't been set */
5921 ec->saved.x = ec->client.x - desk_x;
5922 ec->saved.w = ec->client.w;
5924 if (!(ec->maximized & E_MAXIMIZE_VERTICAL))
5926 /* Vertical hasn't been set */
5927 ec->saved.y = ec->client.y - desk_y;
5928 ec->saved.h = ec->client.h;
5931 ec->saved.zone = zone->num;
5933 _e_client_maximize(ec, max);
5935 ec->maximized = max;
5936 ec->changes.need_unmaximize = 0;
5938 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
5943 e_client_unmaximize(E_Client *ec, E_Maximize max)
5945 #ifdef REFACTOR_ZONE_DESK
5947 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5949 if (!(max & E_MAXIMIZE_DIRECTION))
5951 CRI("BUG: Unmaximize call without direction!");
5956 ec->changes.need_unmaximize = 1;
5961 if ((ec->shaded) || (ec->shading)) return;
5963 /* Remove directions not used */
5964 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
5965 /* Can only remove existing maximization directions */
5968 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
5970 // store the E_Maximize value requested
5971 ec->requested_max = max;
5973 // call the unmaximize hook of a client
5974 wl_signal_emit_mutable(&PRI(ec)->events.unmaximize, &max);
5975 _e_client_hook_call(E_CLIENT_HOOK_UNMAXIMIZE, ec);
5977 // clear the E_Maximize value requested
5978 ec->requested_max = E_MAXIMIZE_NONE;
5980 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
5981 ec->changes.need_unmaximize = 0;
5986 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5988 zone = e_comp_zone_find_by_ec(ec);
5990 if (!(max & E_MAXIMIZE_DIRECTION))
5992 CRI("BUG: Unmaximize call without direction!");
5997 ec->changes.need_unmaximize = 1;
6002 if ((ec->shaded) || (ec->shading)) return;
6004 /* Remove directions not used */
6005 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
6006 /* Can only remove existing maximization directions */
6009 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
6011 if (ec->maximized & E_MAXIMIZE_TYPE)
6013 ec->pre_res_change.valid = 0;
6014 ec->changes.need_maximize = 0;
6016 if ((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)
6018 E_Maximize tmp_max = ec->maximized;
6020 //un-set maximized state for updating frame.
6021 ec->maximized = E_MAXIMIZE_NONE;
6022 _e_client_frame_update(ec);
6023 // re-set maximized state for unmaximize smart callback.
6024 ec->maximized = tmp_max;
6025 evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
6026 // un-set maximized state.
6027 ec->maximized = E_MAXIMIZE_NONE;
6028 e_client_util_move_resize_without_frame(ec,
6029 ec->saved.x + zone->x,
6030 ec->saved.y + zone->y,
6031 ec->saved.w, ec->saved.h);
6032 ec->saved.x = ec->saved.y = ec->saved.w = ec->saved.h = 0;
6037 Eina_Bool horiz = EINA_FALSE, vert = EINA_FALSE;
6044 if (max & E_MAXIMIZE_VERTICAL)
6046 /* Remove vertical */
6049 y = ec->saved.y + zone->y;
6050 if ((max & E_MAXIMIZE_VERTICAL) == E_MAXIMIZE_VERTICAL)
6052 ec->maximized &= ~E_MAXIMIZE_VERTICAL;
6053 ec->maximized &= ~E_MAXIMIZE_LEFT;
6054 ec->maximized &= ~E_MAXIMIZE_RIGHT;
6056 if ((max & E_MAXIMIZE_LEFT) == E_MAXIMIZE_LEFT)
6057 ec->maximized &= ~E_MAXIMIZE_LEFT;
6058 if ((max & E_MAXIMIZE_RIGHT) == E_MAXIMIZE_RIGHT)
6059 ec->maximized &= ~E_MAXIMIZE_RIGHT;
6061 if (max & E_MAXIMIZE_HORIZONTAL)
6063 /* Remove horizontal */
6065 x = ec->saved.x + zone->x;
6067 ec->maximized &= ~E_MAXIMIZE_HORIZONTAL;
6070 if (!(ec->maximized & E_MAXIMIZE_DIRECTION))
6072 ec->maximized = E_MAXIMIZE_NONE;
6073 _e_client_frame_update(ec);
6074 evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
6075 e_client_resize_limit(ec, &w, &h);
6076 e_client_pos_set(ec, x, y);
6077 if ((ec->saved.w != 0) && (ec->saved.h != 0))
6079 if ((w != ec->saved.w) || (h != ec->saved.h))
6081 e_policy_visibility_client_defer_move(ec);
6087 evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
6088 e_client_resize_limit(ec, &w, &h);
6089 e_client_pos_set(ec, x, y);
6090 if ((ec->saved.w != 0) && (ec->saved.h != 0))
6092 if ((w != ec->saved.w) || (h != ec->saved.h))
6094 e_policy_visibility_client_defer_move(ec);
6099 ec->saved.h = ec->saved.y = 0;
6101 ec->saved.w = ec->saved.x = 0;
6104 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
6105 ec->changes.need_unmaximize = 0;
6110 e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
6112 #ifdef REFACTOR_ZONE_DESK
6114 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6116 if ((ec->shaded) || (ec->shading) || (ec->fullscreen)) return;
6118 // call the fullscreen_pre hook of a client
6119 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
6120 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
6122 ec->fullscreen_policy = policy;
6124 // call the fullscreen hook of a client
6125 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
6126 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN, ec);
6128 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
6134 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6136 zone = e_comp_zone_find_by_ec(ec);
6139 if ((ec->shaded) || (ec->shading) || (ec->fullscreen)) return;
6141 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
6142 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
6144 if (ec->skip_fullscreen) return;
6145 if (!ec->desk->visible) return;
6148 ec->need_fullscreen = 1;
6151 if (e_comp->nocomp_ec && (ec->desk == e_comp->nocomp_ec->desk))
6152 e_comp->nocomp_ec = ec;
6153 ec->desk->fullscreen_clients = eina_list_append(ec->desk->fullscreen_clients, ec);
6154 ec->pre_res_change.valid = 0;
6165 ec->saved.x = ec->client.x - zone->x;
6166 ec->saved.y = ec->client.y - zone->y;
6167 ec->saved.w = ec->client.w;
6168 ec->saved.h = ec->client.h;
6170 ec->saved.maximized = ec->maximized;
6171 ec->saved.zone = zone->num;
6175 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
6182 ec->saved.layer = ec->layer;
6183 e_client_layer_set(ec, E_LAYER_CLIENT_FULLSCREEN);
6186 if ((eina_list_count(e_comp->zones) > 1) ||
6187 (policy == E_FULLSCREEN_RESIZE))
6189 e_client_frame_geometry_set(ec, zone->x, zone->y, zone->w, zone->h);
6191 else if (policy == E_FULLSCREEN_ZOOM)
6193 /* compositor backends! */
6194 evas_object_smart_callback_call(ec->frame, "fullscreen_zoom", NULL);
6197 if (!e_client_util_ignored_get(ec))
6198 _e_client_frame_update(ec);
6199 ec->fullscreen_policy = policy;
6200 evas_object_smart_callback_call(ec->frame, "fullscreen", NULL);
6202 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
6203 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
6208 e_client_unfullscreen(E_Client *ec)
6210 #ifdef REFACTOR_ZONE_DESK
6212 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6214 if ((ec->shaded) || (ec->shading)) return;
6215 if (!ec->fullscreen) return;
6217 // call the unfullscreen hook of a client
6218 wl_signal_emit_mutable(&PRI(ec)->events.unfullscreen, NULL);
6219 _e_client_hook_call(E_CLIENT_HOOK_UNFULLSCREEN, ec);
6221 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
6226 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6228 zone = e_comp_zone_find_by_ec(ec);
6230 if ((ec->shaded) || (ec->shading)) return;
6231 if (!ec->fullscreen) return;
6232 ec->pre_res_change.valid = 0;
6234 ec->need_fullscreen = 0;
6235 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
6237 if (ec->fullscreen_policy == E_FULLSCREEN_ZOOM)
6238 evas_object_smart_callback_call(ec->frame, "unfullscreen_zoom", NULL);
6240 if (!e_client_util_ignored_get(ec))
6241 _e_client_frame_update(ec);
6242 ec->fullscreen_policy = 0;
6243 evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
6244 e_client_util_move_resize_without_frame(ec, zone->x + ec->saved.x,
6245 zone->y + ec->saved.y,
6246 ec->saved.w, ec->saved.h);
6248 if (ec->saved.maximized)
6249 e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
6250 ec->saved.maximized);
6252 e_client_layer_set(ec, ec->saved.layer);
6254 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
6256 if (!ec->desk->fullscreen_clients)
6257 e_comp_render_queue();
6261 ///////////////////////////////////////
6262 #ifdef REFACTOR_ZONE_DESK
6264 e_client_is_parent_iconify_by_client(E_Client *ec)
6267 _e_client_is_parent_iconify_by_client(E_Client *ec)
6270 E_Client *parent = ec->parent;
6271 if (!parent) return EINA_FALSE;
6273 if ((parent->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) ||
6274 (parent->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT))
6281 e_client_iconify(E_Client *ec)
6284 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6286 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6287 Eina_Bool iconified_by_client = e_client_is_iconified_by_client(ec);
6289 ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d",
6290 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6291 ec->exp_iconify.by_client, ec->exp_iconify.type);
6293 if (ec->shading || ec->iconic) return;
6294 if (ec->exp_iconify.skip_iconify && !iconified_by_client) return;
6295 if (ec->exp_iconify.skip_by_remote) return;
6296 if (!cdata || !cdata->mapped)
6298 if (!iconified_by_client)
6300 ELOGF("TZVIS", "Not mapped.. So, don't iconify", ec);
6305 ELOGF("TZVIS", "Not mapped.. But, iconify by user request", ec);
6309 TRACE_DS_BEGIN(CLIENT:ICONIFY);
6311 #ifdef REFACTOR_ZONE_DESK
6313 e_comp_wl_remote_surface_image_save(ec);
6316 ec->want_focus = ec->take_focus = 0;
6317 ec->changes.visible = 0;
6319 ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
6320 e_client_comp_hidden_set(ec, 1);
6321 evas_object_hide(ec->frame);
6322 e_client_urgent_set(ec, ec->icccm.urgent);
6324 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
6326 if (e_config->transient.iconify)
6329 Eina_List *list = eina_list_clone(ec->transients);
6331 EINA_LIST_FREE(list, child)
6333 if ((child->exp_iconify.type != E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) &&
6334 (_e_client_is_parent_iconify_by_client(child)))
6336 e_client_iconified_type_set(child, E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT);
6337 child->exp_iconify.by_client = 1;
6338 e_policy_client_iconic_state_change_send(child, 1);
6340 e_client_iconify(child);
6346 wl_signal_emit_mutable(&PRI(ec)->events.iconify, NULL);
6347 _e_client_hook_call(E_CLIENT_HOOK_ICONIFY, ec);
6353 e_client_uniconify(E_Client *ec)
6355 #ifdef REFACTOR_ZONE_DESK
6356 E_Comp_Wl_Client_Data *cdata;
6359 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6361 cdata = e_client_cdata_get(ec);
6363 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
6364 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6365 ec->exp_iconify.by_client, ec->exp_iconify.type,
6366 cdata ? cdata->mapped : 0);
6368 if (ec->shading || (!ec->iconic)) return;
6370 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
6372 // call the uniconify hook of a client
6373 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
6374 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
6379 Eina_Bool not_raise;
6382 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6384 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6386 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
6387 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
6388 ec->exp_iconify.by_client, ec->exp_iconify.type,
6389 cdata ? cdata->mapped : 0);
6391 if (ec->shading || (!ec->iconic)) return;
6393 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
6395 e_comp_wl_remote_surface_image_save_cancel(ec);
6397 desk = e_desk_current_get(ec->desk->zone);
6398 e_client_desk_set(ec, desk);
6399 not_raise = ec->exp_iconify.not_raise;
6401 ec->exp_iconify.by_client = 0;
6402 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
6404 if (e_config->transient.iconify)
6407 Eina_List *list = eina_list_clone(ec->transients);
6409 EINA_LIST_FREE(list, child)
6411 if (e_client_transient_policy_get(child) == E_TRANSIENT_BELOW)
6413 child->exp_iconify.not_raise = not_raise;
6414 e_client_uniconify(child);
6424 ELOGF("TZVIS", "UNICONIFY|internal object force show", ec);
6425 evas_object_show(ec->frame);
6430 if (e_pixmap_usable_get(ec->pixmap))
6432 if (cdata && cdata->mapped)
6434 ELOGF("TZVIS", "UNICONIFY|object show. frame_visible:%d", ec, evas_object_visible_get(ec->frame));
6435 evas_object_show(ec->frame);
6439 ELOGF("TZVIS", "UNICONIFY|object no show. currently unmapped", ec);
6444 if (!ec->exp_iconify.buffer_flush &&
6445 !ec->exp_iconify.deiconify_update)
6447 if (cdata && cdata->mapped)
6449 ELOGF("TZVIS", "UNICONIFY|object show. no use buffer flush. frame_visible:%d", ec, evas_object_visible_get(ec->frame));
6450 evas_object_show(ec->frame);
6455 e_client_comp_hidden_set(ec, 0);
6456 ec->deskshow = ec->iconic = 0;
6458 #if 0 // focus should be set to the top window not uniconify window
6459 if (ec->pixmap && e_pixmap_usable_get(ec->pixmap))
6460 e_client_frame_focus_set(ec, EINA_TRUE);
6463 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
6465 if (e_config->transient.iconify)
6468 Eina_List *list = eina_list_clone(ec->transients);
6470 EINA_LIST_FREE(list, child)
6472 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
6474 if (child->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
6475 e_policy_client_iconic_state_change_send(child, 0);
6476 child->exp_iconify.not_raise = not_raise;
6477 e_client_uniconify(child);
6482 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
6483 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
6485 ec->exp_iconify.not_raise = 0;
6492 e_client_iconified_type_set(E_Client *ec, E_Iconified_Type type)
6495 ec->exp_iconify.type = type;
6498 EINTERN E_Iconified_Type
6499 e_client_iconified_type_get(E_Client *ec)
6501 if (!ec) return E_ICONIFIED_TYPE_NONE;
6502 return ec->exp_iconify.type;
6505 E_API Eina_Bool e_client_is_iconified_by_client(E_Client *ec)
6507 if (!ec) return EINA_FALSE;
6509 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT)
6512 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_DESK_ICONIFY_BY_CLIENT)
6515 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
6518 if (ec->exp_iconify.by_client)
6520 ELOGF("POL", "CHECK. mismatch value. by_client:%d, type:%d", ec, ec->exp_iconify.by_client, ec->exp_iconify.type);
6527 ///////////////////////////////////////
6530 e_client_urgent_set(E_Client *ec, Eina_Bool urgent)
6533 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6536 if (urgent == ec->urgent) return;
6537 _e_client_event_property(ec, E_CLIENT_PROPERTY_URGENCY);
6538 if (urgent && (!ec->focused) && (!ec->want_focus))
6540 e_comp_object_signal_emit(ec->frame, "e,state,urgent", "e");
6541 ec->urgent = urgent;
6545 e_comp_object_signal_emit(ec->frame, "e,state,not_urgent", "e");
6550 ///////////////////////////////////////
6553 e_client_stick(E_Client *ec)
6555 #ifdef REFACTOR_ZONE_DESK
6557 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6558 if (ec->sticky) return;
6560 // call the stick hook of a client
6561 wl_signal_emit_mutable(&PRI(ec)->events.stick, NULL);
6562 _e_client_hook_call(E_CLIENT_HOOK_STICK, ec);
6564 // send the sticky property event of a client
6565 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6570 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6571 if (ec->sticky) return;
6576 e_client_desk_set(ec, desk);
6577 evas_object_smart_callback_call(ec->frame, "stick", NULL);
6579 if (e_config->transient.desktop)
6582 Eina_List *list = eina_list_clone(ec->transients);
6584 EINA_LIST_FREE(list, child)
6587 evas_object_show(ec->frame);
6591 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6596 e_client_unstick(E_Client *ec)
6598 #ifdef REFACTOR_ZONE_DESK
6600 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6602 if (!ec->sticky) return;
6604 // call the unstick hook of a client
6605 wl_signal_emit_mutable(&PRI(ec)->events.unstick, NULL);
6606 _e_client_hook_call(E_CLIENT_HOOK_UNSTICK, ec);
6608 // send the sticky property event of a client
6609 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6615 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6616 /* Set the desk before we unstick the client */
6617 if (!ec->sticky) return;
6619 zone = e_comp_zone_find_by_ec(ec);
6620 desk = e_desk_current_get(zone);
6622 ec->hidden = ec->sticky = 0;
6623 e_client_desk_set(ec, desk);
6624 evas_object_smart_callback_call(ec->frame, "unstick", NULL);
6626 if (e_config->transient.desktop)
6629 Eina_List *list = eina_list_clone(ec->transients);
6631 EINA_LIST_FREE(list, child)
6637 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
6639 e_client_desk_set(ec, e_desk_current_get(zone));
6644 e_client_pinned_set(E_Client *ec, Eina_Bool set)
6648 EINA_SAFETY_ON_NULL_RETURN(ec);
6650 layer = E_LAYER_CLIENT_ABOVE;
6652 layer = E_LAYER_CLIENT_NORMAL;
6654 e_client_layer_set(ec, layer);
6659 ///////////////////////////////////////
6662 e_client_border_set(E_Client *ec, const char *name)
6664 Eina_Stringshare *pborder;
6666 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6667 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6668 if (!e_comp_object_frame_allowed(ec->frame)) return EINA_FALSE;
6669 if (ec->border.changed)
6670 CRI("CALLING WHEN border.changed SET!");
6672 if (!e_util_strcmp(ec->border.name, name)) return EINA_TRUE;
6673 if (ec->mwm.borderless && name && strcmp(name, "borderless"))
6675 CRI("border change attempted for MWM borderless client!");
6677 pborder = ec->border.name;
6678 ec->border.name = eina_stringshare_add(name);
6679 if (e_comp_object_frame_theme_set(ec->frame, name))
6681 eina_stringshare_del(pborder);
6684 eina_stringshare_del(ec->border.name);
6685 ec->border.name = pborder;
6689 ///////////////////////////////////////
6692 e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
6695 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6698 if (ec->comp_hidden == hidden) return;
6699 ec->comp_hidden = hidden;
6700 evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
6703 ///////////////////////////////////////
6706 e_client_act_move_keyboard(E_Client *ec)
6708 EINA_SAFETY_ON_NULL_RETURN(ec);
6710 if (!_e_client_move_begin(ec))
6713 _e_client_action_init(ec);
6714 _e_client_action_move_timeout_add();
6716 wl_signal_emit_mutable(&PRI(ec)->events.move_update, NULL);
6717 if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
6718 evas_object_freeze_events_set(ec->frame, 1);
6720 if (!action_handler_mouse)
6721 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
6725 e_client_act_resize_keyboard(E_Client *ec)
6727 EINA_SAFETY_ON_NULL_RETURN(ec);
6729 ec->resize_mode = E_POINTER_RESIZE_TL;
6730 ec->keyboard_resizing = 1;
6731 if (!e_client_resize_begin(ec))
6733 ec->keyboard_resizing = 0;
6737 _e_client_action_init(ec);
6738 _e_client_action_resize_timeout_add();
6739 evas_object_freeze_events_set(ec->frame, 1);
6741 if (!action_handler_mouse)
6742 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
6746 e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
6749 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6750 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6755 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
6756 _e_client_moveinfo_gather(ec, source);
6758 if (!_e_client_move_begin(ec))
6761 _e_client_action_init(ec);
6765 e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
6768 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6769 if (!ec->moving) return;
6770 _e_client_move_end(ec);
6771 _e_client_action_finish();
6775 e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, E_Pointer_Mode resize_mode)
6778 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6779 if (ec->lock_user_size || ec->shaded || ec->shading) return;
6780 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
6784 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
6785 _e_client_moveinfo_gather(ec, source);
6787 if (resize_mode != E_POINTER_RESIZE_NONE)
6789 ec->resize_mode = resize_mode;
6793 /* Use canvas.x, canvas.y of event.
6794 * Transformed coordinates has to be considered for accurate resize_mode
6795 * rather than absolute coordinates. */
6796 if ((ev->canvas.x > (ec->x + ec->w / 5)) &&
6797 (ev->canvas.x < (ec->x + ec->w * 4 / 5)))
6799 if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_T;
6800 else ec->resize_mode = E_POINTER_RESIZE_B;
6802 else if (ev->canvas.x < (ec->x + ec->w / 2))
6804 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;
6805 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TL;
6806 else ec->resize_mode = E_POINTER_RESIZE_BL;
6810 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;
6811 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TR;
6812 else ec->resize_mode = E_POINTER_RESIZE_BR;
6816 if (!e_client_resize_begin(ec))
6818 _e_client_action_init(ec);
6822 e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
6825 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6826 if (e_client_util_resizing_get(ec))
6828 _e_client_resize_end(ec);
6829 ec->changes.reset_gravity = 1;
6830 if (!e_object_is_del(E_OBJECT(ec)))
6833 _e_client_action_finish();
6837 e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
6840 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6844 e_client_act_close_begin(E_Client *ec)
6847 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6848 if (ec->lock_close) return;
6849 if (ec->icccm.delete_request)
6851 ec->delete_requested = 1;
6852 evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
6854 else if (e_config->kill_if_close_not_possible)
6856 e_client_act_kill_begin(ec);
6861 e_client_act_kill_begin(E_Client *ec)
6864 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6865 if (ec->internal) return;
6866 if (ec->lock_close) return;
6867 if ((ec->netwm.pid > 1) && (e_config->kill_process))
6869 kill(ec->netwm.pid, SIGINT);
6870 ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
6871 _e_client_cb_kill_timer, ec);
6874 evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
6877 ////////////////////////////////////////////
6880 e_client_ping(E_Client *ec)
6883 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6885 if (!e_config->ping_clients) return;
6887 EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
6890 evas_object_smart_callback_call(ec->frame, "ping", NULL);
6891 ec->ping = ecore_loop_time_get();
6892 if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
6893 ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
6894 e_config->ping_clients_interval,
6895 _e_client_cb_ping_poller, ec);
6898 ////////////////////////////////////////////
6900 e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y)
6902 // TODO: remove(deprecate) this e_client_cursor_map_apply.
6906 e_client_move_cancel(void)
6908 if (!ecmove) return;
6909 if (ecmove->cur_mouse_action)
6914 e_object_ref(E_OBJECT(ec));
6915 if (ec->cur_mouse_action->func.end_mouse)
6916 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
6917 else if (ec->cur_mouse_action->func.end)
6918 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
6919 e_object_unref(E_OBJECT(ec->cur_mouse_action));
6920 ec->cur_mouse_action = NULL;
6921 e_object_unref(E_OBJECT(ec));
6924 _e_client_move_end(ecmove);
6928 e_client_resize_cancel(void)
6930 if (!ecresize) return;
6931 if (ecresize->cur_mouse_action)
6936 e_object_ref(E_OBJECT(ec));
6937 if (ec->cur_mouse_action->func.end_mouse)
6938 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
6939 else if (ec->cur_mouse_action->func.end)
6940 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
6941 e_object_unref(E_OBJECT(ec->cur_mouse_action));
6942 ec->cur_mouse_action = NULL;
6943 e_object_unref(E_OBJECT(ec));
6946 _e_client_resize_end(ecresize);
6950 e_client_resize_begin(E_Client *ec)
6952 if ((ec->shaded) || (ec->shading) ||
6953 (ec->fullscreen) || (ec->lock_user_size))
6955 if (!_e_client_action_input_win_new()) goto error;
6957 if (ec->manage_resize.enable_aspect_ratio)
6959 ELOGF("RESIZE", "Set resize aspect ratio.. ratio(%dx%d)", ec, ec->w, ec->h);
6960 ec->manage_resize.aw = ec->w;
6961 ec->manage_resize.ah = ec->h - ec->manage_resize.header_h - ec->manage_resize.footer_h;
6964 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
6965 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
6966 if (ec->transformed)
6967 _e_client_transform_resize_begin(ec);
6968 if (!e_client_util_resizing_get(ec))
6970 if (ecresize == ec) ecresize = NULL;
6971 _e_client_action_input_win_del();
6974 if (!ec->lock_user_stacking)
6976 if (e_config->border_raise_on_mouse_action)
6981 e_comp_client_override_add(ec);
6985 ec->resize_mode = E_POINTER_RESIZE_NONE;
6990 ////////////////////////////////////////////
6993 e_client_frame_recalc(E_Client *ec)
6995 EINA_SAFETY_ON_NULL_RETURN(ec);
6996 if (!ec->frame) return;
6997 evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
7000 ////////////////////////////////////////////
7003 e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
7006 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7008 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
7009 _e_client_moveinfo_gather(ec, sig);
7010 if (!_e_client_move_begin(ec)) return;
7014 e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
7017 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7018 if (!ec->moving) return;
7019 _e_client_move_end(ec);
7023 e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
7025 int resize_mode = E_POINTER_RESIZE_BR;
7028 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7030 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
7031 if (!strcmp(dir, "tl"))
7033 resize_mode = E_POINTER_RESIZE_TL;
7035 else if (!strcmp(dir, "t"))
7037 resize_mode = E_POINTER_RESIZE_T;
7039 else if (!strcmp(dir, "tr"))
7041 resize_mode = E_POINTER_RESIZE_TR;
7043 else if (!strcmp(dir, "r"))
7045 resize_mode = E_POINTER_RESIZE_R;
7047 else if (!strcmp(dir, "br"))
7049 resize_mode = E_POINTER_RESIZE_BR;
7051 else if (!strcmp(dir, "b"))
7053 resize_mode = E_POINTER_RESIZE_B;
7055 else if (!strcmp(dir, "bl"))
7057 resize_mode = E_POINTER_RESIZE_BL;
7059 else if (!strcmp(dir, "l"))
7061 resize_mode = E_POINTER_RESIZE_L;
7063 ec->resize_mode = resize_mode;
7064 _e_client_moveinfo_gather(ec, sig);
7065 if (!e_client_resize_begin(ec))
7070 e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
7073 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7074 if (!e_client_util_resizing_get(ec)) return;
7075 _e_client_resize_handle(ec);
7076 _e_client_resize_end(ec);
7077 ec->changes.reset_gravity = 1;
7081 ////////////////////////////////////////////
7084 e_client_resize_limit(E_Client *ec, int *w, int *h)
7090 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
7092 inc_h = (*h - ec->h > 0);
7094 e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
7097 if ((ec->icccm.base_w >= 0) &&
7098 (ec->icccm.base_h >= 0))
7102 tw = *w - ec->icccm.base_w;
7103 th = *h - ec->icccm.base_h;
7106 a = (double)(tw) / (double)(th);
7107 if ((ec->icccm.min_aspect != 0.0) &&
7108 (a < ec->icccm.min_aspect))
7111 tw = th * ec->icccm.min_aspect;
7113 th = tw / ec->icccm.max_aspect;
7114 *w = tw + ec->icccm.base_w;
7115 *h = th + ec->icccm.base_h;
7117 else if ((ec->icccm.max_aspect != 0.0) &&
7118 (a > ec->icccm.max_aspect))
7120 tw = th * ec->icccm.max_aspect;
7121 *w = tw + ec->icccm.base_w;
7126 a = (double)*w / (double)*h;
7127 if ((ec->icccm.min_aspect != 0.0) &&
7128 (a < ec->icccm.min_aspect))
7131 *w = *h * ec->icccm.min_aspect;
7133 *h = *w / ec->icccm.min_aspect;
7135 else if ((ec->icccm.max_aspect != 0.0) &&
7136 (a > ec->icccm.max_aspect))
7137 *w = *h * ec->icccm.max_aspect;
7139 if (ec->icccm.step_w > 0)
7141 if (ec->icccm.base_w >= 0)
7142 *w = ec->icccm.base_w +
7143 (((*w - ec->icccm.base_w) / ec->icccm.step_w) *
7146 *w = ec->icccm.min_w +
7147 (((*w - ec->icccm.min_w) / ec->icccm.step_w) *
7150 if (ec->icccm.step_h > 0)
7152 if (ec->icccm.base_h >= 0)
7153 *h = ec->icccm.base_h +
7154 (((*h - ec->icccm.base_h) / ec->icccm.step_h) *
7157 *h = ec->icccm.min_h +
7158 (((*h - ec->icccm.min_h) / ec->icccm.step_h) *
7165 if ((ec->icccm.max_w > 0) && (*w > ec->icccm.max_w)) *w = ec->icccm.max_w;
7166 else if (*w < ec->icccm.min_w)
7167 *w = ec->icccm.min_w;
7168 if ((ec->icccm.max_h > 0) && (*h > ec->icccm.max_h)) *h = ec->icccm.max_h;
7169 else if (*h < ec->icccm.min_h)
7170 *h = ec->icccm.min_h;
7173 e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
7176 ////////////////////////////////////////////
7181 e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
7185 /* We need to ensure that we can get the comp window for the
7186 * zone of either the given desk or the desk of the excluded
7187 * window, so return if neither is given */
7189 e_input_device_pointer_xy_get(NULL, &x, &y);
7191 e_input_device_pointer_xy_get(NULL, &x, &y);
7197 desk = exclude->desk;
7201 desk = e_desk_current_get(exclude->zone);
7203 desk = e_desk_current_get(e_zone_current_get());
7207 return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
7210 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
7212 if (!desk) return NULL;
7214 return _e_client_under_pointer_helper(desk, exclude, x, y);
7217 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
7219 if (!desk) return NULL;
7221 return _e_client_under_pointer_input_helper(desk, x, y);
7225 e_client_input_rect_under_pointer_get(E_Desk *desk, E_Client *exclude)
7229 /* We need to ensure that we can get the comp window for the
7230 * zone of either the given desk or the desk of the excluded
7231 * window, so return if neither is given */
7233 e_input_device_pointer_xy_get(NULL, &x, &y);
7235 e_input_device_pointer_xy_get(NULL, &x, &y);
7241 desk = exclude->desk;
7245 desk = e_desk_current_get(exclude->zone);
7247 desk = e_desk_current_get(e_zone_current_get());
7251 return desk ? _e_client_input_rect_under_pointer_helper(desk, exclude, x, y) : NULL;
7254 ////////////////////////////////////////////
7256 ////////////////////////////////////////////
7259 e_client_redirected_set(E_Client *ec, Eina_Bool set)
7261 EINA_SAFETY_ON_NULL_RETURN(ec);
7262 if (ec->input_only) return;
7264 if (ec->redirected == set) return;
7267 e_client_frame_recalc(ec);
7269 wl_signal_emit_mutable(&PRI(ec)->events.redirect, NULL);
7270 if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
7274 wl_signal_emit_mutable(&PRI(ec)->events.unredirect, NULL);
7275 if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
7277 e_comp_object_redirected_set(ec->frame, set);
7278 ec->redirected = !!set;
7281 ////////////////////////////////////////////
7284 e_client_is_stacking(const E_Client *ec)
7286 return e_comp->layers[e_comp_canvas_layer_map(ec->layer)].obj == ec->frame;
7289 ////////////////////////////////////////////
7292 e_client_transform_update(E_Client *ec)
7294 if (e_client_util_resizing_get(ec))
7295 _e_client_transform_resize(ec);
7298 ////////////////////////////////////////////
7301 e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy)
7304 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
7308 if (e_comp_wl_subsurface_check(ec))
7311 /* check if it's different with current state */
7312 if ((ec->transform.angle == angle) &&
7313 (ec->transform.zoom == zoom) &&
7314 (ec->transform.center.x == cx) &&
7315 (ec->transform.center.y == cy))
7318 /* use previous value if any required value is invalid */
7320 angle = ec->transform.angle;
7322 zoom = ec->transform.zoom;
7323 if (!E_INSIDE(cx, cy,
7324 ec->client.x, ec->client.y,
7325 ec->client.w, ec->client.h))
7327 cx = ec->transform.center.x;
7328 cy = ec->transform.center.y;
7331 if ((angle == 0) && (zoom == 1.0))
7333 e_client_transform_clear(ec);
7337 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
7338 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
7340 e_map_util_rotate(map, angle, cx, cy);
7341 _e_client_transform_geometry_save(ec, map);
7343 e_map_util_zoom(map, zoom, zoom, cx, cy);
7345 e_map_util_object_move_sync_set(map, EINA_TRUE);
7346 e_client_map_set(ec, map);
7347 e_client_map_enable_set(ec, EINA_TRUE);
7349 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
7350 _e_client_transform_sub_apply(subc, ec, zoom);
7351 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
7352 _e_client_transform_sub_apply(subc, ec, zoom);
7356 ec->transform.zoom = zoom;
7357 ec->transform.angle = angle;
7358 ec->transform.center.x = cx;
7359 ec->transform.center.y = cy;
7360 ec->transformed = EINA_TRUE;
7363 ////////////////////////////////////////////
7366 e_client_transform_clear(E_Client *ec)
7368 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
7372 e_client_map_enable_set(ec, EINA_FALSE);
7373 e_client_map_set(ec, NULL);
7375 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
7376 _e_client_transform_sub_apply(subc, ec, 1.0);
7377 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
7378 _e_client_transform_sub_apply(subc, ec, 1.0);
7380 ec->transform.zoom = 1.0;
7381 ec->transform.angle = 0.0;
7382 ec->transformed = EINA_FALSE;
7386 e_client_transform_core_enable_get(E_Client *ec)
7388 if (!ec) return EINA_FALSE;
7389 return ec->transform_core.result.enable;
7393 e_client_transform_core_add(E_Client *ec, E_Util_Transform *transform)
7396 if (!transform) return;
7398 // duplication check
7399 if (ec->transform_core.transform_list &&
7400 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
7405 ec->transform_core.transform_list = eina_list_append(ec->transform_core.transform_list, transform);
7406 ec->transform_core.changed = EINA_TRUE;
7407 e_util_transform_ref(transform);
7408 // e_client_transform_core_update(ec);
7412 e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform)
7415 if (!transform) return;
7417 if (ec->transform_core.transform_list &&
7418 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
7420 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
7421 e_util_transform_unref(transform);
7422 ec->transform_core.changed = EINA_TRUE;
7425 e_client_transform_core_update(ec);
7429 e_client_transform_core_update(E_Client *ec)
7432 if (ec->new_client) return;
7433 if (!_e_client_transform_core_check_change(ec)) return;
7435 if (ec->transform_core.transform_list || ec->transform_core.parent.enable)
7437 E_Util_Transform_Rect source_rect;
7438 E_Util_Transform_Matrix matrix, boundary_matrix;
7439 E_Util_Transform_Zoom zoom;
7441 Eina_Bool background;
7442 E_Util_Transform *temp_trans;
7445 ec->transform_core.result.enable = EINA_TRUE;
7446 e_util_transform_rect_client_rect_get(&source_rect, ec);
7447 e_util_transform_init(&ec->transform_core.result.transform);
7449 // 2. merge transform
7450 EINA_LIST_FOREACH(ec->transform_core.transform_list, l, temp_trans)
7452 e_util_transform_merge(&ec->transform_core.result.transform, temp_trans);
7454 zoom = ec->transform_core.result.transform.zoom;
7456 // 2.5 check viewport
7457 if (e_util_transform_viewport_flag_get(&ec->transform_core.result.transform))
7459 int vx = 0, vy = 0, vw = 0, vh = 0;
7460 e_util_transform_viewport_get(&ec->transform_core.result.transform, &vx, &vy, &vw, &vh);
7461 e_util_transform_rect_init(&source_rect, vx, vy, vw, vh);
7464 // 3. apply background transform
7465 matrix = e_util_transform_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
7467 if (e_util_transform_bg_transform_flag_get(&ec->transform_core.result.transform))
7469 boundary_matrix = e_util_transform_bg_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
7470 background = EINA_TRUE;
7474 background = EINA_FALSE;
7475 boundary_matrix = matrix;
7478 if (background != ec->transform_core.background)
7482 e_comp_object_transform_bg_set(ec->frame, EINA_TRUE);
7486 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
7489 ec->transform_core.background = background;
7492 // 3.1 if 24bit window then set transp rect
7497 e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle);
7500 if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect
7501 e_comp_object_transform_transp_set(ec->frame, EINA_TRUE);
7503 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7506 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7508 // 3.5 parent matrix multiply
7509 if (ec->transform_core.parent.enable)
7511 matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
7513 boundary_matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
7516 ec->transform_core.result.transform.use_zoom = EINA_TRUE;
7517 zoom.zoom_x *= ec->transform_core.parent.zoom.zoom_x;
7518 zoom.zoom_y *= ec->transform_core.parent.zoom.zoom_y;
7519 zoom.cx += ec->transform_core.parent.zoom.cx;
7520 zoom.cy += ec->transform_core.parent.zoom.cy;
7523 // 4. apply matrix to vertices
7524 ec->transform_core.result.matrix = matrix;
7525 ec->transform_core.result.inv_matrix = e_util_transform_matrix_inverse_get(&matrix);
7526 ec->transform_core.result.vertices = e_util_transform_rect_to_vertices(&source_rect);
7527 ec->transform_core.result.boundary.vertices = e_util_transform_rect_to_vertices(&source_rect);
7528 ec->transform_core.result.vertices = e_util_transform_matrix_multiply_rect_vertex(&matrix,
7529 &ec->transform_core.result.vertices);
7530 ec->transform_core.result.boundary.vertices = e_util_transform_matrix_multiply_rect_vertex(&boundary_matrix,
7531 &ec->transform_core.result.boundary.vertices);
7532 ec->transform_core.result.transform.zoom = zoom;
7534 // 5. apply vertices
7535 if (ec->transform_core.result.transform.use_zoom)
7537 // TODO: apply zoom values to vertices
7538 e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices,
7539 ec->transform_core.result.transform.zoom);
7540 e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices,
7541 ec->transform_core.result.transform.zoom);
7542 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
7543 _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform,
7544 ec->transform_core.result.transform.zoom);
7548 e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices);
7549 e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices);
7550 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
7551 _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform);
7554 // 6. subsurface update
7555 _e_client_transform_core_sub_update(ec, &ec->transform_core.result.vertices);
7557 if (!e_object_is_del(E_OBJECT(ec)))
7559 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
7560 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
7565 if (ec->transform_core.result.enable)
7567 ec->transform_core.result.enable = EINA_FALSE;
7568 _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL);
7569 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
7570 ec->transform_core.background = EINA_FALSE;
7571 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
7572 _e_client_transform_core_sub_update(ec, NULL);
7574 if (!e_object_is_del(E_OBJECT(ec)))
7576 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
7577 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
7582 e_comp_visibility_calculation_set(EINA_TRUE);
7586 e_client_transform_core_transform_count_get(E_Client *ec)
7589 if (!ec->transform_core.transform_list) return 0;
7590 return eina_list_count(ec->transform_core.transform_list);
7593 E_API E_Util_Transform*
7594 e_client_transform_core_transform_get(E_Client *ec, int index)
7596 if (!ec) return NULL;
7597 if (!ec->transform_core.transform_list) return NULL;
7598 if (index < 0 || index >= e_client_transform_core_transform_count_get(ec))
7601 return (E_Util_Transform*)eina_list_nth(ec->transform_core.transform_list, index);
7605 e_client_transform_core_input_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7607 E_Util_Transform_Vertex vertex, result_vertex;
7610 if (!e_client_transform_core_enable_get(ec)) return;
7612 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
7614 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.inv_matrix, &vertex);
7615 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
7619 e_client_transform_core_input_inv_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7621 E_Util_Transform_Vertex vertex, result_vertex;
7624 if (!e_client_transform_core_enable_get(ec)) return;
7626 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
7628 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.matrix, &vertex);
7629 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
7633 e_client_transform_core_input_inv_rect_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
7637 if (!e_client_transform_core_enable_get(ec)) return;
7638 e_client_geometry_get(ec, NULL, NULL, &gw, &gh);
7640 e_util_transform_matrix_inv_rect_coords_get(&ec->transform_core.result.transform,
7641 &ec->transform_core.result.vertices,
7643 x, y, out_x, out_y);
7647 e_client_transform_core_direct_render_set(E_Client *ec, Eina_Bool set)
7649 EINA_SAFETY_ON_NULL_RETURN(ec);
7651 if (ec->transform_core.direct_render == set) return;
7653 ec->transform_core.direct_render = set;
7654 ec->transform_core.changed = EINA_TRUE;
7656 e_client_transform_core_update(ec);
7660 e_client_pixmap_change(E_Client *ec, E_Pixmap *newcp)
7662 E_Pixmap_Type oldtype, newtype;
7665 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
7666 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->pixmap, NULL);
7667 EINA_SAFETY_ON_NULL_RETURN_VAL(newcp, NULL);
7671 oldtype = e_pixmap_type_get(oldcp);
7672 if (oldtype >= E_PIXMAP_TYPE_MAX) return NULL;
7674 newtype = e_pixmap_type_get(newcp);
7675 if (newtype >= E_PIXMAP_TYPE_MAX) return NULL;
7677 if (eina_hash_find(clients_hash[oldtype], &oldcp))
7678 eina_hash_del_by_key(clients_hash[oldtype], &oldcp);
7679 e_pixmap_client_set(oldcp, NULL);
7682 e_pixmap_client_set(newcp, ec);
7684 eina_hash_add(clients_hash[newtype], &newcp, ec);
7690 e_client_window_role_set(E_Client *ec, const char *role)
7692 EINA_SAFETY_ON_NULL_RETURN(ec);
7694 if (eina_stringshare_replace(&ec->icccm.window_role, role))
7696 wl_signal_emit_mutable(&PRI(ec)->events.window_role_change, NULL);
7697 _e_client_hook_call(E_CLIENT_HOOK_WINDOW_ROLE_CHANGE, ec);
7702 e_client_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
7706 res = e_comp_wl_key_send(ec, keycode, pressed, dev, time);
7712 e_client_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, unsigned int time)
7716 res = e_comp_wl_key_cancel(ec, keycode, dev, time);
7722 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)
7726 res = e_comp_wl_touch_send(ec, idx, x, y, pressed, dev, radius_x, radius_y, pressure, angle, time);
7732 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)
7736 res = e_comp_wl_touch_update_send(ec, idx, x, y, dev, radius_x, radius_y, pressure, angle, time);
7742 e_client_touch_cancel_send(E_Client *ec)
7746 res = e_comp_wl_touch_cancel_send(ec);
7752 e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
7756 res = e_comp_wl_mouse_button_send(ec, buttons, pressed, dev, time);
7762 e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
7766 res = e_comp_wl_mouse_move_send(ec, x, y, dev, time);
7772 e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time)
7776 res = e_comp_wl_mouse_wheel_send(ec, direction, z, dev, time);
7782 e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
7786 res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
7792 e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
7796 res = e_comp_wl_mouse_out_send(ec, dev, time);
7802 e_client_video_client_has(E_Client *ec)
7804 return e_comp_wl_video_subsurface_has(ec);
7808 e_client_normal_client_has(E_Client *ec)
7810 return e_comp_wl_normal_subsurface_has(ec);
7814 e_client_cursor_hide(E_Client *ec)
7816 return e_comp_wl_cursor_hide(ec);
7820 e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
7824 ELOGF("TZVIS", "VIS_FORCE_OBSCURED :%d", ec, set);
7826 ec->visibility.force_obscured = set;
7827 e_comp_visibility_calculation_set(EINA_TRUE);
7830 EINTERN E_Capture_Save_State
7831 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)
7833 return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
7837 _e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *subc)
7839 E_Client *ec, *parent;
7845 ec->base_output_resolution.use = 0;
7846 ec->base_output_resolution.w = 0;
7847 ec->base_output_resolution.h = 0;
7848 if (ec->base_output_resolution.transform)
7850 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
7851 E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
7852 ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
7855 /* Update transform for toplevel surface.
7856 * The transform of subsurface will be updated by its parent accordingly. */
7857 parent = e_comp_wl_topmost_parent_get(ec);
7860 parent->transform_core.changed = EINA_TRUE;
7861 e_client_transform_core_update(parent);
7864 /* TODO: Do we need to apply it again if subsurface is destroyed? */
7868 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
7871 ec->base_output_resolution.use = 1;
7872 ec->base_output_resolution.w = width;
7873 ec->base_output_resolution.h = height;
7874 ec->base_output_resolution.transform = e_util_transform_new();
7875 e_util_transform_role_set(ec->base_output_resolution.transform, "base_output_resolution");
7876 e_client_transform_core_add(ec, ec->base_output_resolution.transform);
7878 if (!ec->base_output_resolution.hook_subsurf_create)
7880 ec->base_output_resolution.hook_subsurf_create =
7881 e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
7882 _e_client_base_output_resolution_hook_subsurf_create,
7888 e_client_base_output_resolution_transform_adjust(E_Client *ec)
7892 EINA_SAFETY_ON_NULL_RETURN(ec);
7893 if (!ec->base_output_resolution.use) return;
7894 if (!ec->base_output_resolution.transform) return;
7896 desk = e_comp_desk_find_by_ec(ec);
7897 EINA_SAFETY_ON_NULL_RETURN(desk);
7899 ELOGF("POL_APPINFO", "Apply TRANSFORM... desk:(%dx%d), ec:(%dx%d)",
7900 ec, desk->geom.w, desk->geom.h, ec->w, ec->h);
7902 e_util_transform_scale(ec->base_output_resolution.transform,
7903 (double)desk->geom.w /(double)ec->base_output_resolution.w,
7904 (double)desk->geom.h /(double)ec->base_output_resolution.h,
7906 e_client_transform_core_update(ec);
7910 e_client_base_output_resolution_update(E_Client *ec)
7912 E_Appinfo *eai = NULL;
7913 int configured_width, configured_height;
7917 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
7919 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
7920 if (ec->base_output_resolution.use) return EINA_TRUE;
7922 /* Check whether it's subsurface or not
7923 * The resolution of subsurface will follow the resolution of its toplevel surface.
7924 * Transform for subsurface will be applied when toplevel surface does by
7925 * implementation of e_client_transform_core.
7927 if (e_comp_wl_subsurface_check(ec))
7930 desk = e_comp_desk_find_by_ec(ec);
7931 EINA_SAFETY_ON_NULL_RETURN_VAL(desk, EINA_FALSE);
7933 configured_width = e_config->configured_output_resolution.w;
7934 configured_height = e_config->configured_output_resolution.h;
7938 ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec,
7939 configured_width, configured_height, ec->netwm.pid);
7940 goto use_configured;
7943 eai = e_appinfo_find_with_pid(ec->netwm.pid);
7946 ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec,
7947 configured_width, configured_height, ec->netwm.pid);
7948 goto use_configured;
7951 if (!e_appinfo_base_output_resolution_get(eai, &width, &height))
7953 ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec,
7954 configured_width, configured_height, ec->netwm.pid);
7955 goto use_configured;
7958 if ((width == 0) && (height == 0))
7960 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution size:(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
7964 if ((desk->geom.w == width) && (desk->geom.h == height))
7966 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);
7970 /* set the base_output_resolution of the e_client */
7971 _e_client_base_output_resolution_set(ec, width, height);
7973 ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
7979 if ((desk->geom.w == configured_width) && (desk->geom.h == configured_height))
7981 ELOGF("POL_APPINFO", "SKIP use configured_output_resolution (same with desk size:(%d,%d), pid:%d)", ec, configured_width, configured_height, ec->netwm.pid);
7985 /* set the base_output_resolution of the e_client as a default */
7986 _e_client_base_output_resolution_set(ec, configured_width, configured_height);
7993 e_client_base_output_resolution_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
7998 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8000 zone = e_comp_zone_find_by_ec(ec);
8001 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
8003 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
8010 if (ec->base_output_resolution.use)
8012 if (w) *w = ec->base_output_resolution.w;
8013 if (h) *h = ec->base_output_resolution.h;
8020 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)
8025 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8027 zone = e_comp_zone_find_by_ec(ec);
8028 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
8030 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, consider_obstacle_area);
8037 if (ec->base_output_resolution.use)
8039 // TODO: Consider obstacle area
8040 if (w) *w = ec->base_output_resolution.w;
8041 if (h) *h = ec->base_output_resolution.h;
8047 /* change the base_output_resolution of the bind_ec by checking the base_output_resolution of provider_ec's appinfo */
8049 e_client_base_output_resolution_rsm_update(E_Client *bind_ec, E_Client *provider_ec)
8051 E_Appinfo *epai = NULL;
8052 int configured_width, configured_height;
8054 E_Desk *bind_ec_desk;
8056 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec, EINA_FALSE);
8057 EINA_SAFETY_ON_NULL_RETURN_VAL(provider_ec, EINA_FALSE);
8059 bind_ec_desk = e_comp_desk_find_by_ec(bind_ec);
8060 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec_desk, EINA_FALSE);
8062 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
8064 configured_width = e_config->configured_output_resolution.w;
8065 configured_height = e_config->configured_output_resolution.h;
8067 if (bind_ec->base_output_resolution.use)
8069 ELOGF("POL_APPINFO", "DELETE EXISTED BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
8070 bind_ec->base_output_resolution.w, bind_ec->base_output_resolution.h, bind_ec->netwm.pid);
8072 bind_ec->base_output_resolution.use = 0;
8073 bind_ec->base_output_resolution.w = 0;
8074 bind_ec->base_output_resolution.h = 0;
8075 e_client_transform_core_remove(bind_ec, bind_ec->base_output_resolution.transform);
8076 E_FREE_FUNC(bind_ec->base_output_resolution.transform, e_util_transform_del);
8079 if (!provider_ec->netwm.pid)
8081 ELOGF("POL_APPINFO", "NO PROVIDER PID... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8082 configured_width, configured_height, provider_ec->netwm.pid);
8083 goto use_configured;
8086 epai = e_appinfo_find_with_pid(provider_ec->netwm.pid);
8089 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8090 configured_width, configured_height, provider_ec->netwm.pid);
8091 goto use_configured;
8094 if (!e_appinfo_base_output_resolution_get(epai, &width, &height))
8096 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
8097 configured_width, configured_height, provider_ec->netwm.pid);
8098 goto use_configured;
8101 if ((width == 0) && (height == 0))
8103 ELOGF("POL_APPINFO", "NO PROVIDER WIDTH and HEIGHT... SKIP base_output_resolution due to size:(%d,%d) provider_pid:%d", provider_ec,
8104 width, height, provider_ec->netwm.pid);
8108 if ((bind_ec_desk->geom.w == width) && (bind_ec_desk->geom.h == height))
8110 ELOGF("POL_APPINFO", "SKIP SET BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
8111 width, height, bind_ec->netwm.pid);
8115 /* set the base_output_resolution of the e_client */
8116 _e_client_base_output_resolution_set(bind_ec, width, height);
8117 e_client_base_output_resolution_transform_adjust(bind_ec);
8119 ELOGF("POL_APPINFO", "USE BINDER base_output_resolution(%d,%d) bind_pid:%d", bind_ec, width, height, bind_ec->netwm.pid);
8125 if ((bind_ec_desk->geom.w == configured_width) && (bind_ec_desk->geom.h == configured_height))
8127 ELOGF("POL_APPINFO", "SKIP BINDER use configured_output_resolution (same with desk size:(%d,%d), bind_pid:%d)", bind_ec,
8128 configured_width, configured_height, bind_ec->netwm.pid);
8132 /* set the base_output_resolution of the e_client as a default */
8133 _e_client_base_output_resolution_set(bind_ec, configured_width, configured_height);
8139 /* tizen_move_resize */
8141 e_client_pending_geometry_has(E_Client *ec)
8143 if (!eina_list_count(ec->surface_sync.pending_geometry))
8146 return ec->surface_sync.wait_commit;
8150 e_client_pending_geometry_flush(E_Client *ec)
8152 E_Client_Pending_Geometry *geo;
8154 if (!eina_list_count(ec->surface_sync.pending_geometry))
8156 EINA_LIST_FREE(ec->surface_sync.pending_geometry, geo)
8160 ec->surface_sync.wait_commit = EINA_FALSE;
8161 ELOGF("POSSIZE", "pending geometry has flushed", ec);
8166 e_client_pending_geometry_last_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
8169 E_Client_Pending_Geometry *geo;
8175 EINA_LIST_REVERSE_FOREACH(ec->surface_sync.pending_geometry, l, geo)
8191 e_client_frame_focus_set(E_Client *ec, Eina_Bool focus)
8194 evas_object_focus_set(ec->frame, focus);
8198 e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h)
8202 if (ec->internal || ec->input_only)
8204 evas_object_geometry_set(ec->frame, x, y, w, h);
8208 if ((ec->w != w) || (ec->h != h))
8210 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);
8211 ec->move_after_resize = EINA_TRUE;
8213 e_client_pos_set(ec, x, y);
8214 evas_object_resize(ec->frame, w, h);
8217 evas_object_geometry_set(ec->frame, x, y, w, h);
8222 e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
8226 if (ec->internal || ec->input_only)
8228 e_client_util_move_without_frame(ec, x, y);
8229 e_client_util_resize_without_frame(ec, w, h);
8233 if ((ec->w != w) || (ec->h != h))
8235 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);
8236 ec->move_after_resize = EINA_TRUE;
8238 e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
8239 e_client_pos_set(ec, x, y);
8240 e_client_util_resize_without_frame(ec, w, h);
8244 e_client_util_move_without_frame(ec, x, y);
8245 e_client_util_resize_without_frame(ec, w, h);
8251 e_client_layer_set(E_Client *ec,
8254 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8255 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8256 if (!ec->frame) return EINA_FALSE;
8258 if (e_comp_canvas_client_layer_map(layer) == 9999)
8259 return EINA_FALSE; //invalid layer is not allowed
8261 if (ec->desk_area.enable)
8263 if (e_client_layer_set_by_desk_area(ec, layer))
8265 // restack according to desk group rule
8266 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
8270 ec->desk_area.layer_backup = layer;
8272 evas_object_layer_set(ec->frame, layer);
8273 if (ec->layer != layer)
8275 /* check exceptional case */
8276 if ((ec->fullscreen) &&
8277 (ec->saved.layer != layer))
8279 ELOGF("LAYER", "(%d) fail to backup at saved.layer for fullscreen", ec, layer);
8282 // if e_comp_object fail to change ec->layer due to ec->layer_pending or block
8283 // leave log and apply ec->layer according to set
8284 // as a result it restores back to given layer when pending or block is free
8285 ELOGF("LAYER", "change layer from %d to %d if in case layer pending(%d) or block(%d)",
8286 ec, ec->layer, layer, ec->layer_pending, ec->layer_block);
8287 if (ec->layer_pending || ec->layer_block)
8294 wl_signal_emit_mutable(&PRI(ec)->events.layer_set, NULL);
8300 e_client_layer_get(E_Client *ec)
8304 E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM);
8305 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM);
8306 if (!ec->frame) return E_LAYER_BOTTOM;
8308 layer = evas_object_layer_get(ec->frame);
8309 if (ec->layer != layer)
8311 /* client could be on temperory layer while pending or block,
8312 * in that case, client restores back to ec->layer after pending/block finish */
8313 if (ec->layer_block || ec->layer_pending)
8316 /* otherwise, client is on unexpected layer */
8317 ELOGF("LAYER", "layer dismatch ec->layer %d | evas obj layer %d ",
8318 ec, ec->layer, layer);
8320 if (e_comp_canvas_client_layer_map(layer) == 9999)
8321 return E_LAYER_BOTTOM; //not on E_LAYER_CLIENT
8328 _e_client_desk_area_original_layer_save(E_Client *ec, E_Layer layer)
8331 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
8332 ec->desk_area.layer_backup = layer;
8336 e_client_layer_set_by_desk_area(E_Client *ec, E_Layer layer)
8342 if (!ec) return EINA_FALSE;
8343 if (!ec->frame) return EINA_FALSE;
8344 if (!ec->desk_area.enable) return EINA_FALSE;
8345 if (!ec->desk_area.desk_area) return EINA_FALSE;
8347 eda = ec->desk_area.desk_area;
8349 // save original layer
8350 _e_client_desk_area_original_layer_save(ec, layer);
8352 // get desk_area layer
8353 edg_layer = (E_Layer)e_desk_area_layer_get(eda);
8354 org_layer = e_client_desk_area_original_layer_get(ec);
8356 ELOGF("EDG", "layer_set by desk_area... layer:%d, org_layer:%d, new_layer:%d", ec, layer, org_layer, edg_layer);
8357 if (org_layer == edg_layer)
8363 evas_object_layer_set(ec->frame, edg_layer);
8364 if (edg_layer == ec->layer)
8372 e_client_desk_area_original_layer_restore(E_Client *ec)
8376 // Do we need to check ec->desk_area.enable?
8377 // if ec->desk_area.enable is true, then e_client_layer_set calls
8378 // e_desk_area_ec_edg_layer_set(). that's too bad. :(
8379 // so, we MUST make a policy for ordering of the desk group layer restore
8380 // and the desk group enable.
8381 if (ec->desk_area.enable) return;
8382 e_client_layer_set(ec, ec->desk_area.layer_backup);
8386 e_client_desk_area_original_layer_get(E_Client *ec)
8388 if (!ec) return E_LAYER_DESKTOP;
8390 if (ec->desk_area.enable)
8391 return ec->desk_area.layer_backup;
8397 e_client_desk_area_client_layer_set(E_Client *ec, E_Desk_Area_Client_Layer edgc_layer)
8399 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8400 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8401 if ((edgc_layer < E_DESK_AREA_CLIENT_LAYER_DESKTOP) ||
8402 (edgc_layer >= E_DESK_AREA_CLIENT_LAYER_MAX))
8405 ec->desk_area.edgc_layer = edgc_layer;
8409 EINTERN E_Desk_Area_Client_Layer
8410 e_client_desk_area_client_layer_get(E_Client *ec)
8412 E_OBJECT_CHECK_RETURN(ec, E_DESK_AREA_CLIENT_LAYER_DESKTOP);
8414 return ec->desk_area.edgc_layer;
8417 #ifdef REFACTOR_ZONE_DESK
8420 e_client_desk_area_enable_set(E_Client *ec, Eina_Bool enable)
8422 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
8423 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
8425 ec->desk_area.enable = enable;
8427 ELOGF("EDG", "Desk group enable set to %d", ec, enable);
8430 if (!ec->desk_area.transform)
8432 ec->desk_area.transform = e_util_transform_new();
8433 e_util_transform_role_set(ec->desk_area.transform, "desk_area");
8438 if (ec->desk_area.transform)
8440 e_util_transform_del(ec->desk_area.transform);
8441 ec->desk_area.transform = NULL;
8445 e_desk_area_ec_update(ec->desk_area.desk_area, ec);
8450 //FIXME: use e_desk_area_ec_reassign(eda, ec) instead of this api
8452 e_client_desk_area_set(E_Client *ec, E_Desk_Area *eda)
8454 E_Desk_Area *old_edg;
8456 if (!ec) return EINA_FALSE;
8458 #if 0 // if this is removed.. then below if (eda != old_edg) is removed also...
8459 if (ec->desk_area.desk_area == eda)
8463 ELOGF("EDG", "Desk Group Set (new:%p, old:%p)", ec, eda, ec->desk_area.desk_area);
8464 old_edg = ec->desk_area.desk_area;
8466 e_desk_area_ec_remove(old_edg, ec);
8468 ec->desk_area.desk_area = eda;
8469 e_desk_area_ec_add(eda, ec);
8471 #if 0 // if this is removed.. then above if (ec->desk_area.desk_area == eda) is removed also...
8475 e_desk_area_ec_update(eda, ec);
8476 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
8483 _raise_between_sibling_under_parent(E_Client *ec)
8485 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);
8486 e_client_stack_below(ec, ec->parent);
8490 _raise_between_sibling_on_parent(E_Client *ec)
8492 E_Client *top_child = NULL;
8493 top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
8496 ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
8497 e_client_stack_above(ec, ec->parent);
8501 if (top_child != ec)
8503 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);
8504 e_client_stack_above(ec, top_child);
8507 ELOGF("POL", "RAISE child window between sibling... already on the top. STAY", ec);
8512 _raise_belong_to_parent(E_Client *ec)
8514 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
8515 _raise_between_sibling_under_parent(ec);
8517 _raise_between_sibling_on_parent(ec);
8521 e_client_raise(E_Client *ec)
8525 if (ec->desk_area.enable)
8528 eda = ec->desk_area.desk_area;
8531 e_desk_area_ec_raise(eda, ec);
8536 if (ec->parent && e_client_is_belong_to_parent(ec))
8537 _raise_belong_to_parent(ec);
8539 evas_object_raise(ec->frame);
8541 wl_signal_emit_mutable(&PRI(ec)->events.raise, NULL);
8545 _e_client_transient_for_below_group_make(E_Client *ec, Eina_List **list)
8547 // list : Head is the bottommost child
8553 EINA_LIST_REVERSE_FOREACH(ec->transients, l, child)
8555 if (!child) continue;
8556 if (e_client_transient_policy_get(child) != E_TRANSIENT_BELOW) continue;
8557 if (!e_client_is_belong_to_parent(child)) continue;
8559 *list = eina_list_prepend(*list, child);
8560 _e_client_transient_for_group_make(child, list);
8565 e_client_transient_child_bottom_get(E_Client *ec)
8567 E_Client *bottom_ec = NULL;
8568 Eina_List *transient_below_list = NULL;
8569 Eina_List *l = NULL;
8571 _e_client_transient_for_below_group_make(ec, &transient_below_list);
8573 if (transient_below_list)
8575 E_Client *temp_ec = NULL;
8576 E_Client *temp_ec2 = NULL;
8578 E_CLIENT_FOREACH(temp_ec)
8580 if (bottom_ec) break;
8588 EINA_LIST_FOREACH(transient_below_list, l, temp_ec2)
8590 if (temp_ec == temp_ec2)
8592 bottom_ec = temp_ec2;
8597 eina_list_free(transient_below_list);
8603 _lower_between_sibling_under_parent(E_Client *ec)
8605 E_Client *bottom_child = NULL;
8606 bottom_child = e_client_transient_child_bottom_get(ec->parent);
8609 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);
8610 e_client_stack_below(ec, ec->parent);
8614 if (bottom_child != ec)
8616 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);
8617 e_client_stack_below(ec, bottom_child);
8620 ELOGF("POL", "LOWER child window between sibling... already under the bottom. STAY", ec);
8625 _lower_between_sibling_on_parent(E_Client *ec)
8627 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);
8628 e_client_stack_above(ec, ec->parent);
8632 _lower_belong_to_parent(E_Client *ec)
8634 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
8635 _lower_between_sibling_under_parent(ec);
8637 _lower_between_sibling_on_parent(ec);
8641 e_client_lower(E_Client *ec)
8645 if (ec->desk_area.enable)
8648 eda = ec->desk_area.desk_area;
8651 e_desk_area_ec_lower(eda, ec);
8652 #ifdef REFACTOR_FOCUS_POLICY
8653 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
8654 _e_client_hook_call(E_CLIENT_HOOK_LOWER, ec);
8660 if (ec->parent && e_client_is_belong_to_parent(ec))
8661 _lower_belong_to_parent(ec);
8663 evas_object_lower(ec->frame);
8665 #ifdef REFACTOR_FOCUS_POLICY
8666 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
8667 _e_client_hook_call(E_CLIENT_HOOK_LOWER, ec);
8672 e_client_stack_above(E_Client *ec, E_Client *above)
8675 if (!ec->frame) return;
8677 if (!above->frame) return;
8679 if (ec->desk_area.enable)
8682 eda = ec->desk_area.desk_area;
8685 e_desk_area_ec_stack_above(eda, ec, above);
8690 evas_object_stack_above(ec->frame, above->frame);
8692 wl_signal_emit_mutable(&PRI(ec)->events.stack_above, NULL);
8696 e_client_stack_below(E_Client *ec, E_Client *below)
8699 if (!ec->frame) return;
8701 if (!below->frame) return;
8703 if (ec->desk_area.enable)
8706 eda = ec->desk_area.desk_area;
8709 e_desk_area_ec_stack_below(eda, ec, below);
8714 evas_object_stack_below(ec->frame, below->frame);
8716 wl_signal_emit_mutable(&PRI(ec)->events.stack_below, NULL);
8720 e_client_show_pending_set(E_Client *ec)
8724 ec->show_pending.count++;
8725 ELOGF("E_CLIENT", "SET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
8726 return ec->show_pending.count;
8730 e_client_show_pending_unset(E_Client *ec)
8733 if (ec->show_pending.count <= 0) return 0;
8735 ec->show_pending.count--;
8736 ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
8737 if (ec->show_pending.count == 0 && ec->show_pending.running)
8739 ec->show_pending.running = EINA_FALSE;
8742 ELOGF("E_CLIENT", "evas_object_show by unset show_pending", ec);
8743 evas_object_show(ec->frame);
8744 //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
8749 return ec->show_pending.count;
8753 _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
8757 Eina_Bool res = EINA_TRUE;
8758 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
8763 EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc)
8765 res = _e_client_surface_tree_foreach_helper(subc, func, data);
8772 res = func(data, ec);
8775 EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc)
8777 res = _e_client_surface_tree_foreach_helper(subc,
8790 e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
8792 EINA_SAFETY_ON_NULL_RETURN(ec);
8793 EINA_SAFETY_ON_NULL_RETURN(func);
8795 _e_client_surface_tree_foreach_helper(ec, func, data);
8798 EINTERN E_Comp_Wl_Client_Data *
8799 e_client_cdata_new(E_Client *ec)
8801 E_Comp_Wl_Client_Data *cdata;
8803 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
8805 if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1)))
8807 ERR("Could not allocate new E_Comp_Wl_Client_Data structure");
8810 ec->comp_data = cdata;
8816 e_client_cdata_free(E_Client *ec)
8818 EINA_SAFETY_ON_NULL_RETURN(ec);
8819 if (!ec->comp_data) return;
8821 E_FREE(ec->comp_data);
8824 EINTERN E_Comp_Wl_Client_Data *
8825 e_client_cdata_get(E_Client *ec)
8827 if (!ec) return NULL;
8829 return ec->comp_data;
8833 e_client_map_set(E_Client *ec, E_Map *em)
8835 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8837 return e_map_set_to_comp_object(em, ec->frame);
8841 e_client_map_get(const E_Client *ec)
8843 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
8845 return e_map_get_from_comp_object(ec->frame);
8849 e_client_map_enable_set(E_Client *ec, Eina_Bool enable)
8851 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8852 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE);
8854 evas_object_map_enable_set(ec->frame, enable);
8860 e_client_belong_to_parent_set(E_Client *ec, Eina_Bool set)
8863 ec->belong_to_parent = set;
8867 e_client_is_belong_to_parent(E_Client *ec)
8869 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8870 return ec->belong_to_parent;
8874 e_client_transient_policy_set(E_Client *ec, E_Transient policy)
8877 ec->transient_policy = policy;
8881 e_client_transient_policy_get(E_Client *ec)
8883 if (!ec) return E_TRANSIENT_ABOVE;
8884 return ec->transient_policy;
8888 e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb)
8890 if (_e_client_resize_object_create_cb && cb)
8891 CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!");
8892 _e_client_resize_object_create_cb = cb;
8896 e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
8900 // FYI, we consider 0 and 1 to be the same value as a default unit size.
8901 ec->manage_resize.unit_size = unit_size;
8905 e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
8908 ec->desk_zoom.enable = enable;
8912 e_client_desk_zoom_enable_get(E_Client *ec)
8914 if (!ec) return EINA_FALSE;
8915 return ec->desk_zoom.enable;
8919 e_client_layout_apply(E_Client *ec, Eina_Bool apply)
8922 ec->apply_layout = apply;
8926 e_client_is_layout_apply(E_Client *ec)
8928 if (!ec) return EINA_FALSE;
8929 return ec->apply_layout;
8933 e_client_from_surface_resource(struct wl_resource *surface_resource)
8935 EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, NULL);
8937 return e_comp_wl_util_client_from_surface_resource(surface_resource);
8941 e_client_fps_update(E_Client *ec)
8946 EINA_SAFETY_ON_NULL_RETURN(ec);
8948 if (!ec->fps.enabled) return;
8950 tim = ecore_time_get();
8952 dt = tim - ec->fps.frametimes[0];
8954 ec->fps.frametimes[0] = tim;
8958 if (ec->fps.lapse == 0.0)
8960 ec->fps.lapse = tim;
8961 ec->fps.flapse = ec->fps.cframes;
8963 else if ((tim - ec->fps.lapse) >= 0.5)
8965 ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
8966 (tim - ec->fps.lapse);
8967 ec->fps.lapse = tim;
8968 ec->fps.flapse = ec->fps.cframes;
8974 e_client_fps_get(E_Client *ec, double *fps)
8976 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
8978 if (ec->fps.old_fps == ec->fps.fps)
8981 if (ec->fps.fps > 0.0)
8984 ec->fps.old_fps = ec->fps.fps;
8992 e_client_fps_enable(E_Client *ec, Eina_Bool enable)
8994 EINA_SAFETY_ON_NULL_RETURN(ec);
8996 ec->fps.enabled = enable;
9000 e_client_explicit_sync_get(E_Client *ec)
9002 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
9004 return ec->explicit_sync;
9008 e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable)
9010 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
9012 ec->explicit_sync = enable;
9018 e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec)
9020 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, -1);
9022 return ec->acquire_fence_fd;
9026 e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd)
9028 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
9030 ec->acquire_fence_fd = fd;
9035 #ifdef REFACTOR_ZONE_DESK
9037 e_client_intercept_hook_auto_placement_call(E_Client *ec)
9039 // no need to call the intercept hook if ec is NULL.
9040 if (!ec) return EINA_FALSE;
9042 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
9044 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT Intercepted.", ec);
9052 e_client_iconify_event_send(E_Client *ec)
9054 EINA_SAFETY_ON_NULL_RETURN(ec);
9056 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
9060 e_client_uniconify_event_send(E_Client *ec)
9062 EINA_SAFETY_ON_NULL_RETURN(ec);
9064 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
9069 e_client_eval_pre_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9072 wl_signal_add(&priv->events.eval_pre_fetch, listener);
9075 EINTERN struct wl_listener *
9076 e_client_eval_pre_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9078 API_ENTRY_VAL(NULL);
9079 return wl_signal_get(&priv->events.eval_pre_fetch, notify);
9083 e_client_eval_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9086 wl_signal_add(&priv->events.eval_fetch, listener);
9089 EINTERN struct wl_listener *
9090 e_client_eval_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9092 API_ENTRY_VAL(NULL);
9093 return wl_signal_get(&priv->events.eval_fetch, notify);
9097 e_client_eval_pre_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9100 wl_signal_add(&priv->events.eval_pre_post_fetch, listener);
9103 EINTERN struct wl_listener *
9104 e_client_eval_pre_post_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9106 API_ENTRY_VAL(NULL);
9107 return wl_signal_get(&priv->events.eval_pre_post_fetch, notify);
9111 e_client_eval_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
9114 wl_signal_add(&priv->events.eval_post_fetch, listener);
9117 EINTERN struct wl_listener *
9118 e_client_eval_post_fetch_listener_get(E_Client *ec, wl_notify_func_t notify)
9120 API_ENTRY_VAL(NULL);
9121 return wl_signal_get(&priv->events.eval_post_fetch, notify);
9125 e_client_eval_pre_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
9128 wl_signal_add(&priv->events.eval_pre_frame_assign, listener);
9131 EINTERN struct wl_listener *
9132 e_client_eval_pre_frame_assign_listener_get(E_Client *ec, wl_notify_func_t notify)
9134 API_ENTRY_VAL(NULL);
9135 return wl_signal_get(&priv->events.eval_pre_frame_assign, notify);
9139 e_client_eval_post_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
9142 wl_signal_add(&priv->events.eval_post_frame_assign, listener);
9145 EINTERN struct wl_listener *
9146 e_client_eval_post_frame_assign_listener_get(E_Client *ec, wl_notify_func_t notify)
9148 API_ENTRY_VAL(NULL);
9149 return wl_signal_get(&priv->events.eval_post_frame_assign, notify);
9153 e_client_eval_pre_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9156 wl_signal_add(&priv->events.eval_pre_new_client, listener);
9159 EINTERN struct wl_listener *
9160 e_client_eval_pre_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9162 API_ENTRY_VAL(NULL);
9163 return wl_signal_get(&priv->events.eval_pre_new_client, notify);
9167 e_client_eval_post_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9170 wl_signal_add(&priv->events.eval_post_new_client, listener);
9173 EINTERN struct wl_listener *
9174 e_client_eval_post_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9176 API_ENTRY_VAL(NULL);
9177 return wl_signal_get(&priv->events.eval_post_new_client, notify);
9181 e_client_eval_visibility_listener_add(E_Client *ec, struct wl_listener *listener)
9184 wl_signal_add(&priv->events.eval_visibility, listener);
9187 EINTERN struct wl_listener *
9188 e_client_eval_visibility_listener_get(E_Client *ec, wl_notify_func_t notify)
9190 API_ENTRY_VAL(NULL);
9191 return wl_signal_get(&priv->events.eval_visibility, notify);
9195 e_client_eval_visibility_end_listener_add(E_Client *ec, struct wl_listener *listener)
9198 wl_signal_add(&priv->events.eval_visibility_end, listener);
9201 EINTERN struct wl_listener *
9202 e_client_eval_visibility_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9204 API_ENTRY_VAL(NULL);
9205 return wl_signal_get(&priv->events.eval_visibility_end, notify);
9209 e_client_eval_end_listener_add(E_Client *ec, struct wl_listener *listener)
9212 wl_signal_add(&priv->events.eval_end, listener);
9215 EINTERN struct wl_listener *
9216 e_client_eval_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9218 API_ENTRY_VAL(NULL);
9219 return wl_signal_get(&priv->events.eval_end, notify);
9223 e_client_move_begin_listener_add(E_Client *ec, struct wl_listener *listener)
9226 wl_signal_add(&priv->events.move_begin, listener);
9229 EINTERN struct wl_listener *
9230 e_client_move_begin_listener_get(E_Client *ec, wl_notify_func_t notify)
9232 API_ENTRY_VAL(NULL);
9233 return wl_signal_get(&priv->events.move_begin, notify);
9237 e_client_move_update_listener_add(E_Client *ec, struct wl_listener *listener)
9240 wl_signal_add(&priv->events.move_update, listener);
9243 EINTERN struct wl_listener *
9244 e_client_move_update_listener_get(E_Client *ec, wl_notify_func_t notify)
9246 API_ENTRY_VAL(NULL);
9247 return wl_signal_get(&priv->events.move_update, notify);
9251 e_client_move_end_listener_add(E_Client *ec, struct wl_listener *listener)
9254 wl_signal_add(&priv->events.move_end, listener);
9257 EINTERN struct wl_listener *
9258 e_client_move_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9260 API_ENTRY_VAL(NULL);
9261 return wl_signal_get(&priv->events.move_end, notify);
9265 e_client_move_resize_begin_listener_add(E_Client *ec, struct wl_listener *listener)
9268 wl_signal_add(&priv->events.move_resize_begin, listener);
9271 EINTERN struct wl_listener *
9272 e_client_move_resize_begin_listener_get(E_Client *ec, wl_notify_func_t notify)
9274 API_ENTRY_VAL(NULL);
9275 return wl_signal_get(&priv->events.move_resize_begin, notify);
9279 e_client_move_resize_update_listener_add(E_Client *ec, struct wl_listener *listener)
9282 wl_signal_add(&priv->events.move_resize_update, listener);
9285 EINTERN struct wl_listener *
9286 e_client_move_resize_update_listener_get(E_Client *ec, wl_notify_func_t notify)
9288 API_ENTRY_VAL(NULL);
9289 return wl_signal_get(&priv->events.move_resize_update, notify);
9293 e_client_move_resize_end_listener_add(E_Client *ec, struct wl_listener *listener)
9296 wl_signal_add(&priv->events.move_resize_end, listener);
9299 EINTERN struct wl_listener *
9300 e_client_move_resize_end_listener_get(E_Client *ec, wl_notify_func_t notify)
9302 API_ENTRY_VAL(NULL);
9303 return wl_signal_get(&priv->events.move_resize_end, notify);
9307 e_client_destroy_listener_add(E_Client *ec, struct wl_listener *listener)
9310 wl_signal_add(&priv->events.destroy, listener);
9313 EINTERN struct wl_listener *
9314 e_client_destroy_listener_get(E_Client *ec, wl_notify_func_t notify)
9316 API_ENTRY_VAL(NULL);
9317 return wl_signal_get(&priv->events.destroy, notify);
9321 e_client_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
9324 wl_signal_add(&priv->events.new_client, listener);
9327 EINTERN struct wl_listener *
9328 e_client_new_client_listener_get(E_Client *ec, wl_notify_func_t notify)
9330 API_ENTRY_VAL(NULL);
9331 return wl_signal_get(&priv->events.new_client, notify);
9335 e_client_new_client_post_listener_add(E_Client *ec, struct wl_listener *listener)
9338 wl_signal_add(&priv->events.new_client_post, listener);
9341 EINTERN struct wl_listener *
9342 e_client_new_client_post_listener_get(E_Client *ec, wl_notify_func_t notify)
9344 API_ENTRY_VAL(NULL);
9345 return wl_signal_get(&priv->events.new_client_post, notify);
9349 e_client_unredirect_listener_add(E_Client *ec, struct wl_listener *listener)
9352 wl_signal_add(&priv->events.unredirect, listener);
9355 EINTERN struct wl_listener *
9356 e_client_unredirect_listener_get(E_Client *ec, wl_notify_func_t notify)
9358 API_ENTRY_VAL(NULL);
9359 return wl_signal_get(&priv->events.unredirect, notify);
9363 e_client_redirect_listener_add(E_Client *ec, struct wl_listener *listener)
9366 wl_signal_add(&priv->events.redirect, listener);
9369 EINTERN struct wl_listener *
9370 e_client_redirect_listener_get(E_Client *ec, wl_notify_func_t notify)
9372 API_ENTRY_VAL(NULL);
9373 return wl_signal_get(&priv->events.redirect, notify);
9377 e_client_aux_hint_change_listener_add(E_Client *ec, struct wl_listener *listener)
9380 wl_signal_add(&priv->events.aux_hint_change, listener);
9383 EINTERN struct wl_listener *
9384 e_client_aux_hint_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9386 API_ENTRY_VAL(NULL);
9387 return wl_signal_get(&priv->events.aux_hint_change, notify);
9391 e_client_window_role_change_listener_add(E_Client *ec, struct wl_listener *listener)
9394 wl_signal_add(&priv->events.window_role_change, listener);
9397 EINTERN struct wl_listener *
9398 e_client_window_role_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9400 API_ENTRY_VAL(NULL);
9401 return wl_signal_get(&priv->events.window_role_change, notify);
9405 e_client_transform_change_listener_add(E_Client *ec, struct wl_listener *listener)
9408 wl_signal_add(&priv->events.transform_change, listener);
9411 EINTERN struct wl_listener *
9412 e_client_transform_change_listener_get(E_Client *ec, wl_notify_func_t notify)
9414 API_ENTRY_VAL(NULL);
9415 return wl_signal_get(&priv->events.transform_change, notify);
9419 e_client_activate_done_listener_add(E_Client *ec, struct wl_listener *listener)
9422 wl_signal_add(&priv->events.activate_done, listener);
9425 EINTERN struct wl_listener *
9426 e_client_activate_done_listener_get(E_Client *ec, wl_notify_func_t notify)
9428 API_ENTRY_VAL(NULL);
9429 return wl_signal_get(&priv->events.activate_done, notify);
9433 e_client_mouse_in_listener_add(E_Client *ec, struct wl_listener *listener)
9436 wl_signal_add(&priv->events.mouse_in, listener);
9439 EINTERN struct wl_listener *
9440 e_client_mouse_in_listener_get(E_Client *ec, wl_notify_func_t notify)
9442 API_ENTRY_VAL(NULL);
9443 return wl_signal_get(&priv->events.mouse_in, notify);
9447 e_client_mouse_out_listener_add(E_Client *ec, struct wl_listener *listener)
9450 wl_signal_add(&priv->events.mouse_out, listener);
9453 EINTERN struct wl_listener *
9454 e_client_mouse_out_listener_get(E_Client *ec, wl_notify_func_t notify)
9456 API_ENTRY_VAL(NULL);
9457 return wl_signal_get(&priv->events.mouse_out, notify);
9461 e_client_mouse_down_listener_add(E_Client *ec, struct wl_listener *listener)
9464 wl_signal_add(&priv->events.mouse_down, listener);
9467 EINTERN struct wl_listener *
9468 e_client_mouse_down_listener_get(E_Client *ec, wl_notify_func_t notify)
9470 API_ENTRY_VAL(NULL);
9471 return wl_signal_get(&priv->events.mouse_down, notify);
9475 e_client_focus_set_listener_add(E_Client *ec, struct wl_listener *listener)
9478 wl_signal_add(&priv->events.focus_set, listener);
9481 EINTERN struct wl_listener *
9482 e_client_focus_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9484 API_ENTRY_VAL(NULL);
9485 return wl_signal_get(&priv->events.focus_set, notify);
9489 e_client_focus_unset_listener_add(E_Client *ec, struct wl_listener *listener)
9492 wl_signal_add(&priv->events.focus_unset, listener);
9495 EINTERN struct wl_listener *
9496 e_client_focus_unset_listener_get(E_Client *ec, wl_notify_func_t notify)
9498 API_ENTRY_VAL(NULL);
9499 return wl_signal_get(&priv->events.focus_unset, notify);
9503 e_client_focus_defer_set_listener_add(E_Client *ec, struct wl_listener *listener)
9506 wl_signal_add(&priv->events.focus_defer_set, listener);
9509 EINTERN struct wl_listener *
9510 e_client_focus_defer_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9512 API_ENTRY_VAL(NULL);
9513 return wl_signal_get(&priv->events.focus_defer_set, notify);
9517 e_client_focus_latest_set_listener_add(E_Client *ec, struct wl_listener *listener)
9520 wl_signal_add(&priv->events.focus_latest_set, listener);
9523 EINTERN struct wl_listener *
9524 e_client_focus_latest_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9526 API_ENTRY_VAL(NULL);
9527 return wl_signal_get(&priv->events.focus_latest_set, notify);
9531 e_client_iconify_listener_add(E_Client *ec, struct wl_listener *listener)
9534 wl_signal_add(&priv->events.iconify, listener);
9537 EINTERN struct wl_listener *
9538 e_client_iconify_listener_get(E_Client *ec, wl_notify_func_t notify)
9540 API_ENTRY_VAL(NULL);
9541 return wl_signal_get(&priv->events.iconify, notify);
9545 e_client_uniconify_listener_add(E_Client *ec, struct wl_listener *listener)
9548 wl_signal_add(&priv->events.uniconify, listener);
9551 EINTERN struct wl_listener *
9552 e_client_uniconify_listener_get(E_Client *ec, wl_notify_func_t notify)
9554 API_ENTRY_VAL(NULL);
9555 return wl_signal_get(&priv->events.uniconify, notify);
9559 e_client_maximize_listener_add(E_Client *ec, struct wl_listener *listener)
9562 wl_signal_add(&priv->events.maximize, listener);
9565 EINTERN struct wl_listener *
9566 e_client_maximize_listener_get(E_Client *ec, wl_notify_func_t notify)
9568 API_ENTRY_VAL(NULL);
9569 return wl_signal_get(&priv->events.maximize, notify);
9573 e_client_unmaximize_listener_add(E_Client *ec, struct wl_listener *listener)
9576 wl_signal_add(&priv->events.unmaximize, listener);
9579 EINTERN struct wl_listener *
9580 e_client_unmaximize_listener_get(E_Client *ec, wl_notify_func_t notify)
9582 API_ENTRY_VAL(NULL);
9583 return wl_signal_get(&priv->events.unmaximize, notify);
9587 e_client_fullscreen_pre_listener_add(E_Client *ec, struct wl_listener *listener)
9590 wl_signal_add(&priv->events.fullscreen_pre, listener);
9593 EINTERN struct wl_listener *
9594 e_client_fullscreen_pre_listener_get(E_Client *ec, wl_notify_func_t notify)
9596 API_ENTRY_VAL(NULL);
9597 return wl_signal_get(&priv->events.fullscreen_pre, notify);
9601 e_client_fullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
9604 wl_signal_add(&priv->events.fullscreen, listener);
9607 EINTERN struct wl_listener *
9608 e_client_fullscreen_listener_get(E_Client *ec, wl_notify_func_t notify)
9610 API_ENTRY_VAL(NULL);
9611 return wl_signal_get(&priv->events.fullscreen, notify);
9615 e_client_unfullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
9618 wl_signal_add(&priv->events.unfullscreen, listener);
9621 EINTERN struct wl_listener *
9622 e_client_unfullscreen_listener_get(E_Client *ec, wl_notify_func_t notify)
9624 API_ENTRY_VAL(NULL);
9625 return wl_signal_get(&priv->events.unfullscreen, notify);
9629 e_client_move_listener_add(E_Client *ec, struct wl_listener *listener)
9632 wl_signal_add(&priv->events.move, listener);
9635 EINTERN struct wl_listener *
9636 e_client_move_listener_get(E_Client *ec, wl_notify_func_t notify)
9638 API_ENTRY_VAL(NULL);
9639 return wl_signal_get(&priv->events.move, notify);
9643 e_client_raise_listener_add(E_Client *ec, struct wl_listener *listener)
9646 wl_signal_add(&priv->events.raise, listener);
9649 EINTERN struct wl_listener *
9650 e_client_raise_listener_get(E_Client *ec, wl_notify_func_t notify)
9652 API_ENTRY_VAL(NULL);
9653 return wl_signal_get(&priv->events.raise, notify);
9657 e_client_lower_listener_add(E_Client *ec, struct wl_listener *listener)
9660 wl_signal_add(&priv->events.lower, listener);
9663 EINTERN struct wl_listener *
9664 e_client_lower_listener_get(E_Client *ec, wl_notify_func_t notify)
9666 API_ENTRY_VAL(NULL);
9667 return wl_signal_get(&priv->events.lower, notify);
9671 e_client_stack_below_listener_add(E_Client *ec, struct wl_listener *listener)
9674 wl_signal_add(&priv->events.stack_below, listener);
9677 EINTERN struct wl_listener *
9678 e_client_stack_below_listener_get(E_Client *ec, wl_notify_func_t notify)
9680 API_ENTRY_VAL(NULL);
9681 return wl_signal_get(&priv->events.stack_below, notify);
9685 e_client_stack_above_listener_add(E_Client *ec, struct wl_listener *listener)
9688 wl_signal_add(&priv->events.stack_above, listener);
9691 EINTERN struct wl_listener *
9692 e_client_stack_above_listener_get(E_Client *ec, wl_notify_func_t notify)
9694 API_ENTRY_VAL(NULL);
9695 return wl_signal_get(&priv->events.stack_above, notify);
9699 e_client_layer_set_listener_add(E_Client *ec, struct wl_listener *listener)
9702 wl_signal_add(&priv->events.layer_set, listener);
9705 EINTERN struct wl_listener *
9706 e_client_layer_set_listener_get(E_Client *ec, wl_notify_func_t notify)
9708 API_ENTRY_VAL(NULL);
9709 return wl_signal_get(&priv->events.layer_set, notify);
9713 e_client_stack_transient_for_done_listener_add(E_Client *ec, struct wl_listener *listener)
9716 wl_signal_add(&priv->events.stack_transient_for_done, listener);
9719 EINTERN struct wl_listener *
9720 e_client_stack_transient_for_done_listener_get(E_Client *ec, wl_notify_func_t notify)
9722 API_ENTRY_VAL(NULL);
9723 return wl_signal_get(&priv->events.stack_transient_for_done, notify);
9727 e_client_stick_listener_add(E_Client *ec, struct wl_listener *listener)
9730 wl_signal_add(&priv->events.stick, listener);
9733 EINTERN struct wl_listener *
9734 e_client_stick_listener_get(E_Client *ec, wl_notify_func_t notify)
9736 API_ENTRY_VAL(NULL);
9737 return wl_signal_get(&priv->events.stick, notify);
9741 e_client_unstick_listener_add(E_Client *ec, struct wl_listener *listener)
9744 wl_signal_add(&priv->events.unstick, listener);
9747 EINTERN struct wl_listener *
9748 e_client_unstick_listener_get(E_Client *ec, wl_notify_func_t notify)
9750 API_ENTRY_VAL(NULL);
9751 return wl_signal_get(&priv->events.unstick, notify);