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 set_layer;
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;
80 #ifdef REFACTOR_DESK_AREA
81 struct wl_signal get_above;
82 struct wl_signal get_below;
83 struct wl_signal get_visible_above;
84 struct wl_signal get_visible_below;
85 struct wl_signal subsurface_stack_update;
89 Eina_Bool hide_by_request;
92 static int _e_client_hooks_delete = 0;
93 static int _e_client_hooks_walking = 0;
95 static int _e_client_intercept_hooks_delete = 0;
96 static int _e_client_intercept_hooks_walking = 0;
98 E_API int E_EVENT_CLIENT_ADD = -1;
99 E_API int E_EVENT_CLIENT_REMOVE = -1;
100 E_API int E_EVENT_CLIENT_ZONE_SET = -1;
101 E_API int E_EVENT_CLIENT_DESK_SET = -1;
102 E_API int E_EVENT_CLIENT_RESIZE = -1;
103 E_API int E_EVENT_CLIENT_MOVE = -1;
104 E_API int E_EVENT_CLIENT_SHOW = -1;
105 E_API int E_EVENT_CLIENT_HIDE = -1;
106 E_API int E_EVENT_CLIENT_ICONIFY = -1;
107 E_API int E_EVENT_CLIENT_UNICONIFY = -1;
108 E_API int E_EVENT_CLIENT_STACK = -1;
109 E_API int E_EVENT_CLIENT_FOCUS_IN = -1;
110 E_API int E_EVENT_CLIENT_FOCUS_OUT = -1;
111 E_API int E_EVENT_CLIENT_PROPERTY = -1;
112 E_API int E_EVENT_CLIENT_FULLSCREEN = -1;
113 E_API int E_EVENT_CLIENT_UNFULLSCREEN = -1;
114 #ifdef _F_ZONE_WINDOW_ROTATION_
115 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = -1;
116 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = -1;
117 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1;
118 E_API int E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = -1;
120 E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1;
121 E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1;
122 E_API int E_EVENT_CLIENT_FOCUS_SKIP_SET = -1;
123 E_API int E_EVENT_CLIENT_FOCUS_SKIP_UNSET = -1;
125 static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client
127 static E_Client *ecmove = NULL;
128 static E_Client *ecresize = NULL;
129 static E_Client *action_client = 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 EINTERN void e_client_focused_set(E_Client *ec);
143 static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list);
144 static Evas_Object *_e_client_resize_object_create(E_Client *ec);
145 static void _e_client_resize_object_del(E_Client *ec);
146 static void _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y);
147 static void _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y);
149 static Eina_Inlist *_e_client_hooks[] =
151 [E_CLIENT_HOOK_EVAL_PRE_FETCH] = NULL,
152 [E_CLIENT_HOOK_EVAL_FETCH] = NULL,
153 [E_CLIENT_HOOK_EVAL_PRE_POST_FETCH] = NULL,
154 [E_CLIENT_HOOK_EVAL_POST_FETCH] = NULL,
155 [E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN] = NULL,
156 [E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN] = NULL,
157 [E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT] = NULL,
158 [E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT] = NULL,
159 [E_CLIENT_HOOK_EVAL_END] = NULL,
160 [E_CLIENT_HOOK_FOCUS_SET] = NULL,
161 [E_CLIENT_HOOK_FOCUS_UNSET] = NULL,
162 [E_CLIENT_HOOK_NEW_CLIENT] = NULL,
163 [E_CLIENT_HOOK_MOVE_BEGIN] = NULL,
164 [E_CLIENT_HOOK_MOVE_UPDATE] = NULL,
165 [E_CLIENT_HOOK_MOVE_END] = NULL,
166 [E_CLIENT_HOOK_RESIZE_BEGIN] = NULL,
167 [E_CLIENT_HOOK_RESIZE_UPDATE] = NULL,
168 [E_CLIENT_HOOK_RESIZE_END] = NULL,
169 [E_CLIENT_HOOK_FULLSCREEN_PRE] = NULL,
170 [E_CLIENT_HOOK_DEL] = NULL,
171 [E_CLIENT_HOOK_UNREDIRECT] = NULL,
172 [E_CLIENT_HOOK_REDIRECT] = NULL,
173 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
174 [E_CLIENT_HOOK_NEW_CLIENT_POST] = NULL,
176 [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL,
177 [E_CLIENT_HOOK_ICONIFY] = NULL,
178 [E_CLIENT_HOOK_UNICONIFY] = NULL,
179 [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL,
180 [E_CLIENT_HOOK_WINDOW_ROLE_CHANGE] = NULL,
181 [E_CLIENT_HOOK_TRANSFORM_CHANGE] = NULL,
182 [E_CLIENT_HOOK_ACTIVATE_DONE] = NULL,
183 [E_CLIENT_HOOK_EVAL_VISIBILITY_END] = NULL,
186 static Eina_Inlist *_e_client_intercept_hooks[] =
188 [E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT] = NULL,
189 [E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT] = NULL,
192 ///////////////////////////////////////////
195 _e_client_hooks_clean(void)
201 for (x = 0; x < E_CLIENT_HOOK_LAST; x++)
202 EINA_INLIST_FOREACH_SAFE(_e_client_hooks[x], l, ch)
204 if (!ch->delete_me) continue;
205 _e_client_hooks[x] = eina_inlist_remove(_e_client_hooks[x], EINA_INLIST_GET(ch));
211 _e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
215 e_object_ref(E_OBJECT(ec));
216 _e_client_hooks_walking++;
217 EINA_INLIST_FOREACH(_e_client_hooks[hookpoint], ch)
219 if (ch->delete_me) continue;
220 ch->func(ch->data, ec);
221 if ((hookpoint != E_CLIENT_HOOK_DEL) &&
222 (hookpoint != E_CLIENT_HOOK_MOVE_END) &&
223 (hookpoint != E_CLIENT_HOOK_RESIZE_END) &&
224 (hookpoint != E_CLIENT_HOOK_FOCUS_UNSET) &&
225 e_object_is_del(E_OBJECT(ec)))
228 _e_client_hooks_walking--;
229 if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
230 _e_client_hooks_clean();
231 return !!e_object_unref(E_OBJECT(ec));
234 ///////////////////////////////////////////
237 _e_client_intercept_hooks_clean(void)
240 E_Client_Intercept_Hook *ch;
243 for (x = 0; x < E_CLIENT_INTERCEPT_HOOK_LAST; x++)
244 EINA_INLIST_FOREACH_SAFE(_e_client_intercept_hooks[x], l, ch)
246 if (!ch->delete_me) continue;
247 _e_client_intercept_hooks[x] =
248 eina_inlist_remove(_e_client_intercept_hooks[x], EINA_INLIST_GET(ch));
254 _e_client_intercept_hook_call(E_Client_Intercept_Hook_Point hookpoint, E_Client *ec)
256 E_Client_Intercept_Hook *ch;
257 Eina_Bool ret = EINA_TRUE;
259 if (e_object_is_del(E_OBJECT(ec)))
261 if (hookpoint != E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT)
267 e_object_ref(E_OBJECT(ec));
268 _e_client_intercept_hooks_walking++;
269 EINA_INLIST_FOREACH(_e_client_intercept_hooks[hookpoint], ch)
271 if (ch->delete_me) continue;
272 if (!(ch->func(ch->data, ec)))
278 _e_client_intercept_hooks_walking--;
279 if ((_e_client_intercept_hooks_walking == 0) &&
280 (_e_client_intercept_hooks_delete > 0))
281 _e_client_intercept_hooks_clean();
283 e_object_unref(E_OBJECT(ec));
288 _e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
291 e_object_unref(E_OBJECT(ev->ec));
296 _e_client_event_simple(E_Client *ec, int type)
300 ev = E_NEW(E_Event_Client, 1);
304 e_object_ref(E_OBJECT(ec));
305 ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
309 _e_client_event_add(E_Client *ec)
314 ec->reg_ev.add = EINA_TRUE;
315 ELOGF("COMP", "SEND E_EVENT_CLIENT_ADD event", ec);
316 _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
320 _e_client_event_remove(E_Client *ec)
325 ec->reg_ev.add = EINA_FALSE;
326 ELOGF("COMP", "SEND E_EVENT_CLIENT_REMOVE event", ec);
327 _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
331 _e_client_event_show(E_Client *ec)
336 ec->reg_ev.show = EINA_TRUE;
337 _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
341 _e_client_event_hide(E_Client *ec)
343 if (!ec->reg_ev.show)
346 ec->reg_ev.show = EINA_FALSE;
347 _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
351 _e_client_event_property(E_Client *ec, int prop)
353 E_Event_Client_Property *ev;
355 ev = E_NEW(E_Event_Client_Property, 1);
360 e_object_ref(E_OBJECT(ec));
361 ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
364 ////////////////////////////////////////////////
367 _e_client_action_input_win_del(void)
369 if (!comp_grabbed) return 0;
371 e_comp_ungrab_input(1, 1);
377 _e_client_action_finish(void)
380 _e_client_action_input_win_del();
382 E_FREE_FUNC(action_timer, ecore_timer_del);
383 E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
386 action_client->keyboard_resizing = 0;
388 action_client = NULL;
392 _e_client_transform_point_transform(int cx, int cy, double angle, int x, int y, int *tx, int *ty)
394 double s = sin(angle * M_PI / 180);
395 double c = cos(angle * M_PI / 180);
402 ry = - x * s + y * c;
412 _e_client_transform_geometry_save(E_Client *ec, E_Map *map)
418 for (i = 0; i < 4; i ++)
420 e_map_point_precise_coord_get(map, i,
421 &ec->transform.saved[i].x,
422 &ec->transform.saved[i].y,
423 &ec->transform.saved[i].z);
428 _e_client_transform_resize(E_Client *ec)
432 double dx = 0, dy = 0;
437 if (!ec->transformed) return;
439 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
445 cx = ec->client.x + pw / 2;
446 cy = ec->client.y + ph / 2;
448 /* step 1: Rotate resized object and get map points */
449 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
450 e_map_util_points_populate_from_geometry(map,
451 ec->client.x, ec->client.y,
454 e_map_util_rotate(map, ec->transform.angle, cx, cy);
455 e_map_util_zoom(map, ec->transform.zoom, ec->transform.zoom, cx, cy);
457 for (i = 0; i < 4; i++)
458 e_map_point_precise_coord_get(map, i, &px[i], &py[i], NULL);
462 /* step 2: get adjusted values to keep up fixed position according
464 switch (ec->resize_mode)
466 case E_POINTER_RESIZE_R:
467 case E_POINTER_RESIZE_BR:
468 dx = ec->transform.saved[0].x - px[0];
469 dy = ec->transform.saved[0].y - py[0];
471 case E_POINTER_RESIZE_BL:
472 case E_POINTER_RESIZE_B:
473 dx = ec->transform.saved[1].x - px[1];
474 dy = ec->transform.saved[1].y - py[1];
476 case E_POINTER_RESIZE_TL:
477 case E_POINTER_RESIZE_L:
478 dx = ec->transform.saved[2].x - px[2];
479 dy = ec->transform.saved[2].y - py[2];
481 case E_POINTER_RESIZE_T:
482 case E_POINTER_RESIZE_TR:
483 dx = ec->transform.saved[3].x - px[3];
484 dy = ec->transform.saved[3].y - py[3];
490 ec->transform.adjusted.x = dx;
491 ec->transform.adjusted.y = dy;
493 /* step 3: set each points of the quadrangle */
494 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
495 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
497 for (i = 0; i < 4; i++)
498 e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0);
500 e_client_map_set(ec, map);
501 e_client_map_enable_set(ec, EINA_TRUE);
506 _e_client_transform_resize_handle(E_Client *ec)
509 int new_x, new_y, new_w, new_h;
513 Evas_Point current, moveinfo;
516 if (e_object_is_del(E_OBJECT(ec))) return;
517 if (e_client_util_ignored_get(ec)) return;
518 if (!ec->transformed) return;
520 zone = e_comp_zone_find_by_ec(ec);
523 button_id = ec->moveinfo.down.button;
525 org_w = ec->mouse.last_down[button_id - 1].w;
526 org_h = ec->mouse.last_down[button_id - 1].h;
528 new_w = ec->client.w;
529 new_h = ec->client.h;
530 new_x = ec->client.x;
531 new_y = ec->client.y;
533 /* step 1: get center coordinate its' based on original object geometry*/
534 cx = ec->client.x + org_w / 2;
535 cy = ec->client.y + org_h / 2;
537 /* step 2: transform coordinates of mouse position
538 * subtract adjusted value from mouse position is needed */
539 current.x = ec->mouse.current.mx - ec->transform.adjusted.x;
540 current.y = ec->mouse.current.my - ec->transform.adjusted.y;
541 moveinfo.x = ec->moveinfo.down.mx - ec->transform.adjusted.x;
542 moveinfo.y = ec->moveinfo.down.my - ec->transform.adjusted.y;
544 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
545 current.x, current.y,
546 ¤t.x, ¤t.y);
547 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
548 moveinfo.x, moveinfo.y,
549 &moveinfo.x, &moveinfo.y);
551 /* step 3: calculate new size */
552 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
553 (ec->resize_mode == E_POINTER_RESIZE_R) ||
554 (ec->resize_mode == E_POINTER_RESIZE_BR))
556 if ((button_id >= 1) && (button_id <= 3))
557 new_w = org_w + (current.x - moveinfo.x);
559 new_w = ec->moveinfo.down.w + (current.x - moveinfo.x);
561 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
562 (ec->resize_mode == E_POINTER_RESIZE_L) ||
563 (ec->resize_mode == E_POINTER_RESIZE_BL))
565 if ((button_id >= 1) && (button_id <= 3))
566 new_w = org_w - (current.x - moveinfo.x);
568 new_w = ec->moveinfo.down.w - (current.x - moveinfo.x);
571 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
572 (ec->resize_mode == E_POINTER_RESIZE_T) ||
573 (ec->resize_mode == E_POINTER_RESIZE_TR))
575 if ((button_id >= 1) && (button_id <= 3))
576 new_h = org_h - (current.y - moveinfo.y);
578 new_h = ec->moveinfo.down.h - (current.y - moveinfo.y);
580 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
581 (ec->resize_mode == E_POINTER_RESIZE_B) ||
582 (ec->resize_mode == E_POINTER_RESIZE_BR))
584 if ((button_id >= 1) && (button_id <= 3))
585 new_h = org_h + (current.y - moveinfo.y);
587 new_h = ec->moveinfo.down.h + (current.y - moveinfo.y);
590 new_w = MIN(new_w, zone->w);
591 new_h = MIN(new_h, zone->h);
593 /* step 4: move to new position */
594 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
595 (ec->resize_mode == E_POINTER_RESIZE_L) ||
596 (ec->resize_mode == E_POINTER_RESIZE_BL))
597 new_x += (new_w - org_w);
598 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
599 (ec->resize_mode == E_POINTER_RESIZE_T) ||
600 (ec->resize_mode == E_POINTER_RESIZE_TR))
601 new_y += (new_h - org_h);
603 /* step 5: set geometry to new value */
604 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
608 _e_client_transform_resize_begin(E_Client *ec)
611 if (!ec->transformed) return;
613 map = e_client_map_get(ec);
614 _e_client_transform_geometry_save(ec, map);
619 _e_client_transform_resize_end(E_Client *ec)
622 int new_x = 0, new_y = 0;
625 if (!ec->transformed) return;
627 map = e_client_map_get(ec);
630 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
636 cx = ec->client.x + pw / 2 + ec->transform.adjusted.x;
637 cy = ec->client.y + ph / 2 + ec->transform.adjusted.y;
639 if (ec->transform.zoom != 1.0)
643 tmp_map = e_map_dup(map);
644 e_map_util_zoom(tmp_map,
645 1 / ec->transform.zoom,
646 1 / ec->transform.zoom,
649 _e_client_transform_geometry_save(ec, tmp_map);
654 _e_client_transform_geometry_save(ec, map);
657 /* move original object to adjusted position after resizing */
658 _e_client_transform_point_transform(cx, cy,
660 ec->transform.saved[0].x,
661 ec->transform.saved[0].y,
663 e_client_util_move_without_frame(ec, new_x, new_y);
664 e_map_util_object_move_sync_set(map, EINA_TRUE);
669 _e_client_transform_move_end(E_Client *ec)
673 double dx, dy, px, py;
676 if (!ec->transformed) return;
678 map = e_client_map_get(ec);
681 if (ec->transform.zoom != 1.0)
683 e_map_point_precise_coord_get(map, 0, &px, &py, NULL);
685 dx = px - ec->transform.saved[0].x;
686 dy = py - ec->transform.saved[0].y;
688 for (i = 0; i < 4; i++)
690 ec->transform.saved[i].x += dx;
691 ec->transform.saved[i].y += dy;
695 _e_client_transform_geometry_save(ec, map);
700 e_client_intercept_hook_focus_revert_call(E_Client *ec)
702 // no need to call the intercept hook if ec is NULL.
703 if (!ec) return EINA_FALSE;
705 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
707 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT Intercepted.", ec);
715 e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
717 E_Client *above = NULL;
719 int x = 0, y = 0, w = 0, h = 0;
720 int ax = 0, ay = 0, aw = 0, ah = 0;
722 if (!ec) return NULL;
724 e_client_geometry_get(ec, &x, &y, &w, &h);
726 zone = e_comp_zone_find_by_ec(ec);
728 E_RECTS_CLIP_TO_RECT(x, y, w, h, zone->x, zone->y, zone->w, zone->h);
730 above = e_client_above_get(ec);
734 (above->layer <= ec->layer))
736 above = e_client_above_get(above);
740 if ((!e_object_is_del(E_OBJECT(above))) &&
741 (!e_client_util_ignored_get(above)) &&
743 (!above->iconic || e_policy_visibility_client_is_uniconic(above)) &&
744 (!above->bg_state) &&
746 (!above->visibility.force_obscured) &&
749 e_client_geometry_get(above, &ax, &ay, &aw, &ah);
750 if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h))
753 above = e_client_above_get(above);
760 e_client_check_obscured_by_children_group(E_Client *ec)
762 E_Client *cec = NULL;
763 Eina_List *transients = NULL, *l = NULL;
765 _e_client_transient_for_group_make(ec, &transients);
766 if (!transients) return NULL;
768 EINA_LIST_FOREACH(transients, l, cec)
770 if (E_CONTAINS(cec->x, cec->y, cec->w, cec->h, ec->x, ec->y, ec->w, ec->h))
772 if (!cec->argb) break;
773 if (cec->visibility.opaque > 0) break;
777 eina_list_free(transients);
783 e_client_check_really_iconified(E_Client *ec)
785 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
787 if (!ec->iconic) return EINA_FALSE;
789 return ((!e_policy_visibility_client_is_uniconic(ec) &&
790 !e_policy_visibility_client_is_uniconify_render_running(ec)) ||
791 (e_client_is_iconified_by_client(ec)));
795 _e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client)
797 E_Event_Client_Focus_Skip_Set *ev;
799 ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1);
803 ev->by_client = by_client;
804 e_object_ref(E_OBJECT(ec));
806 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
810 _e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client)
812 E_Event_Client_Focus_Skip_Unset *ev;
814 ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1);
818 ev->by_client = by_client;
819 e_object_ref(E_OBJECT(ec));
821 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
825 e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client)
831 if (ec->icccm.accepts_focus)
833 ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client);
834 ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
835 ec->changes.accepts_focus = 1;
838 _e_client_event_focus_skip_set(ec, by_client);
843 if (!ec->icccm.accepts_focus)
845 ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client);
846 ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
847 ec->changes.accepts_focus = 1;
850 _e_client_event_focus_skip_unset(ec, by_client);
856 e_client_check_above_focused(E_Client *ec)
858 E_Client *focus = NULL;
859 E_Client *above = NULL;
861 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
863 focus = e_client_focused_get();
864 if (!focus) return EINA_FALSE;
866 above = e_client_above_get(ec);
872 above = e_client_above_get(above);
879 _e_client_private_init(E_Client *ec)
881 E_Client_Private *priv;
883 priv = E_NEW(E_Client_Private, 1);
887 wl_signal_init(&priv->events.eval_pre_fetch);
888 wl_signal_init(&priv->events.eval_fetch);
889 wl_signal_init(&priv->events.eval_pre_post_fetch);
890 wl_signal_init(&priv->events.eval_post_fetch);
891 wl_signal_init(&priv->events.eval_pre_frame_assign);
892 wl_signal_init(&priv->events.eval_post_frame_assign);
893 wl_signal_init(&priv->events.eval_pre_new_client);
894 wl_signal_init(&priv->events.eval_post_new_client);
895 wl_signal_init(&priv->events.eval_visibility);
896 wl_signal_init(&priv->events.eval_visibility_end);
897 wl_signal_init(&priv->events.eval_end);
898 wl_signal_init(&priv->events.move_begin);
899 wl_signal_init(&priv->events.move_update);
900 wl_signal_init(&priv->events.move_end);
901 wl_signal_init(&priv->events.move_resize_begin);
902 wl_signal_init(&priv->events.move_resize_update);
903 wl_signal_init(&priv->events.move_resize_end);
904 wl_signal_init(&priv->events.destroy);
905 wl_signal_init(&priv->events.new_client);
906 wl_signal_init(&priv->events.new_client_post);
907 wl_signal_init(&priv->events.unredirect);
908 wl_signal_init(&priv->events.redirect);
909 wl_signal_init(&priv->events.aux_hint_change);
910 wl_signal_init(&priv->events.window_role_change);
911 wl_signal_init(&priv->events.transform_change);
912 wl_signal_init(&priv->events.activate_done);
913 wl_signal_init(&priv->events.mouse_in);
914 wl_signal_init(&priv->events.mouse_out);
915 wl_signal_init(&priv->events.mouse_down);
916 wl_signal_init(&priv->events.focus_set);
917 wl_signal_init(&priv->events.focus_unset);
918 wl_signal_init(&priv->events.focus_defer_set);
919 wl_signal_init(&priv->events.focus_latest_set);
920 wl_signal_init(&priv->events.iconify);
921 wl_signal_init(&priv->events.uniconify);
922 wl_signal_init(&priv->events.maximize);
923 wl_signal_init(&priv->events.unmaximize);
924 wl_signal_init(&priv->events.fullscreen_pre);
925 wl_signal_init(&priv->events.fullscreen);
926 wl_signal_init(&priv->events.unfullscreen);
927 wl_signal_init(&priv->events.move);
928 wl_signal_init(&priv->events.set_layer);
929 wl_signal_init(&priv->events.raise);
930 wl_signal_init(&priv->events.lower);
931 wl_signal_init(&priv->events.stack_below);
932 wl_signal_init(&priv->events.stack_above);
933 wl_signal_init(&priv->events.stack_transient_for_done);
934 wl_signal_init(&priv->events.stick);
935 wl_signal_init(&priv->events.unstick);
936 #ifdef REFACTOR_DESK_AREA
937 wl_signal_init(&priv->events.get_above);
938 wl_signal_init(&priv->events.get_below);
939 wl_signal_init(&priv->events.get_visible_above);
940 wl_signal_init(&priv->events.get_visible_below);
941 wl_signal_init(&priv->events.subsurface_stack_update);
944 e_object_data_set(E_OBJECT(ec), priv);
950 _e_client_private_finish(E_Client *ec)
952 E_Client_Private *priv;
955 e_object_data_set(E_OBJECT(ec), NULL);
961 _e_client_free(E_Client *ec)
963 g_rec_mutex_lock(&e_comp->ec_list_mutex);
965 e_comp_object_redirected_set(ec->frame, 0);
966 e_comp_object_render_update_del(ec->frame);
968 E_OBJECT(ec)->references++;
971 e_comp->new_clients--;
973 if (ec->e.state.video_parent && ec->e.state.video_parent_client)
975 ec->e.state.video_parent_client->e.state.video_child =
976 eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
978 if (ec->e.state.video_child)
982 EINA_LIST_FREE(ec->e.state.video_child, tmp)
983 tmp->e.state.video_parent_client = NULL;
985 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
987 E_FREE_FUNC(ec->map_timer, ecore_timer_del);
989 ec->transients = eina_list_free(ec->transients);
990 eina_stringshare_replace(&ec->border.name, NULL);
991 eina_stringshare_replace(&ec->bordername, NULL);
992 eina_stringshare_replace(&ec->icccm.name, NULL);
993 #if defined(__cplusplus) || defined(c_plusplus)
994 eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
996 eina_stringshare_replace(&ec->icccm.class, NULL);
998 eina_stringshare_replace(&ec->icccm.title, NULL);
999 eina_stringshare_replace(&ec->icccm.window_role, NULL);
1000 eina_stringshare_replace(&ec->netwm.name, NULL);
1002 E_FREE_FUNC(ec->frame, evas_object_del);
1004 E_OBJECT(ec)->references--;
1005 ELOGF("COMP", "CLIENT FREE", ec);
1007 e_uuid_store_entry_del(ec->uuid);
1009 _e_client_private_finish(ec);
1012 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1016 _e_client_del(E_Client *ec)
1021 g_rec_mutex_lock(&e_comp->ec_list_mutex);
1025 if (ec == e_comp_object_dim_client_get())
1027 INF("[DIM] client deleted\n");
1028 e_comp_object_dim_client_set(NULL);
1031 if (ec->cur_mouse_action)
1033 if (ec->cur_mouse_action->func.end)
1034 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1036 if (action_client == ec) _e_client_action_finish();
1040 e_client_comp_hidden_set(ec, 1);
1041 evas_object_pass_events_set(ec->frame, 1);
1044 E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
1046 wl_signal_emit_mutable(&PRI(ec)->events.destroy, NULL);
1048 /* must be called before parent/child clear */
1049 _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
1051 _e_client_event_remove(ec);
1053 ELOGF("COMP", "CLIENT DEL", ec);
1057 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
1060 EINA_LIST_FREE(ec->transients, child)
1061 child->parent = NULL;
1063 type = e_pixmap_type_get(ec->pixmap);
1064 if (type < E_PIXMAP_TYPE_MAX)
1065 eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
1066 e_comp->clients = eina_list_remove(e_comp->clients, ec);
1067 e_comp_object_render_update_del(ec->frame);
1068 e_comp_post_update_purge(ec);
1069 if (e_pixmap_free(ec->pixmap))
1070 e_pixmap_client_set(ec->pixmap, NULL);
1073 // base_output_resolution
1074 e_util_transform_del(ec->base_output_resolution.transform);
1075 ec->base_output_resolution.transform = NULL;
1076 E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
1078 if (ec->transform_core.transform_list)
1080 E_Util_Transform *transform;
1082 EINA_LIST_FREE(ec->transform_core.transform_list, transform)
1084 e_util_transform_unref(transform);
1088 ec->transform_core.result.enable = EINA_FALSE;
1090 _e_client_resize_object_del(ec);
1092 e_comp_visibility_calculation_set(EINA_TRUE);
1094 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1097 ///////////////////////////////////////////
1100 _e_client_cb_kill_timer(void *data)
1102 E_Client *ec = data;
1104 // dont wait until it's hung -
1107 if (ec->netwm.pid > 1)
1108 kill(ec->netwm.pid, SIGKILL);
1110 ec->kill_timer = NULL;
1111 return ECORE_CALLBACK_CANCEL;
1115 _e_client_cb_ping_poller(void *data)
1120 if (e_object_is_del(E_OBJECT(ec)))
1122 ec->ping_poller = NULL;
1123 return ECORE_CALLBACK_CANCEL;
1131 evas_object_smart_callback_call(ec->frame, "unhung", NULL);
1132 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1137 /* if time between last ping and now is greater
1138 * than half the ping interval... */
1139 if ((ecore_loop_time_get() - ec->ping) >
1140 ((e_config->ping_clients_interval *
1141 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
1146 evas_object_smart_callback_call(ec->frame, "hung", NULL);
1147 /* FIXME: if below dialog is up - hide it now */
1149 if (ec->delete_requested)
1151 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
1152 e_client_act_kill_begin(ec);
1156 ec->ping_poller = NULL;
1158 return ECORE_CALLBACK_CANCEL;
1161 ///////////////////////////////////////////
1164 _e_client_action_input_win_new(void)
1168 CRI("DOUBLE COMP GRAB! ACK!!!!");
1171 comp_grabbed = e_comp_grab_input(1, 1);
1172 if (!comp_grabbed) _e_client_action_input_win_del();
1173 return comp_grabbed;
1177 _e_client_action_init(E_Client *ec)
1179 action_orig.x = ec->x;
1180 action_orig.y = ec->y;
1181 action_orig.w = ec->w;
1182 action_orig.h = ec->h;
1186 action_client->keyboard_resizing = 0;
1192 _e_client_move_begin(E_Client *ec)
1194 if ((ec->fullscreen) || (ec->lock_user_location))
1197 if (!_e_client_action_input_win_new()) return 0;
1201 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
1202 _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
1205 if (ecmove == ec) ecmove = NULL;
1206 _e_client_action_input_win_del();
1209 if (!ec->lock_user_stacking)
1211 if (e_config->border_raise_on_mouse_action)
1216 e_comp_client_override_add(ec);
1222 _e_client_move_end(E_Client *ec)
1225 _e_client_action_input_win_del();
1227 wl_signal_emit_mutable(&PRI(ec)->events.move_end, NULL);
1228 _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
1230 if (ec->transformed)
1231 _e_client_transform_move_end(ec);
1234 e_comp_client_override_del(ec);
1241 _e_client_action_move_timeout(void *data EINA_UNUSED)
1243 _e_client_move_end(action_client);
1244 _e_client_action_finish();
1245 return ECORE_CALLBACK_CANCEL;
1249 _e_client_action_move_timeout_add(void)
1251 E_FREE_FUNC(action_timer, ecore_timer_del);
1252 if (e_config->border_keyboard.timeout)
1253 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
1257 _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1259 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1262 ERR("no action_client!");
1264 if (action_client) _e_client_move_end(action_client);
1265 _e_client_action_finish();
1266 return ECORE_CALLBACK_DONE;
1270 _e_client_moveinfo_gather(E_Client *ec, const char *source)
1272 if (e_util_glob_match(source, "mouse,*,1"))
1273 ec->moveinfo.down.button = 1;
1274 else if (e_util_glob_match(source, "mouse,*,2"))
1275 ec->moveinfo.down.button = 2;
1276 else if (e_util_glob_match(source, "mouse,*,3"))
1277 ec->moveinfo.down.button = 3;
1279 ec->moveinfo.down.button = 0;
1280 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1282 ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
1283 ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
1287 ec->moveinfo.down.mx = ec->mouse.current.mx;
1288 ec->moveinfo.down.my = ec->mouse.current.my;
1293 _e_client_move_handle(E_Client *ec)
1297 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1299 x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
1300 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1301 y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
1302 (ec->mouse.current.my - ec->moveinfo.down.my);
1306 x = ec->moveinfo.down.x +
1307 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1308 y = ec->moveinfo.down.y +
1309 (ec->mouse.current.my - ec->moveinfo.down.my);
1312 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1313 _e_client_stay_within_canvas(ec, x, y, &x, &y);
1316 _e_client_stay_within_canvas_margin(ec, x, y, &x, &y);
1318 evas_object_move(ec->frame, x, y);
1320 if (e_client_transform_core_enable_get(ec))
1322 e_client_transform_core_update(ec);
1326 static Evas_Object *
1327 _e_client_resize_object_rectangle_get(E_Client *ec)
1329 Evas_Object *resize_obj = NULL;
1331 resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame));
1332 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1334 if (e_config->resize_object.customize)
1336 evas_object_color_set(resize_obj,
1337 e_config->resize_object.r,
1338 e_config->resize_object.g,
1339 e_config->resize_object.b,
1340 e_config->resize_object.a);
1343 evas_object_color_set(resize_obj, 128, 128, 128, 100);
1348 static Evas_Object *
1349 _e_client_resize_object_image_get(E_Client *ec)
1352 Evas_Object *resize_obj = NULL;
1354 if (!e_config->resize_object.image_path)
1356 ELOGF("COMP", "NO resize_object image! Make default resize_object", ec);
1360 resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame));
1361 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1363 evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL);
1364 err = evas_object_image_load_error_get(resize_obj);
1365 if (err != EVAS_LOAD_ERROR_NONE)
1367 ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object",
1368 ec, e_config->resize_object.image_path, err);
1369 evas_object_del(resize_obj);
1374 evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h);
1375 evas_object_image_filled_set(resize_obj, EINA_TRUE);
1377 evas_object_image_border_set(resize_obj,
1378 e_config->resize_object.border_width.l,
1379 e_config->resize_object.border_width.r,
1380 e_config->resize_object.border_width.t,
1381 e_config->resize_object.border_width.b);
1386 return _e_client_resize_object_rectangle_get(ec);
1389 static Evas_Object *
1390 _e_client_resize_object_create(E_Client *ec)
1392 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL);
1394 Evas_Object *resize_obj = NULL;
1396 if (_e_client_resize_object_create_cb)
1397 resize_obj = _e_client_resize_object_create_cb(ec);
1400 if (e_config->resize_object.type == 1) // image object
1402 resize_obj = _e_client_resize_object_image_get(ec);
1406 resize_obj = _e_client_resize_object_rectangle_get(ec);
1409 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1411 evas_object_pass_events_set(resize_obj, EINA_TRUE);
1412 evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame));
1413 evas_object_stack_above(resize_obj, ec->frame);
1414 evas_object_name_set(resize_obj, "resize_object");
1420 _e_client_resize_object_del(E_Client *ec)
1422 if (ec == NULL) return;
1423 if (ec->manage_resize.resize_obj == NULL) return;
1425 evas_object_hide(ec->manage_resize.resize_obj);
1426 evas_object_del(ec->manage_resize.resize_obj);
1427 ec->manage_resize.resize_obj = NULL;
1431 _e_client_resize_handle(E_Client *ec)
1434 int new_x, new_y, new_w, new_h;
1436 int trans_x = 0, trans_y = 0;
1437 int trans_w = 0, trans_h = 0;
1439 if (ec->transformed)
1441 _e_client_transform_resize_handle(ec);
1450 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
1451 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1452 (ec->resize_mode == E_POINTER_RESIZE_BR))
1454 if ((ec->moveinfo.down.button >= 1) &&
1455 (ec->moveinfo.down.button <= 3))
1456 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
1457 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1459 w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
1461 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1462 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1463 (ec->resize_mode == E_POINTER_RESIZE_BL))
1465 if ((ec->moveinfo.down.button >= 1) &&
1466 (ec->moveinfo.down.button <= 3))
1467 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
1468 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1470 w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
1473 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1474 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1475 (ec->resize_mode == E_POINTER_RESIZE_TR))
1477 if ((ec->moveinfo.down.button >= 1) &&
1478 (ec->moveinfo.down.button <= 3))
1479 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
1480 (ec->mouse.current.my - ec->moveinfo.down.my);
1482 h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
1484 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
1485 (ec->resize_mode == E_POINTER_RESIZE_B) ||
1486 (ec->resize_mode == E_POINTER_RESIZE_BR))
1488 if ((ec->moveinfo.down.button >= 1) &&
1489 (ec->moveinfo.down.button <= 3))
1490 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
1491 (ec->mouse.current.my - ec->moveinfo.down.my);
1493 h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
1498 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1499 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1500 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1501 (ec->resize_mode == E_POINTER_RESIZE_BL))
1503 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1504 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1505 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1506 (ec->resize_mode == E_POINTER_RESIZE_TR))
1513 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1516 zone = e_comp_zone_find_by_ec(ec);
1519 w = MIN(w, zone->w);
1520 h = MIN(h, zone->h);
1523 e_client_resize_limit(ec, &new_w, &new_h);
1525 if (ec->manage_resize.enable_aspect_ratio)
1527 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1528 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1529 (ec->resize_mode == E_POINTER_RESIZE_BL) ||
1530 (ec->resize_mode == E_POINTER_RESIZE_TR) ||
1531 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1532 (ec->resize_mode == E_POINTER_RESIZE_BR))
1534 new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w;
1536 else if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1537 (ec->resize_mode == E_POINTER_RESIZE_B))
1539 new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h;
1541 new_h += ec->manage_resize.header_h;
1542 new_h += ec->manage_resize.footer_h;
1545 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1546 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1547 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1548 (ec->resize_mode == E_POINTER_RESIZE_BL))
1549 new_x += (w - new_w);
1550 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1551 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1552 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1553 (ec->resize_mode == E_POINTER_RESIZE_TR))
1554 new_y += (h - new_h);
1556 if (e_config->interactive_resize)
1558 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
1562 if (ec->manage_resize.resize_obj == NULL)
1564 ec->manage_resize.resize_obj = _e_client_resize_object_create(ec);
1565 EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj);
1568 if (e_client_transform_core_enable_get(ec))
1570 e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y);
1571 e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h);
1572 evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h);
1575 evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h);
1576 evas_object_show(ec->manage_resize.resize_obj);
1578 ec->manage_resize.x = new_x;
1579 ec->manage_resize.y = new_y;
1580 ec->manage_resize.w = new_w;
1581 ec->manage_resize.h = new_h;
1586 _e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
1588 if (ppu <= 1) return size;
1590 unsigned int remainder = size % ppu;
1591 if (remainder == 0) return size;
1593 int gap = size - start_size;
1594 int new_size = size;
1596 new_size = size + (ppu - remainder);
1598 new_size = size - remainder;
1604 _e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
1608 if (prev_pos == pos)
1611 new_pos = (prev_pos + prev_size) - size;
1617 _e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
1619 if (ec->manage_resize.unit_size <= 1) return;
1621 ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
1622 ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
1624 ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
1625 ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
1629 _e_client_resize_end(E_Client *ec)
1631 ec->resize_mode = E_POINTER_RESIZE_NONE;
1632 _e_client_action_input_win_del();
1634 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_end, NULL);
1635 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
1637 if (ec->transformed)
1638 _e_client_transform_resize_end(ec);
1641 e_comp_client_override_del(ec);
1645 if (!e_config->interactive_resize)
1647 if (ec->manage_resize.resize_obj)
1649 if (ec->manage_resize.unit_size > 1)
1650 _e_client_adjust_geometry_by_resize_ppu(ec);
1652 e_client_frame_geometry_set(ec,
1653 ec->manage_resize.x,
1654 ec->manage_resize.y,
1655 ec->manage_resize.w,
1656 ec->manage_resize.h);
1657 _e_client_resize_object_del(ec);
1665 _e_client_action_resize_timeout(void *data EINA_UNUSED)
1667 _e_client_resize_end(action_client);
1668 _e_client_action_finish();
1669 return ECORE_CALLBACK_CANCEL;
1673 _e_client_action_resize_timeout_add(void)
1675 E_FREE_FUNC(action_timer, ecore_timer_del);
1676 if (e_config->border_keyboard.timeout)
1677 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
1681 _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1683 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1686 ERR("no action_client!");
1688 if (action_client) _e_client_resize_end(action_client);
1689 _e_client_action_finish();
1690 return ECORE_CALLBACK_DONE;
1693 ////////////////////////////////////////////////
1696 _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty)
1699 Eina_Bool res = EINA_FALSE;
1700 Eina_List *list = NULL, *l;
1701 Eina_Rectangle *data;
1703 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
1705 e_client_geometry_get(ec, &x, &y, &w, &h);
1706 e_comp_object_input_rect_get(ec->frame, &list);
1709 EINA_LIST_FOREACH(list, l, data)
1711 if ((tx >= x + data->x) && (tx <= x + data->x + data->w) &&
1712 (ty >= y + data->y) && (ty <= y + data->y + data->h))
1718 list = eina_list_free(list);
1722 if ((tx >= x) && (tx <= x + w) &&
1723 (ty >= y) && (ty <= y + h))
1733 _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *client)
1735 /* If a border was specified which should be excluded from the list
1736 * (because it will be closed shortly for example), skip */
1737 if (e_client_util_ignored_get(client) || (!e_desk_has_ec(desk, client))) return EINA_TRUE;
1738 if (!evas_object_visible_get(client->frame)) return EINA_TRUE;
1739 if (e_policy_client_is_cursor(client)) return EINA_TRUE;
1740 if (e_comp_wl->drag_client == client) return EINA_TRUE;
1746 _e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
1748 E_Client *ec = NULL, *cec;
1750 E_CLIENT_REVERSE_FOREACH(cec)
1752 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1753 if ((exclude) && (cec == exclude)) continue;
1754 if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1756 /* If the layer is higher, the position of the window is higher
1757 * (always on top vs always below) */
1758 if (!ec || (cec->layer > ec->layer))
1765 _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
1767 E_Client *ec = NULL, *cec;
1769 E_CLIENT_REVERSE_FOREACH(cec)
1771 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1773 Eina_List *list = NULL;
1774 Eina_Rectangle *rect;
1775 Eina_Bool inside = EINA_FALSE;
1776 e_comp_object_input_rect_get(cec->frame, &list);
1779 EINA_LIST_FREE(list, rect)
1781 if (E_INSIDE(x, y, rect->x, rect->y, rect->w, rect->h))
1785 else if (E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1790 if (!inside) continue;
1791 /* If the layer is higher, the position of the window is higher
1792 * (always on top vs always below) */
1793 if (!ec || (cec->layer > ec->layer))
1800 ////////////////////////////////////////////////
1803 _e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
1806 E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
1809 zone = e_comp_zone_find_by_ec(ec);
1816 if (eina_list_count(e_comp->zones) == 1)
1825 zone_left = e_comp_zone_xy_get((x - w + 5), y);
1826 zone_right = e_comp_zone_xy_get((x + w + 5), y);
1827 zone_above = e_comp_zone_xy_get(x, (y - h + 5));
1828 zone_below = e_comp_zone_xy_get(x, (y + h + 5));
1830 if (!(zone_above) && (y))
1831 zone_above = e_comp_zone_xy_get(x, (h - 5));
1833 if (!(zone_left) && (x))
1834 zone_left = e_comp_zone_xy_get((x - 5), y);
1837 w = zone_right->x + zone_right->w;
1840 w = zone->x + zone->w;
1843 h = zone_below->y + zone_below->h;
1846 h = zone->y + zone->h;
1848 if ((zone_left) && (zone_right))
1849 w = zone->w + zone_right->x;
1851 if ((zone_above) && (zone_below))
1852 h = zone->h + zone_below->y;
1854 if (x) x -= zone->w;
1855 if (y) y -= zone->h;
1857 if (zx) *zx = x > 0 ? x : 0;
1858 if (zy) *zy = y > 0 ? y : 0;
1864 _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
1866 int new_x_max, new_y_max;
1871 zone = e_comp_zone_find_by_ec(ec);
1874 if (new_x) *new_x = x;
1875 if (new_y) *new_y = y;
1879 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1881 new_x_max = zw - ec->w;
1882 new_y_max = zh - ec->h;
1883 lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
1884 lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
1918 _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
1920 int new_x_max, new_y_max, new_x_min, new_y_min;
1921 int margin_w, margin_h;
1926 zone = e_comp_zone_find_by_ec(ec);
1929 if (new_x) *new_x = x;
1930 if (new_y) *new_y = y;
1937 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1942 new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
1943 new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
1944 new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
1945 new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
1949 else if (x <= new_x_min)
1954 else if (y <= new_y_min)
1959 ////////////////////////////////////////////////
1962 _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set)
1964 if (ec->transform_core.activate == set) return;
1966 ec->transform_core.activate = set;
1970 if (ec->transform_core.result.enable)
1971 e_client_map_enable_set(ec, EINA_TRUE);
1975 e_client_map_enable_set(ec, EINA_FALSE);
1980 _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1982 E_Client *ec = data;
1984 if (stopping) return; //ignore all of this if we're shutting down!
1985 if (e_object_is_del(data)) return; //client is about to die
1986 if (ec->cur_mouse_action)
1988 if (ec->cur_mouse_action->func.end_mouse)
1989 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
1990 else if (ec->cur_mouse_action->func.end)
1991 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1992 E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
1994 if (action_client == ec) _e_client_action_finish();
1996 ec->want_focus = ec->take_focus = 0;
1998 _e_client_transform_core_activate_set(ec, EINA_FALSE);
2000 if (ec->new_client) return;
2001 _e_client_event_hide(ec);
2007 _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2009 E_Client *ec = data;
2013 if (e_object_is_del(data)) return;
2015 ec->pre_res_change.valid = 0;
2017 _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
2019 evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
2020 if ((e_config->transient.move) && (ec->transients))
2022 Eina_List *list = eina_list_clone(ec->transients);
2025 EINA_LIST_FREE(list, child)
2027 if (child->vkbd.vkbd) continue;
2029 evas_object_move(child->frame,
2030 child->x + x - ec->pre_cb.x,
2031 child->y + y - ec->pre_cb.y);
2034 if (ec->moving || (ecmove == ec))
2036 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2037 _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
2040 if ((!ec->moving) && (ec->transformed))
2042 map = e_client_map_get(ec);
2043 _e_client_transform_geometry_save(ec, map);
2047 ec->pre_cb.x = x; ec->pre_cb.y = y;
2049 wl_signal_emit_mutable(&PRI(ec)->events.move, NULL);
2051 e_comp_visibility_calculation_set(EINA_TRUE);
2055 _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2057 E_Client *ec = data;
2058 Evas_Coord x, y, w, h;
2060 if (e_object_is_del(data)) return;
2062 ec->pre_res_change.valid = 0;
2064 _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
2066 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
2067 if ((e_config->transient.resize) && (ec->transients))
2069 Eina_List *list = eina_list_clone(ec->transients);
2072 EINA_LIST_FREE(list, child)
2074 Evas_Coord nx, ny, nw, nh;
2076 if ((ec->pre_cb.w > 0) && (ec->pre_cb.h > 0))
2078 nx = x + (((child->x - x) * w) / ec->pre_cb.w);
2079 ny = y + (((child->y - y) * h) / ec->pre_cb.h);
2080 nw = (child->w * w) / ec->pre_cb.w;
2081 nh = (child->h * h) / ec->pre_cb.h;
2082 nx += ((nw - child->w) / 2);
2083 ny += ((nh - child->h) / 2);
2084 evas_object_move(child->frame, nx, ny);
2089 if (e_client_util_resizing_get(ec) || (ecresize == ec))
2091 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2092 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
2094 ec->pre_cb.w = w; ec->pre_cb.h = h;
2096 e_client_transform_core_update(ec);
2097 e_comp_visibility_calculation_set(EINA_TRUE);
2101 _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2103 E_Client *ec = data;
2105 if (e_object_is_del(data)) return;
2107 _e_client_transform_core_activate_set(ec, EINA_TRUE);
2109 _e_client_event_show(ec);
2114 _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2116 E_Client *ec = data;
2117 E_Comp_Wl_Client_Data *child_cdata = NULL;
2119 if (e_object_is_del(data)) return;
2120 if (ec->layer_block) return;
2121 if (ec->layer_pending) return;
2122 if (e_config->transient.raise && ec->transients)
2124 Eina_List *list = eina_list_clone(ec->transients);
2125 E_Client *child, *below = NULL, *above = NULL;
2126 E_Transient transient_policy;
2128 E_LIST_REVERSE_FREE(list, child)
2130 child_cdata = e_client_cdata_get(child);
2131 if (child_cdata && !child_cdata->mapped)
2133 ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child));
2137 /* Don't stack iconic transients. If the user wants these shown,
2138 * that's another option.
2140 if (child->iconic && e_client_is_iconified_by_client(child)) continue;
2142 transient_policy = e_client_transient_policy_get(child);
2143 if (transient_policy == E_TRANSIENT_ABOVE)
2146 e_client_stack_below(child, below);
2148 e_client_stack_above(child, ec);
2151 else if (transient_policy == E_TRANSIENT_BELOW)
2154 e_client_stack_below(child, above);
2156 e_client_stack_below(child, ec);
2162 _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
2164 e_comp_visibility_calculation_set(EINA_TRUE);
2167 ////////////////////////////////////////////////
2169 _e_client_aux_hint_eval(E_Client *ec)
2173 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2175 E_Comp_Wl_Aux_Hint *hint;
2177 if (cdata && cdata->aux_hint.changed)
2179 wl_signal_emit_mutable(&PRI(ec)->events.aux_hint_change, NULL);
2180 _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
2182 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
2184 hint->changed = EINA_FALSE;
2187 ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec, hint->id, hint->hint, hint->val);
2188 if (hint->hint) eina_stringshare_del(hint->hint);
2189 if (hint->val) eina_stringshare_del(hint->val);
2190 cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
2194 cdata->aux_hint.changed = 0;
2199 _e_client_eval(E_Client *ec)
2202 unsigned int prop = 0;
2205 if (e_object_is_del(E_OBJECT(ec)))
2207 CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
2212 TRACE_DS_BEGIN(CLIENT:EVAL);
2214 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_new_client, NULL);
2215 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec))
2221 if ((ec->new_client) && (!e_client_util_ignored_get(ec)))
2223 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2224 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2231 if (ec->changes.size)
2233 ec->changes.size = 0;
2234 evas_object_resize(ec->frame, ec->w, ec->h);
2236 prop |= E_CLIENT_PROPERTY_SIZE;
2238 if (ec->changes.pos)
2240 ec->changes.tz_position = 0;
2241 ec->changes.pos = 0;
2242 evas_object_move(ec->frame, ec->x, ec->y);
2243 prop |= E_CLIENT_PROPERTY_POS;
2246 if (ec->changes.reset_gravity)
2248 ec->changes.reset_gravity = 0;
2249 prop |= E_CLIENT_PROPERTY_GRAVITY;
2252 if (ec->changes.title)
2254 ec->changes.title = 0;
2255 prop |= E_CLIENT_PROPERTY_TITLE;
2258 if ((ec->changes.visible) && (ec->visible) && (ec->new_client) && (!ec->iconic))
2262 e_input_device_pointer_xy_get(NULL, &x, &y);
2263 if ((!ec->placed) && (!ec->re_manage) &&
2264 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
2265 (!((ec->icccm.transient_for != 0) ||
2267 (!ecmove) && (!ecresize))
2269 /* Set this window into moving state */
2271 ec->cur_mouse_action = e_action_find("window_move");
2272 if (ec->cur_mouse_action)
2274 if ((!ec->cur_mouse_action->func.end_mouse) &&
2275 (!ec->cur_mouse_action->func.end))
2276 ec->cur_mouse_action = NULL;
2277 if (ec->cur_mouse_action)
2280 tx = x - (ec->w >> 1);
2281 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
2283 e_client_pos_set(ec, tx, ty);
2285 ec->changes.pos = 1;
2290 evas_object_show(ec->frame);
2291 if (evas_object_visible_get(ec->frame))
2293 ec->changes.visible = 0;
2294 _e_client_event_show(ec);
2297 else if ((ec->changes.visible) && (ec->new_client))
2299 ec->changes.visible = 0;
2301 _e_client_event_hide(ec);
2304 if (ec->changes.icon)
2306 ec->changes.icon = 0;
2310 e_comp->new_clients--;
2312 ec->changed = ec->changes.pos || ec->changes.size ||
2313 ec->changes.stack || ec->changes.prop || ec->changes.border ||
2314 ec->changes.reset_gravity ||
2315 ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
2316 ec->changes.internal_state ||
2317 ec->changes.need_maximize || ec->changes.need_unmaximize;
2318 ec->changes.stack = 0;
2320 if (ec->changes.need_maximize)
2322 E_Maximize max = ec->maximized;
2323 ec->maximized = E_MAXIMIZE_NONE;
2324 e_client_maximize(ec, max);
2325 ec->changes.need_maximize = 0;
2327 else if (ec->changes.need_unmaximize)
2329 e_client_unmaximize(ec, ec->maximized);
2330 ec->changes.need_unmaximize = 0;
2333 if (ec->need_fullscreen)
2335 e_client_fullscreen(ec, e_config->fullscreen_policy);
2336 ec->need_fullscreen = 0;
2339 if (ec->changes.accepts_focus)
2341 if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus))
2344 ec->changes.accepts_focus = 0;
2348 if (send_event && prop)
2350 _e_client_event_property(ec, prop);
2353 _e_client_aux_hint_eval(ec);
2355 e_client_transform_core_update(ec);
2357 wl_signal_emit_mutable(&PRI(ec)->events.eval_end, NULL);
2358 _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
2364 e_client_frame_update(E_Client *ec)
2366 const char *bordername;
2368 EINA_SAFETY_ON_NULL_RETURN(ec);
2369 if (e_object_is_del(E_OBJECT(ec))) return;
2371 ec->border.changed = 0;
2372 if (!e_comp_object_frame_allowed(ec->frame)) return;
2373 if (ec->fullscreen || ec->borderless)
2374 bordername = "borderless";
2375 else if (ec->bordername)
2376 bordername = ec->bordername;
2377 else if (((ec->icccm.transient_for != 0) || (ec->dialog)) &&
2378 (ec->icccm.min_w == ec->icccm.max_w) &&
2379 (ec->icccm.min_h == ec->icccm.max_h))
2380 bordername = "noresize_dialog";
2381 else if ((ec->icccm.min_w == ec->icccm.max_w) &&
2382 (ec->icccm.min_h == ec->icccm.max_h))
2383 bordername = "noresize";
2384 else if (ec->shaped)
2385 bordername = "shaped";
2386 else if ((ec->netwm.state.skip_taskbar) ||
2387 (ec->netwm.state.skip_pager))
2388 bordername = "skipped";
2390 else if ((ec->internal) && (ec->icccm.class) &&
2391 (!strncmp(ec->icccm.class, "e_fwin", 6)))
2392 bordername = "internal_fileman";
2395 bordername = e_config->theme_default_border_style;
2396 if (!bordername) bordername = "default";
2398 e_client_border_set(ec, bordername);
2402 _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
2404 if (!ec || !m) return EINA_FALSE;
2405 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
2407 if ((int)ec->netwm.type != m->window_type)
2410 #if defined(__cplusplus) || defined(c_plusplus)
2413 if (!ec->icccm.cpp_class)
2416 if (!e_util_glob_match(ec->icccm.cpp_class, m->clas))
2422 if (!ec->icccm.class)
2425 if (!e_util_glob_match(ec->icccm.class, m->clas))
2432 if (ec->icccm.name && e_util_glob_match(ec->icccm.name, m->name))
2435 if (ec->icccm.title && e_util_glob_match(ec->icccm.title, m->name))
2438 if (ec->netwm.name && e_util_glob_match(ec->netwm.name, m->name))
2446 e_client_type_update(E_Client *ec)
2448 E_Config_Client_Type *m;
2452 if (!e_config->client_types) return 0;
2454 EINA_LIST_FOREACH(e_config->client_types, l, m)
2456 if (!_e_client_type_match(ec, m)) continue;
2459 type = m->client_type;
2464 if (ec->client_type != type)
2466 ec->client_type = type;
2467 _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
2470 return ec->client_type;
2474 _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom)
2476 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2480 int ox = 0, oy = 0, ow, oh;
2484 EINA_SAFETY_ON_FALSE_RETURN(e_comp_wl_subsurface_check(ec));
2486 e_comp_wl_subsurface_position_get(ec, &ox, &oy);
2487 ow = cdata->width_from_viewport;
2488 oh = cdata->height_from_viewport;
2490 map = e_client_map_get(epc);
2491 e_map_point_coord_get(map, 0, &px, &py, 0);
2494 mx = ox * zoom + px;
2495 my = oy * zoom + py;
2499 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
2500 e_map_util_points_populate_from_geometry(map, mx, my, mw, mh, 0);
2501 e_map_util_object_move_sync_set(map, EINA_TRUE);
2502 e_client_map_set(ec, map);
2503 e_client_map_enable_set(ec, EINA_TRUE);
2505 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2506 _e_client_transform_sub_apply(subc, ec, zoom);
2507 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
2508 _e_client_transform_sub_apply(subc, ec, zoom);
2514 _e_client_transient_for_group_make(E_Client *ec, Eina_List **list)
2520 if (!e_config->transient.raise) return;
2522 EINA_LIST_FOREACH(ec->transients, l, child)
2524 if (!child) continue;
2525 if (child->iconic) continue;
2526 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
2528 *list = eina_list_prepend(*list, child);
2529 _e_client_transient_for_group_make(child, list);
2535 e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus)
2537 E_Client *top_ec = NULL;
2538 Eina_List *transient_list = NULL;
2540 _e_client_transient_for_group_make(ec, &transient_list);
2544 Eina_List *l = NULL;
2545 E_Client *temp_ec = NULL;
2546 E_Client *temp_ec2 = NULL;
2548 E_CLIENT_REVERSE_FOREACH(temp_ec)
2557 EINA_LIST_FOREACH(transient_list, l, temp_ec2)
2559 if (temp_ec == temp_ec2)
2563 if ((temp_ec2->icccm.accepts_focus) ||
2564 (temp_ec2->icccm.take_focus))
2577 eina_list_free(transient_list);
2582 #ifdef EC_IS_NOT_VISIBLE
2583 # undef EC_IS_NOT_VISIBLE
2585 #define EC_IS_NOT_VISIBLE if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED)
2588 e_client_visibility_touched_check(E_Client *ec)
2592 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
2594 tx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x);
2595 ty = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y);
2597 return _e_client_position_inside_input_rect(ec, tx, ty);
2601 e_client_visibility_change_notify(E_Client *ec)
2603 EINA_SAFETY_ON_NULL_RETURN(ec);
2605 if (ec->visibility.changed)
2606 _e_client_event_simple(ec, E_EVENT_CLIENT_VISIBILITY_CHANGE);
2608 wl_signal_emit_mutable(&PRI(ec)->events.eval_visibility, NULL);
2609 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY, ec);
2613 e_client_visibility_end_notify(void)
2615 // FIXME: This hook means that the visiblitiy calculation of a zone is done
2616 // at this idle handler.This is a hook for a zone, not for a client.
2617 // Therefore, this hook may be defined as a zone hook,
2618 // ex) E_ZONE_HOOK_EVAL_VISIBILITY_END or E_ZONE_HOOK_EVAL_VISIBILITY_DONE.
2619 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY_END, NULL);
2623 _e_client_transform_core_check_change(E_Client *ec)
2627 Eina_Bool check = EINA_FALSE;
2628 if (!ec) return EINA_FALSE;
2631 evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
2633 // check client position or size change
2634 if (ec->x != ec->transform_core.backup.client_x ||
2635 ec->y != ec->transform_core.backup.client_y ||
2636 ec->w != ec->transform_core.backup.client_w ||
2637 ec->h != ec->transform_core.backup.client_h ||
2638 w != ec->transform_core.backup.frame_w ||
2639 h != ec->transform_core.backup.frame_h ||
2640 ec->argb != ec->transform_core.backup.argb)
2643 ec->transform_core.backup.client_x = ec->x;
2644 ec->transform_core.backup.client_y = ec->y;
2645 ec->transform_core.backup.client_w = ec->w;
2646 ec->transform_core.backup.client_h = ec->h;
2647 ec->transform_core.backup.frame_w = w;
2648 ec->transform_core.backup.frame_h = h;
2649 ec->transform_core.backup.argb = ec->argb;
2652 // check new transform or del transform
2653 if (ec->transform_core.changed)
2656 ec->transform_core.changed = EINA_FALSE;
2659 // check each transform change
2660 if (ec->transform_core.transform_list)
2664 E_Util_Transform *transform;
2666 EINA_LIST_FOREACH_SAFE(ec->transform_core.transform_list, l, l_next, transform)
2668 // del transform check
2669 if (e_util_transform_ref_count_get(transform) <= 1)
2671 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
2672 e_util_transform_unref(transform);
2677 // transform change test
2678 if (e_util_transform_change_get(transform))
2681 e_util_transform_change_unset(transform);
2686 if (e_comp_wl_subsurface_check(ec))
2688 // check parent matrix change
2689 E_Client *parent = e_comp_wl_subsurface_parent_get(ec);
2690 if (parent && parent->transform_core.result.enable)
2692 ec->transform_core.parent.enable = EINA_TRUE;
2694 if (!e_util_transform_matrix_equal_check(&ec->transform_core.parent.matrix,
2695 &parent->transform_core.result.matrix))
2698 ec->transform_core.parent.matrix = parent->transform_core.result.matrix;
2700 if (memcmp(&ec->transform_core.parent.zoom, &parent->transform_core.result.transform.zoom, sizeof(E_Util_Transform_Zoom)) != 0)
2703 ec->transform_core.parent.zoom = parent->transform_core.result.transform.zoom;
2706 else if (ec->transform_core.parent.enable)
2708 ec->transform_core.parent.enable = EINA_FALSE;
2709 e_util_transform_matrix_load_identity(&ec->transform_core.parent.matrix);
2710 ec->transform_core.parent.zoom.zoom_x = 1.0;
2711 ec->transform_core.parent.zoom.zoom_y = 1.0;
2712 ec->transform_core.parent.zoom.cx = 0;
2713 ec->transform_core.parent.zoom.cy = 0;
2722 _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2724 int minx = 99999, miny = 99999;
2725 int maxx = -99999, maxy = -99999;
2730 if (!ec->frame) return;
2731 if (!ec->transform_core.result.enable) return;
2732 if (!vertices) return;
2734 for (i = 0; i < 4; ++i)
2739 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2741 if (x < minx) minx = x;
2742 if (y < miny) miny = y;
2743 if (x > maxx) maxx = x;
2744 if (y > maxy) maxy = y;
2747 ec->transform_core.result.boundary.x = minx;
2748 ec->transform_core.result.boundary.y = miny;
2749 ec->transform_core.result.boundary.w = maxx - minx;
2750 ec->transform_core.result.boundary.h = maxy - miny;
2752 ELOGF("COMP", "[Transform][boundary][%d %d %d %d]",
2754 ec->transform_core.result.boundary.x,
2755 ec->transform_core.result.boundary.y,
2756 ec->transform_core.result.boundary.w,
2757 ec->transform_core.result.boundary.h);
2761 _e_client_transform_core_map_new(Evas_Object *obj,
2762 E_Util_Transform_Rect_Vertex *vertices,
2763 E_Util_Transform *transform,
2764 Eina_Bool direct_render)
2771 map = e_map_new_with_direct_render(direct_render);
2772 EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL);
2774 e_map_util_points_populate_from_object_full(map, obj, 0);
2775 e_map_util_points_color_set(map, 255, 255, 255, 255);
2777 for (i = 0 ; i < 4 ; ++i)
2782 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2783 e_map_point_coord_set(map, i, x, y, 1.0);
2785 if (transform && e_util_transform_texcoord_flag_get(transform))
2790 e_util_transform_texcoord_get(transform, i, &u, &v);
2791 e_map_point_image_uv_set(map, i, u, v);
2799 _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec,
2801 E_Util_Transform_Rect_Vertex *vertices,
2802 E_Util_Transform *transform,
2803 E_Util_Transform_Zoom zoom)
2811 map = _e_client_transform_core_map_new(obj, vertices, transform,
2812 ec->transform_core.direct_render);
2813 EINA_SAFETY_ON_NULL_RETURN(map);
2815 e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy);
2817 e_comp_object_map_set(obj, map);
2819 if (ec->transform_core.activate)
2820 e_comp_object_map_enable_set(obj, EINA_TRUE);
2822 e_comp_object_map_enable_set(obj, EINA_FALSE);
2827 evas_object_map_enable_set(obj, EINA_FALSE);
2831 _e_client_transform_core_vertices_apply(E_Client *ec,
2833 E_Util_Transform_Rect_Vertex *vertices,
2834 E_Util_Transform *transform)
2842 map = _e_client_transform_core_map_new(obj, vertices, transform,
2843 ec->transform_core.direct_render);
2844 EINA_SAFETY_ON_NULL_RETURN(map);
2846 e_comp_object_map_set(obj, map);
2848 if (ec->transform_core.activate)
2849 e_comp_object_map_enable_set(obj, EINA_TRUE);
2851 e_comp_object_map_enable_set(obj, EINA_FALSE);
2856 evas_object_map_enable_set(obj, EINA_FALSE);
2860 _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2864 E_Comp_Wl_Client_Data *cdata;
2868 cdata = e_client_cdata_get(ec);
2871 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2872 e_client_transform_core_update(subc);
2874 EINA_LIST_FOREACH(cdata->sub.below_list, l, subc)
2875 e_client_transform_core_update(subc);
2879 _e_client_cb_hook_shell_surface_ready(void *data EINA_UNUSED, E_Client *ec)
2881 if (EINA_UNLIKELY(!ec))
2884 _e_client_aux_hint_eval(ec);
2887 // FIXME: This function has to be deleted and it remains for the backward compatibility.
2888 // Please find and fix to use e_comp_visibility_calculation_set(EINA_TRUE)
2889 // instead of e_client_visibility_calculate() call at e20 modules.
2891 e_client_visibility_calculate(void)
2893 e_comp_visibility_calculation_set(EINA_TRUE);
2897 e_client_visibility_skip_set(E_Client *ec, Eina_Bool skip)
2901 ELOGF("POL_VIS", "visibility skip set to %d", ec, skip);
2902 ec->visibility.skip = skip;
2906 e_client_post_raise_lower_set(E_Client *ec, Eina_Bool raise_set, Eina_Bool lower_set)
2910 ec->post_raise = raise_set;
2911 ec->post_lower = lower_set;
2915 e_client_first_mapped_get(E_Client *ec)
2917 if (!ec) return EINA_FALSE;
2919 return ec->first_mapped;
2922 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec)
2924 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2925 EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE);
2927 return cdata->mapped;
2931 e_client_mapped_set(E_Client *ec, Eina_Bool set)
2933 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2934 EINA_SAFETY_ON_NULL_RETURN(cdata);
2936 cdata->mapped = set;
2940 ////////////////////////////////////////////////
2942 e_client_clients_hash_exist()
2946 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
2948 if (eina_hash_population(clients_hash[pix_id]))
2956 e_client_idler_before(Eina_Bool *check_focus)
2961 *check_focus = EINA_FALSE;
2963 if (!e_client_clients_hash_exist()) return;
2965 TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
2967 EINA_LIST_FOREACH(e_comp->clients, l, ec)
2969 // pass 1 - eval0. fetch properties on new or on change and
2970 // call hooks to decide what to do - maybe move/resize
2971 if (ec->ignored || (!ec->changed)) continue;
2973 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_fetch, NULL);
2974 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
2977 /* FETCH is hooked by the compositor to get client hints */
2978 wl_signal_emit_mutable(&PRI(ec)->events.eval_fetch, NULL);
2979 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
2983 e_client_type_update(ec);
2986 /* PRE_POST_FETCH calls e_remember apply for new client */
2987 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_post_fetch, NULL);
2988 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
2989 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_fetch, NULL);
2990 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
2991 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_frame_assign, NULL);
2992 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
2994 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_frame_assign, NULL);
2995 _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
2997 // pass 2 - show and hide windows needing hide and eval (main eval)
2998 E_CLIENT_FOREACH(ec)
3000 if (e_object_is_del(E_OBJECT(ec))) continue;
3003 // ignored client but needing eval (aux hint) such as remote surfaces
3006 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3007 if (cdata && cdata->first_commit)
3008 _e_client_aux_hint_eval(ec);
3013 if (ec->changes.visible)
3017 if ((!ec->new_client) &&
3018 (!ec->changes.pos) &&
3019 (!ec->changes.size))
3021 evas_object_show(ec->frame);
3022 ec->changes.visible = !evas_object_visible_get(ec->frame);
3027 evas_object_hide(ec->frame);
3028 ec->changes.visible = 0;
3035 e_comp_visibility_calculation_set(EINA_TRUE);
3036 if (ec->changes.accepts_focus)
3037 *check_focus = EINA_TRUE;
3038 ec->changes.accepts_focus = 0;
3041 if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
3043 evas_object_show(ec->frame);
3044 ec->changes.visible = !evas_object_visible_get(ec->frame);
3045 ec->changed = ec->changes.visible;
3046 e_comp_visibility_calculation_set(EINA_TRUE);
3058 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3059 clients_hash[pix_id] = eina_hash_pointer_new(NULL);
3061 E_COMP_WL_HOOK_APPEND(hooks, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _e_client_cb_hook_shell_surface_ready, NULL);
3063 E_EVENT_CLIENT_ADD = ecore_event_type_new();
3064 E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
3065 E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
3066 E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
3067 E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
3068 E_EVENT_CLIENT_MOVE = ecore_event_type_new();
3069 E_EVENT_CLIENT_SHOW = ecore_event_type_new();
3070 E_EVENT_CLIENT_HIDE = ecore_event_type_new();
3071 E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
3072 E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
3073 E_EVENT_CLIENT_STACK = ecore_event_type_new();
3074 E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
3075 E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
3076 E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
3077 E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
3078 E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
3079 #ifdef _F_ZONE_WINDOW_ROTATION_
3080 E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
3081 E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
3082 E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new();
3083 E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = ecore_event_type_new();
3085 E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new();
3086 E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new();
3087 E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();;
3088 E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();;
3090 return (!!clients_hash[1]);
3094 e_client_shutdown(void)
3097 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3098 E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
3100 E_FREE_LIST(hooks, e_comp_wl_hook_del);
3101 E_FREE_LIST(handlers, ecore_event_handler_del);
3106 e_client_unignore(E_Client *ec)
3109 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3110 if (!ec->ignored) return;
3113 _e_client_event_add(ec);
3117 _e_client_convert_fullscreen_layer(int layer)
3119 if (layer <= E_LAYER_CLIENT_NORMAL)
3120 return E_LAYER_CLIENT_NORMAL;
3121 else if (layer <= E_LAYER_CLIENT_ABOVE)
3122 return E_LAYER_CLIENT_ABOVE;
3123 else if (layer <= E_LAYER_CLIENT_EDGE)
3124 return E_LAYER_CLIENT_EDGE;
3126 return E_LAYER_CLIENT_FULLSCREEN;
3130 e_client_new(E_Pixmap *cp, int first_map, int internal)
3135 type = e_pixmap_type_get(cp);
3136 if (type >= E_PIXMAP_TYPE_MAX) return NULL;
3137 if (eina_hash_find(clients_hash[type], &cp)) return NULL;
3139 ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
3140 if (!ec) return NULL;
3141 e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
3143 if (!_e_client_private_init(ec))
3145 e_object_del(E_OBJECT(ec));
3149 uuid_generate(ec->uuid);
3151 ec->focus_policy_override = E_FOCUS_LAST;
3152 e_client_size_set(ec, 1, 1);
3153 ec->internal = internal;
3156 e_pixmap_client_set(cp, ec);
3157 ec->resize_mode = E_POINTER_RESIZE_NONE;
3158 ec->layer = E_LAYER_CLIENT_NORMAL;
3159 ec->first_mapped = EINA_FALSE;
3160 ec->post_raise = EINA_TRUE;
3161 ec->post_lower = EINA_FALSE;
3162 ec->animatable = EINA_TRUE;
3163 ec->maximize_type = e_config->maximize_policy & E_MAXIMIZE_TYPE;
3164 ec->fullscreen_layer = _e_client_convert_fullscreen_layer(e_config->fullscreen_layer);
3166 /* FIXME: if first_map is 1 then we should ignore the first hide event
3167 * or ensure the window is already hidden and events flushed before we
3168 * create a border for it */
3171 ec->changes.pos = 1;
3175 e_comp->new_clients++;
3177 ec->exp_iconify.by_client = 0;
3178 ec->exp_iconify.not_raise = 0;
3179 ec->exp_iconify.skip_iconify = 0;
3180 ec->exp_iconify.skip_by_remote = 0;
3181 if (e_config->deiconify_approve)
3182 ec->exp_iconify.deiconify_update= 1;
3184 ec->exp_iconify.deiconify_update= 0;
3185 if (e_config->use_buffer_flush)
3186 ec->exp_iconify.buffer_flush = 1;
3188 ec->exp_iconify.buffer_flush = 0;
3190 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
3192 wl_signal_emit_mutable(&PRI(ec)->events.new_client, NULL);
3193 if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec))
3195 /* delete the above allocated object */
3196 //e_object_del(E_OBJECT(ec));
3200 _e_client_aux_hint_eval(ec);
3202 ec->icccm.title = NULL;
3203 ec->icccm.name = NULL;
3204 #if defined(__cplusplus) || defined(c_plusplus)
3205 ec->icccm.cpp_class = NULL;
3207 ec->icccm.class = NULL;
3209 ec->icccm.min_w = 1;
3210 ec->icccm.min_h = 1;
3211 ec->icccm.max_w = 32767;
3212 ec->icccm.max_h = 32767;
3215 ec->netwm.name = NULL;
3216 ec->netwm.state.skip_taskbar = 0;
3217 ec->netwm.state.skip_pager = 0;
3218 ec->netwm.opacity = 255;
3220 ec->visibility.obscured = E_VISIBILITY_UNKNOWN;
3221 ec->visibility.opaque = -1;
3222 ec->visibility.changed = 0;
3223 ec->visibility.skip = 0;
3224 ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN;
3226 ec->transform.zoom = 1.0;
3227 ec->transform.angle = 0.0;
3228 ec->transform_core.direct_render = EINA_TRUE;
3229 ec->transform_core.activate = EINA_TRUE;
3231 ec->pointer_enter_sent = EINA_FALSE;
3233 ec->acquire_fence_fd = -1;
3237 e_comp->clients = eina_list_append(e_comp->clients, ec);
3238 eina_hash_add(clients_hash[type], &ec->pixmap, ec);
3240 ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored);
3242 _e_client_event_add(ec);
3243 e_comp_object_client_add(ec);
3246 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
3247 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
3248 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
3249 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
3250 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
3253 wl_signal_emit_mutable(&PRI(ec)->events.new_client_post, NULL);
3255 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
3256 _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec);
3259 ec->manage_resize.resize_obj = NULL;
3260 ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0;
3261 ec->manage_resize.enable_aspect_ratio = EINA_FALSE;
3262 ec->manage_resize.aw = ec->manage_resize.ah = 0;
3263 ec->manage_resize.header_h = 0;
3264 ec->manage_resize.footer_h = 0;
3266 ec->visibility.ignore_geometry = e_config->calc_vis_ignore_geometry;
3271 E_API Eina_Bool e_client_is_internal(E_Client *ec)
3273 E_OBJECT_CHECK_RETURN(ec, EINA_TRUE);
3274 return ec->internal;
3278 e_client_desk_iconify_skip_set(E_Client *ec, Eina_Bool skip)
3281 ec->user_skip_winlist = skip;
3285 e_client_desk_iconify_skip_get(E_Client *ec)
3287 if (!ec) return EINA_FALSE;
3288 return ec->user_skip_winlist;
3292 e_client_comp_grabbed_get(void)
3294 return comp_grabbed;
3298 e_client_action_get(void)
3300 return action_client;
3304 //////////////////////////////////////////////////////////
3307 e_client_mouse_in(E_Client *ec, int x, int y)
3311 if (comp_grabbed) return;
3312 if (e_object_is_del(E_OBJECT(ec))) return;
3313 desk = e_comp_desk_find_by_ec(ec);
3314 if (desk && desk->animate_count) return;
3315 ec->mouse.current.mx = x;
3316 ec->mouse.current.my = y;
3319 wl_signal_emit_mutable(&PRI(ec)->events.mouse_in, NULL);
3323 e_client_mouse_out(E_Client *ec, int x, int y)
3327 if (comp_grabbed) return;
3328 if (ec->fullscreen) return;
3329 if (e_object_is_del(E_OBJECT(ec))) return;
3330 desk = e_comp_desk_find_by_ec(ec);
3331 if (desk && desk->animate_count) return;
3333 ec->mouse.current.mx = x;
3334 ec->mouse.current.my = y;
3337 wl_signal_emit_mutable(&PRI(ec)->events.mouse_out, NULL);
3341 e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
3343 EINA_SAFETY_ON_NULL_RETURN(ec);
3344 if (action_client) return;
3345 ec->mouse.current.mx = output->x;
3346 ec->mouse.current.my = output->y;
3350 e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
3352 EINA_SAFETY_ON_NULL_RETURN(ec);
3354 if (action_client || ec->iconic || e_client_util_ignored_get(ec)) return;
3355 if ((button >= 1) && (button <= 3))
3357 ec->mouse.last_down[button - 1].mx = output->x;
3358 ec->mouse.last_down[button - 1].my = output->y;
3359 ec->mouse.last_down[button - 1].x = ec->x;
3360 ec->mouse.last_down[button - 1].y = ec->y;
3361 ec->mouse.last_down[button - 1].w = ec->w;
3362 ec->mouse.last_down[button - 1].h = ec->h;
3366 ec->moveinfo.down.x = ec->x;
3367 ec->moveinfo.down.y = ec->y;
3368 ec->moveinfo.down.w = ec->w;
3369 ec->moveinfo.down.h = ec->h;
3371 ec->mouse.current.mx = output->x;
3372 ec->mouse.current.my = output->y;
3373 if ((button >= 1) && (button <= 3))
3375 ec->mouse.last_down[button - 1].mx = output->x;
3376 ec->mouse.last_down[button - 1].my = output->y;
3377 ec->mouse.last_down[button - 1].x = ec->x;
3378 ec->mouse.last_down[button - 1].y = ec->y;
3379 ec->mouse.last_down[button - 1].w = ec->w;
3380 ec->mouse.last_down[button - 1].h = ec->h;
3384 ec->moveinfo.down.x = ec->x;
3385 ec->moveinfo.down.y = ec->y;
3386 ec->moveinfo.down.w = ec->w;
3387 ec->moveinfo.down.h = ec->h;
3389 ec->mouse.current.mx = output->x;
3390 ec->mouse.current.my = output->y;
3392 wl_signal_emit_mutable(&PRI(ec)->events.mouse_down, NULL);
3396 e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
3398 EINA_SAFETY_ON_NULL_RETURN(ec);
3399 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3400 if ((button >= 1) && (button <= 3))
3402 ec->mouse.last_up[button - 1].mx = output->x;
3403 ec->mouse.last_up[button - 1].my = output->y;
3404 ec->mouse.last_up[button - 1].x = ec->x;
3405 ec->mouse.last_up[button - 1].y = ec->y;
3407 ec->mouse.current.mx = output->x;
3408 ec->mouse.current.my = output->y;
3409 /* also we don't pass the same params that went in - then again that */
3410 /* should be ok as we are just ending the action if it has an end */
3411 if (ec->cur_mouse_action)
3413 if (ec->cur_mouse_action->func.end_mouse)
3414 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
3415 else if (ec->cur_mouse_action->func.end)
3416 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
3417 e_object_unref(E_OBJECT(ec->cur_mouse_action));
3418 ec->cur_mouse_action = NULL;
3421 if ((button >= 1) && (button <= 3))
3423 ec->mouse.last_up[button - 1].mx = output->x;
3424 ec->mouse.last_up[button - 1].my = output->y;
3425 ec->mouse.last_up[button - 1].x = ec->x;
3426 ec->mouse.last_up[button - 1].y = ec->y;
3431 e_client_stay_within_canvas_margin(E_Client *ec)
3438 _e_client_stay_within_canvas_margin(ec, ec->x, ec->y, &new_x, &new_y);
3440 if ((ec->x != new_x) || (ec->y != new_y))
3441 evas_object_move(ec->frame, new_x, new_y);
3446 e_client_mouse_move(E_Client *ec, Evas_Point *output)
3448 EINA_SAFETY_ON_NULL_RETURN(ec);
3449 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3450 ec->mouse.current.mx = output->x;
3451 ec->mouse.current.my = output->y;
3452 if (e_client_util_moving_get(ec))
3454 _e_client_move_handle(ec);
3456 else if (e_client_util_resizing_get(ec))
3458 _e_client_resize_handle(ec);
3461 ///////////////////////////////////////////////////////
3464 e_client_res_change_geometry_save(E_Client *ec)
3467 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3469 if (ec->pre_res_change.valid) return;
3470 ec->pre_res_change.valid = 1;
3471 ec->pre_res_change.x = ec->x;
3472 ec->pre_res_change.y = ec->y;
3473 ec->pre_res_change.w = ec->w;
3474 ec->pre_res_change.h = ec->h;
3475 ec->pre_res_change.saved.x = ec->saved.x;
3476 ec->pre_res_change.saved.y = ec->saved.y;
3477 ec->pre_res_change.saved.w = ec->saved.w;
3478 ec->pre_res_change.saved.h = ec->saved.h;
3482 e_client_res_change_geometry_restore(E_Client *ec)
3488 unsigned char valid : 1;
3497 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3498 if (!ec->pre_res_change.valid) return;
3499 if (ec->new_client) return;
3501 zone = e_comp_zone_find_by_ec(ec);
3504 memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
3508 e_client_unfullscreen(ec);
3509 e_client_fullscreen(ec, e_config->fullscreen_policy);
3511 else if (ec->maximized != E_MAXIMIZE_NONE)
3515 max = ec->maximized;
3516 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
3517 e_client_maximize(ec, max);
3521 int x, y, w, h, zx, zy, zw, zh;
3523 ec->saved.x = ec->pre_res_change.saved.x;
3524 ec->saved.y = ec->pre_res_change.saved.y;
3525 ec->saved.w = ec->pre_res_change.saved.w;
3526 ec->saved.h = ec->pre_res_change.saved.h;
3528 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
3530 if (ec->saved.w > zw)
3532 if ((ec->saved.x + ec->saved.w) > (zx + zw))
3533 ec->saved.x = zx + zw - ec->saved.w;
3535 if (ec->saved.h > zh)
3537 if ((ec->saved.y + ec->saved.h) > (zy + zh))
3538 ec->saved.y = zy + zh - ec->saved.h;
3540 x = ec->pre_res_change.x;
3541 y = ec->pre_res_change.y;
3542 w = ec->pre_res_change.w;
3543 h = ec->pre_res_change.h;
3548 if ((x + w) > (zx + zw))
3550 if ((y + h) > (zy + zh))
3552 evas_object_geometry_set(ec->frame, x, y, w, h);
3554 memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
3558 e_client_pos_set(E_Client *ec, int x, int y)
3566 e_client_pos_get(E_Client *ec, int *x, int *y)
3582 e_client_size_set(E_Client *ec, int w, int h)
3590 e_client_size_get(E_Client *ec, int *w, int *h)
3606 e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
3614 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3616 if (e_client_transform_core_enable_get(ec))
3618 gx = ec->transform_core.result.boundary.x;
3619 gy = ec->transform_core.result.boundary.y;
3620 gw = ec->transform_core.result.boundary.w;
3621 gh = ec->transform_core.result.boundary.h;
3627 evas_object_geometry_get(ec->frame, &gx, &gy, &gw, &gh);
3628 if (gw == 0 && gh == 0)
3630 /* In this case, there is no image buffer in e_comp_object, thus it
3631 * should return geometry value of ec itself. It usually happens if
3632 * new ec is not mapped yet.
3656 e_client_above_get(const E_Client *ec)
3658 #ifdef REFACTOR_DESK_AREA
3659 E_Client_Data_Get_Above data;
3661 E_OBJECT_CHECK_RETURN(ec, NULL);
3662 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3664 data.above_ec = NULL;
3666 wl_signal_emit_mutable(&PRI(ec)->events.get_above, &data);
3668 return data.above_ec;
3673 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3674 if (EINA_INLIST_GET(ec)->next) //check current layer
3676 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3680 ELOGF("FATAL", "CHECK the ec inlist next", ec);
3683 if (!e_object_is_del(E_OBJECT(ec2)))
3687 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3688 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3690 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3691 /* go up the layers until we find one */
3692 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3694 if (!e_comp->layers[x].clients) continue;
3695 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3699 ELOGF("FATAL", "EC exist above layer. ec layer_map:%d, cur layer_map:%d",
3700 ec, e_comp_canvas_layer_map(ec->layer), x);
3703 if (!e_object_is_del(E_OBJECT(ec2)))
3705 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3710 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3717 e_client_below_get(const E_Client *ec)
3719 #ifdef REFACTOR_DESK_AREA
3720 E_Client_Data_Get_Below data;
3722 E_OBJECT_CHECK_RETURN(ec, NULL);
3723 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3725 data.below_ec = NULL;
3727 wl_signal_emit_mutable(&PRI(ec)->events.get_below, &data);
3729 return data.below_ec;
3734 E_Layer ec_layer, ec_layer_cw;
3737 E_OBJECT_CHECK_RETURN(ec, NULL);
3738 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3740 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3741 if (EINA_INLIST_GET(ec)->prev) //check current layer
3743 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3745 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3748 ELOGF("FATAL", "CHECK the ec inlist prev", ec);
3751 if (!e_object_is_del(E_OBJECT(ec2)))
3756 // check layer validation
3757 ec_layer = ec->layer;
3758 if (ec->layer_block || ec->layer_pending)
3760 cw_layer = e_comp_object_layer_get(ec->frame);
3763 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3764 if (ec_layer != ec_layer_cw)
3766 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);
3767 ec_layer = ec_layer_cw;
3772 if (ec_layer == E_LAYER_CLIENT_DESKTOP) return NULL;
3773 if (e_comp_canvas_client_layer_map(ec_layer) == 9999) return NULL;
3775 /* go down the layers until we find one */
3776 x = e_comp_canvas_layer_map(ec_layer);
3779 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3780 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3782 if (!e_comp->layers[x].clients) continue;
3783 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3787 ELOGF("FATAL", "EC exist below layer. ec layer_map:%d, cur layer_map:%d",
3788 ec, e_comp_canvas_layer_map(ec_layer), x);
3791 if (!e_object_is_del(E_OBJECT(ec2)))
3793 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3798 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3805 e_client_visible_above_get(E_Client *ec)
3807 #ifdef REFACTOR_DESK_AREA
3808 E_Client_Data_Get_Visible_Above data;
3810 E_OBJECT_CHECK_RETURN(ec, NULL);
3811 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3813 data.above_ec = NULL;
3815 wl_signal_emit_mutable(&PRI(ec)->events.get_visible_above, &data);
3817 return data.above_ec;
3822 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3823 if (EINA_INLIST_GET(ec)->next) //check current layer
3825 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3827 if (ec == ec2) continue;
3828 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3829 (!e_client_util_ignored_get(ec2)) &&
3836 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3837 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3839 /* go up the layers until we find one */
3840 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3842 if (!e_comp->layers[x].clients) continue;
3843 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3845 if (ec == ec2) continue;
3846 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3847 (!e_client_util_ignored_get(ec2)) &&
3859 e_client_visible_below_get(E_Client *ec)
3861 #ifdef REFACTOR_DESK_AREA
3862 E_Client_Data_Get_Visible_Below data;
3864 E_OBJECT_CHECK_RETURN(ec, NULL);
3865 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3867 data.below_ec = NULL;
3869 wl_signal_emit_mutable(&PRI(ec)->events.get_visible_below, &data);
3871 return data.below_ec;
3876 E_Layer ec_layer, ec_layer_cw;
3879 E_OBJECT_CHECK_RETURN(ec, NULL);
3880 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3882 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3883 if (EINA_INLIST_GET(ec)->prev) //check current layer
3885 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3887 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3888 if (ec == ec2) continue;
3889 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3890 (!e_client_util_ignored_get(ec2)) &&
3897 // check layer validation
3898 ec_layer = ec->layer;
3899 if (ec->layer_block || ec->layer_pending)
3901 cw_layer = e_comp_object_layer_get(ec->frame);
3904 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3905 if (ec_layer != ec_layer_cw)
3907 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);
3908 ec_layer = ec_layer_cw;
3913 /* go down the layers until we find one */
3914 if (e_comp_canvas_layer_map(ec->layer) > e_comp_canvas_layer_map(E_LAYER_MAX)) return NULL;
3915 x = e_comp_canvas_layer_map(ec->layer);
3918 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3920 if (!e_comp->layers[x].clients) continue;
3921 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3923 if (ec == ec2) continue;
3924 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3925 (!e_client_util_ignored_get(ec2)) &&
3937 e_client_bottom_get(void)
3939 #ifdef REFACTOR_DESK_AREA
3943 // get the bottom ec from current desk at current zone
3944 zone = e_zone_current_get();
3945 desk = e_desk_current_get(zone);
3947 return e_desk_bottom_ec_get(desk);
3950 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3951 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3955 if (!e_comp->layers[x].clients) continue;
3956 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3957 if (!e_object_is_del(E_OBJECT(ec2)))
3959 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3963 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3970 e_client_top_get(void)
3972 #ifdef REFACTOR_DESK_AREA
3976 // get the top ec from current desk at current zone
3977 zone = e_zone_current_get();
3978 desk = e_desk_current_get(zone);
3980 return e_desk_top_ec_get(desk);
3983 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3984 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3988 if (!e_comp->layers[x].clients) continue;
3989 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3990 if (!e_object_is_del(E_OBJECT(ec2)))
3992 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3996 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
4002 EINTERN unsigned int
4003 e_clients_count(void)
4005 return eina_list_count(e_comp->clients);
4010 * Set a callback which will be called just prior to updating the
4011 * move coordinates for a border
4014 e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
4016 ec->move_intercept_cb = cb;
4019 ///////////////////////////////////////
4021 E_API E_Client_Hook *
4022 e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
4026 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_HOOK_LAST, NULL);
4027 ch = E_NEW(E_Client_Hook, 1);
4028 if (!ch) return NULL;
4029 ch->hookpoint = hookpoint;
4031 ch->data = (void*)data;
4032 _e_client_hooks[hookpoint] = eina_inlist_append(_e_client_hooks[hookpoint], EINA_INLIST_GET(ch));
4037 e_client_hook_del(E_Client_Hook *ch)
4040 if (_e_client_hooks_walking == 0)
4042 _e_client_hooks[ch->hookpoint] = eina_inlist_remove(_e_client_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4046 _e_client_hooks_delete++;
4049 ///////////////////////////////////////
4051 E_API E_Client_Intercept_Hook *
4052 e_client_intercept_hook_add(E_Client_Intercept_Hook_Point hookpoint, E_Client_Intercept_Hook_Cb func, const void *data)
4054 E_Client_Intercept_Hook *ch;
4056 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_INTERCEPT_HOOK_LAST, NULL);
4057 ch = E_NEW(E_Client_Intercept_Hook, 1);
4058 if (!ch) return NULL;
4059 ch->hookpoint = hookpoint;
4061 ch->data = (void*)data;
4062 _e_client_intercept_hooks[hookpoint] = eina_inlist_append(_e_client_intercept_hooks[hookpoint], EINA_INLIST_GET(ch));
4067 e_client_intercept_hook_del(E_Client_Intercept_Hook *ch)
4072 if (_e_client_intercept_hooks_walking == 0)
4074 _e_client_intercept_hooks[ch->hookpoint] =
4075 eina_inlist_remove(_e_client_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4079 _e_client_intercept_hooks_delete++;
4083 e_client_focus_latest_set(E_Client *ec)
4085 EINA_SAFETY_ON_NULL_RETURN(ec);
4087 wl_signal_emit_mutable(&PRI(ec)->events.focus_latest_set, NULL);
4091 e_client_focus_defer_set(E_Client *ec)
4093 EINA_SAFETY_ON_NULL_RETURN(ec);
4095 wl_signal_emit_mutable(&PRI(ec)->events.focus_defer_set, NULL);
4099 e_client_focused_set(E_Client *ec)
4101 E_Client *focused_ec;
4105 ELOGF("FOCUS", "CLIENT FOCUSED_SET : SET", ec);
4107 ELOGF("FOCUS", "CLIENT FOCUSED_SET : UNSET", NULL);
4109 focused_ec = e_comp_focused_ec_get();
4110 if (ec == focused_ec) return;
4112 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
4114 // unset the current focused_ec if focused_ec is not being deleted
4117 if (!e_object_is_del(E_OBJECT(focused_ec)))
4119 // FIXME: Remove focus_unset event of client.
4120 // Instead, make zone focus_unset event and use it.
4121 wl_signal_emit_mutable(&PRI(focused_ec)->events.focus_unset, NULL);
4122 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, focused_ec);
4124 if (e_object_ref_get(E_OBJECT(focused_ec)) > 0)
4126 _e_client_event_simple(focused_ec, E_EVENT_CLIENT_FOCUS_OUT);
4131 // clear the current focused_ec when ec is NULL
4134 zone = e_comp_zone_find_by_ec(focused_ec);
4135 e_zone_focus_clear(zone);
4140 // FIXME: Remove focus_set event of client.
4141 // Instead, make zone focus_set event and use it.
4142 // set the new current focused_ec
4143 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, NULL);
4144 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
4146 // send the client_focuse_in event
4147 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
4153 e_client_activate(E_Client *ec)
4156 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4158 TRACE_DS_BEGIN(CLIENT:ACTIVATE);
4160 ELOGF("COMP", "Set launching flag..", ec);
4161 ec->launching = EINA_TRUE;
4163 ec->exp_iconify.not_raise = 0;
4167 if (!ec->lock_user_iconify)
4168 e_client_uniconify(ec);
4170 ELOGF("COMP", "Un-Set ICONIFY BY CLIENT", ec);
4171 ec->exp_iconify.by_client = 0;
4172 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
4174 wl_signal_emit_mutable(&PRI(ec)->events.activate_done, NULL);
4175 _e_client_hook_call(E_CLIENT_HOOK_ACTIVATE_DONE, ec);
4181 e_client_focused_get(void)
4183 return e_comp_focused_ec_get();
4187 e_client_lost_windows_get(E_Zone *zone)
4189 Eina_List *list = NULL;
4192 int loss_overlap = 5;
4194 E_OBJECT_CHECK_RETURN(zone, NULL);
4195 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
4196 EINA_LIST_FOREACH(e_comp->clients, l, ec)
4198 if (!e_zone_has_ec(zone, ec)) continue;
4199 if (e_client_util_ignored_get(ec)) continue;
4201 if (!E_INTERSECTS(zone->x + loss_overlap,
4202 zone->y + loss_overlap,
4203 zone->w - (2 * loss_overlap),
4204 zone->h - (2 * loss_overlap),
4205 ec->x, ec->y, ec->w, ec->h))
4207 list = eina_list_append(list, ec);
4213 ///////////////////////////////////////
4216 e_client_maximized_geometry_set(E_Client *ec, int x, int y, int w, int h)
4220 ec->maximized_info.x = x;
4221 ec->maximized_info.y = y;
4222 ec->maximized_info.w = w;
4223 ec->maximized_info.h = h;
4225 e_client_frame_geometry_set(ec, x, y, w, h);
4229 e_client_maximized_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
4233 if (x) *x = ec->maximized_info.x;
4234 if (y) *y = ec->maximized_info.y;
4235 if (w) *w = ec->maximized_info.w;
4236 if (h) *h = ec->maximized_info.h;
4240 e_client_maximize_update(E_Client *ec)
4245 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4249 max = ec->maximized;
4251 e_client_maximize(ec, max);
4256 e_client_maximize(E_Client *ec, E_Maximize max)
4259 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4261 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
4263 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
4265 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
4271 ec->changes.need_maximize = 1;
4272 ec->maximized &= ~E_MAXIMIZE_TYPE;
4273 ec->maximized |= max;
4278 if (!ec->fullscreen)
4280 // call the maximize hook of a client
4281 wl_signal_emit_mutable(&PRI(ec)->events.maximize, &max);
4283 // store the E_Maximize value
4284 ec->maximized = max;
4285 ec->changes.need_unmaximize = 0;
4287 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
4291 // store the E_Maximize value
4292 ec->maximized = max;
4293 ec->changes.need_unmaximize = 0;
4298 e_client_unmaximize(E_Client *ec, E_Maximize max)
4301 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4303 if (!(max & E_MAXIMIZE_DIRECTION))
4305 CRI("BUG: Unmaximize call without direction!");
4310 ec->changes.need_unmaximize = 1;
4315 /* Remove directions not used */
4316 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
4317 /* Can only remove existing maximization directions */
4320 if (!ec->fullscreen)
4322 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
4324 // call the unmaximize hook of a client
4325 wl_signal_emit_mutable(&PRI(ec)->events.unmaximize, &max);
4327 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
4330 ec->maximized = E_MAXIMIZE_NONE;
4331 ec->changes.need_unmaximize = 0;
4335 e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
4338 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4340 if (ec->fullscreen) return;
4342 // call the fullscreen_pre hook of a client
4343 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
4344 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
4346 if (ec->skip_fullscreen) return;
4349 ec->need_fullscreen = 1;
4353 ec->saved.layer = ec->layer;
4354 e_client_layer_set(ec, ec->fullscreen_layer);
4358 // call the fullscreen hook of a client
4359 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
4361 ec->fullscreen_policy = policy;
4363 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
4367 e_client_unfullscreen(E_Client *ec)
4370 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4372 ec->need_fullscreen = 0;
4374 if (!ec->fullscreen) return;
4378 E_Fullscreen policy = ec->fullscreen_policy;
4380 // call the unfullscreen hook of a client
4381 wl_signal_emit_mutable(&PRI(ec)->events.unfullscreen, &policy);
4383 e_client_layer_set(ec, ec->saved.layer);
4385 ec->fullscreen_policy = E_FULLSCREEN_RESIZE;
4387 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
4390 ///////////////////////////////////////
4392 e_client_is_parent_iconify_by_client(E_Client *ec)
4394 E_Client *parent = ec->parent;
4395 if (!parent) return EINA_FALSE;
4397 if ((parent->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) ||
4398 (parent->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT))
4405 e_client_iconify(E_Client *ec)
4408 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4410 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4411 Eina_Bool iconified_by_client = e_client_is_iconified_by_client(ec);
4413 ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d",
4414 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4415 ec->exp_iconify.by_client, ec->exp_iconify.type);
4417 if (ec->iconic) return;
4418 if (ec->exp_iconify.skip_iconify && !iconified_by_client) return;
4419 if (ec->exp_iconify.skip_by_remote) return;
4420 if (!cdata || !cdata->mapped)
4422 if (!iconified_by_client)
4424 ELOGF("TZVIS", "Not mapped.. So, don't iconify", ec);
4429 ELOGF("TZVIS", "Not mapped.. But, iconify by user request", ec);
4433 TRACE_DS_BEGIN(CLIENT:ICONIFY);
4435 wl_signal_emit_mutable(&PRI(ec)->events.iconify, NULL);
4436 _e_client_hook_call(E_CLIENT_HOOK_ICONIFY, ec);
4442 e_client_uniconify(E_Client *ec)
4444 E_Comp_Wl_Client_Data *cdata;
4447 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4449 cdata = e_client_cdata_get(ec);
4451 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
4452 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4453 ec->exp_iconify.by_client, ec->exp_iconify.type,
4454 cdata ? cdata->mapped : 0);
4456 if (!ec->iconic) return;
4458 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
4460 // call the uniconify hook of a client
4461 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
4462 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
4468 e_client_iconified_type_set(E_Client *ec, E_Iconified_Type type)
4471 ec->exp_iconify.type = type;
4474 EINTERN E_Iconified_Type
4475 e_client_iconified_type_get(E_Client *ec)
4477 if (!ec) return E_ICONIFIED_TYPE_NONE;
4478 return ec->exp_iconify.type;
4481 E_API Eina_Bool e_client_is_iconified_by_client(E_Client *ec)
4483 if (!ec) return EINA_FALSE;
4485 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT)
4488 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_DESK_ICONIFY_BY_CLIENT)
4491 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
4494 if (ec->exp_iconify.by_client)
4496 ELOGF("POL", "CHECK. mismatch value. by_client:%d, type:%d", ec, ec->exp_iconify.by_client, ec->exp_iconify.type);
4503 ///////////////////////////////////////
4505 EINTERN void e_client_hide_by_request_set(E_Client *ec, Eina_Bool set)
4508 priv->hide_by_request = set;
4511 EINTERN Eina_Bool e_client_hide_by_request_get(E_Client *ec)
4513 API_ENTRY_VAL(EINA_FALSE);
4514 return priv->hide_by_request;
4517 ///////////////////////////////////////
4520 e_client_stick(E_Client *ec)
4523 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4524 if (ec->sticky) return;
4526 // call the stick hook of a client
4527 wl_signal_emit_mutable(&PRI(ec)->events.stick, NULL);
4529 // send the sticky property event of a client
4530 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4534 e_client_unstick(E_Client *ec)
4537 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4539 if (!ec->sticky) return;
4541 // call the unstick hook of a client
4542 wl_signal_emit_mutable(&PRI(ec)->events.unstick, NULL);
4544 // send the sticky property event of a client
4545 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4549 e_client_pinned_set(E_Client *ec, Eina_Bool set)
4553 EINA_SAFETY_ON_NULL_RETURN(ec);
4555 layer = E_LAYER_CLIENT_ABOVE;
4557 layer = E_LAYER_CLIENT_NORMAL;
4559 e_client_layer_set(ec, layer);
4564 ///////////////////////////////////////
4567 e_client_border_set(E_Client *ec, const char *name)
4569 Eina_Stringshare *pborder;
4571 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
4572 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
4573 if (!e_comp_object_frame_allowed(ec->frame)) return EINA_FALSE;
4574 if (ec->border.changed)
4575 CRI("CALLING WHEN border.changed SET!");
4577 if (!e_util_strcmp(ec->border.name, name)) return EINA_TRUE;
4578 pborder = ec->border.name;
4579 ec->border.name = eina_stringshare_add(name);
4580 if (e_comp_object_frame_theme_set(ec->frame, name))
4582 eina_stringshare_del(pborder);
4585 eina_stringshare_del(ec->border.name);
4586 ec->border.name = pborder;
4590 ///////////////////////////////////////
4593 e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
4596 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4599 if (ec->comp_hidden == hidden) return;
4600 ec->comp_hidden = hidden;
4601 evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
4604 ///////////////////////////////////////
4607 e_client_act_move_keyboard(E_Client *ec)
4609 EINA_SAFETY_ON_NULL_RETURN(ec);
4611 if (!_e_client_move_begin(ec))
4614 _e_client_action_init(ec);
4615 _e_client_action_move_timeout_add();
4617 wl_signal_emit_mutable(&PRI(ec)->events.move_update, NULL);
4618 if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
4619 evas_object_freeze_events_set(ec->frame, 1);
4621 if (!action_handler_mouse)
4622 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
4626 e_client_act_resize_keyboard(E_Client *ec)
4628 EINA_SAFETY_ON_NULL_RETURN(ec);
4630 ec->resize_mode = E_POINTER_RESIZE_TL;
4631 ec->keyboard_resizing = 1;
4632 if (!e_client_resize_begin(ec))
4634 ec->keyboard_resizing = 0;
4638 _e_client_action_init(ec);
4639 _e_client_action_resize_timeout_add();
4640 evas_object_freeze_events_set(ec->frame, 1);
4642 if (!action_handler_mouse)
4643 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
4647 e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
4650 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4651 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4656 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4657 _e_client_moveinfo_gather(ec, source);
4659 if (!_e_client_move_begin(ec))
4662 _e_client_action_init(ec);
4666 e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4669 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4670 if (!ec->moving) return;
4671 _e_client_move_end(ec);
4672 _e_client_action_finish();
4676 e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, E_Pointer_Mode resize_mode)
4679 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4680 if (ec->lock_user_size) return;
4681 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4685 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4686 _e_client_moveinfo_gather(ec, source);
4688 if (resize_mode != E_POINTER_RESIZE_NONE)
4690 ec->resize_mode = resize_mode;
4694 /* Use canvas.x, canvas.y of event.
4695 * Transformed coordinates has to be considered for accurate resize_mode
4696 * rather than absolute coordinates. */
4697 if ((ev->canvas.x > (ec->x + ec->w / 5)) &&
4698 (ev->canvas.x < (ec->x + ec->w * 4 / 5)))
4700 if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_T;
4701 else ec->resize_mode = E_POINTER_RESIZE_B;
4703 else if (ev->canvas.x < (ec->x + ec->w / 2))
4705 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;
4706 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TL;
4707 else ec->resize_mode = E_POINTER_RESIZE_BL;
4711 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;
4712 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TR;
4713 else ec->resize_mode = E_POINTER_RESIZE_BR;
4717 if (!e_client_resize_begin(ec))
4719 _e_client_action_init(ec);
4723 e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4726 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4727 if (e_client_util_resizing_get(ec))
4729 _e_client_resize_end(ec);
4730 ec->changes.reset_gravity = 1;
4731 if (!e_object_is_del(E_OBJECT(ec)))
4734 _e_client_action_finish();
4738 e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
4741 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4745 e_client_act_close_begin(E_Client *ec)
4748 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4749 if (ec->lock_close) return;
4750 if (ec->icccm.delete_request)
4752 ec->delete_requested = 1;
4753 evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
4755 else if (e_config->kill_if_close_not_possible)
4757 e_client_act_kill_begin(ec);
4762 e_client_act_kill_begin(E_Client *ec)
4765 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4766 if (ec->internal) return;
4767 if (ec->lock_close) return;
4768 if ((ec->netwm.pid > 1) && (e_config->kill_process))
4770 kill(ec->netwm.pid, SIGINT);
4771 ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
4772 _e_client_cb_kill_timer, ec);
4775 evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
4778 ////////////////////////////////////////////
4781 e_client_ping(E_Client *ec)
4784 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4786 if (!e_config->ping_clients) return;
4788 EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
4791 evas_object_smart_callback_call(ec->frame, "ping", NULL);
4792 ec->ping = ecore_loop_time_get();
4793 if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
4794 ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
4795 e_config->ping_clients_interval,
4796 _e_client_cb_ping_poller, ec);
4799 ////////////////////////////////////////////
4801 e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y)
4803 // TODO: remove(deprecate) this e_client_cursor_map_apply.
4807 e_client_move_cancel(void)
4809 if (!ecmove) return;
4810 if (ecmove->cur_mouse_action)
4815 e_object_ref(E_OBJECT(ec));
4816 if (ec->cur_mouse_action->func.end_mouse)
4817 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4818 else if (ec->cur_mouse_action->func.end)
4819 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4820 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4821 ec->cur_mouse_action = NULL;
4822 e_object_unref(E_OBJECT(ec));
4825 _e_client_move_end(ecmove);
4829 e_client_resize_cancel(void)
4831 if (!ecresize) return;
4832 if (ecresize->cur_mouse_action)
4837 e_object_ref(E_OBJECT(ec));
4838 if (ec->cur_mouse_action->func.end_mouse)
4839 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4840 else if (ec->cur_mouse_action->func.end)
4841 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4842 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4843 ec->cur_mouse_action = NULL;
4844 e_object_unref(E_OBJECT(ec));
4847 _e_client_resize_end(ecresize);
4851 e_client_resize_begin(E_Client *ec)
4853 if ((ec->fullscreen) || (ec->lock_user_size))
4855 if (!_e_client_action_input_win_new()) goto error;
4857 if (ec->manage_resize.enable_aspect_ratio)
4859 ELOGF("RESIZE", "Set resize aspect ratio.. ratio(%dx%d)", ec, ec->w, ec->h);
4860 ec->manage_resize.aw = ec->w;
4861 ec->manage_resize.ah = ec->h - ec->manage_resize.header_h - ec->manage_resize.footer_h;
4864 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
4865 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
4866 if (ec->transformed)
4867 _e_client_transform_resize_begin(ec);
4868 if (!e_client_util_resizing_get(ec))
4870 if (ecresize == ec) ecresize = NULL;
4871 _e_client_action_input_win_del();
4874 if (!ec->lock_user_stacking)
4876 if (e_config->border_raise_on_mouse_action)
4881 e_comp_client_override_add(ec);
4885 ec->resize_mode = E_POINTER_RESIZE_NONE;
4890 ////////////////////////////////////////////
4893 e_client_frame_recalc(E_Client *ec)
4895 EINA_SAFETY_ON_NULL_RETURN(ec);
4896 if (!ec->frame) return;
4897 evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
4900 ////////////////////////////////////////////
4903 e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
4906 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4908 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4909 _e_client_moveinfo_gather(ec, sig);
4910 if (!_e_client_move_begin(ec)) return;
4914 e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4917 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4918 if (!ec->moving) return;
4919 _e_client_move_end(ec);
4923 e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
4925 int resize_mode = E_POINTER_RESIZE_BR;
4928 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4930 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4931 if (!strcmp(dir, "tl"))
4933 resize_mode = E_POINTER_RESIZE_TL;
4935 else if (!strcmp(dir, "t"))
4937 resize_mode = E_POINTER_RESIZE_T;
4939 else if (!strcmp(dir, "tr"))
4941 resize_mode = E_POINTER_RESIZE_TR;
4943 else if (!strcmp(dir, "r"))
4945 resize_mode = E_POINTER_RESIZE_R;
4947 else if (!strcmp(dir, "br"))
4949 resize_mode = E_POINTER_RESIZE_BR;
4951 else if (!strcmp(dir, "b"))
4953 resize_mode = E_POINTER_RESIZE_B;
4955 else if (!strcmp(dir, "bl"))
4957 resize_mode = E_POINTER_RESIZE_BL;
4959 else if (!strcmp(dir, "l"))
4961 resize_mode = E_POINTER_RESIZE_L;
4963 ec->resize_mode = resize_mode;
4964 _e_client_moveinfo_gather(ec, sig);
4965 if (!e_client_resize_begin(ec))
4970 e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4973 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4974 if (!e_client_util_resizing_get(ec)) return;
4975 _e_client_resize_handle(ec);
4976 _e_client_resize_end(ec);
4977 ec->changes.reset_gravity = 1;
4981 ////////////////////////////////////////////
4984 e_client_resize_limit(E_Client *ec, int *w, int *h)
4987 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4990 e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
4994 if ((ec->icccm.max_w > 0) && (*w > ec->icccm.max_w)) *w = ec->icccm.max_w;
4995 else if (*w < ec->icccm.min_w)
4996 *w = ec->icccm.min_w;
4997 if ((ec->icccm.max_h > 0) && (*h > ec->icccm.max_h)) *h = ec->icccm.max_h;
4998 else if (*h < ec->icccm.min_h)
4999 *h = ec->icccm.min_h;
5002 e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
5005 ////////////////////////////////////////////
5010 e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
5014 /* We need to ensure that we can get the comp window for the
5015 * zone of either the given desk or the desk of the excluded
5016 * window, so return if neither is given */
5018 e_input_device_pointer_xy_get(NULL, &x, &y);
5020 e_input_device_pointer_xy_get(NULL, &x, &y);
5026 desk = exclude->desk;
5030 desk = e_desk_current_get(exclude->zone);
5032 desk = e_desk_current_get(e_zone_current_get());
5036 return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
5039 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
5041 if (!desk) return NULL;
5043 return _e_client_under_pointer_helper(desk, exclude, x, y);
5046 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
5048 if (!desk) return NULL;
5050 return _e_client_under_pointer_input_helper(desk, x, y);
5053 ////////////////////////////////////////////
5055 ////////////////////////////////////////////
5058 e_client_redirected_set(E_Client *ec, Eina_Bool set)
5060 EINA_SAFETY_ON_NULL_RETURN(ec);
5061 if (ec->input_only) return;
5063 if (ec->redirected == set) return;
5066 e_client_frame_recalc(ec);
5068 wl_signal_emit_mutable(&PRI(ec)->events.redirect, NULL);
5069 if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
5073 wl_signal_emit_mutable(&PRI(ec)->events.unredirect, NULL);
5074 if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
5076 e_comp_object_redirected_set(ec->frame, set);
5077 ec->redirected = !!set;
5080 ////////////////////////////////////////////
5083 e_client_transform_update(E_Client *ec)
5085 if (e_client_util_resizing_get(ec))
5086 _e_client_transform_resize(ec);
5089 ////////////////////////////////////////////
5092 e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy)
5095 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5099 if (e_comp_wl_subsurface_check(ec))
5102 /* check if it's different with current state */
5103 if ((ec->transform.angle == angle) &&
5104 (ec->transform.zoom == zoom) &&
5105 (ec->transform.center.x == cx) &&
5106 (ec->transform.center.y == cy))
5109 /* use previous value if any required value is invalid */
5111 angle = ec->transform.angle;
5113 zoom = ec->transform.zoom;
5114 if (!E_INSIDE(cx, cy,
5115 ec->client.x, ec->client.y,
5116 ec->client.w, ec->client.h))
5118 cx = ec->transform.center.x;
5119 cy = ec->transform.center.y;
5122 if ((angle == 0) && (zoom == 1.0))
5124 e_client_transform_clear(ec);
5128 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
5129 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
5131 e_map_util_rotate(map, angle, cx, cy);
5132 _e_client_transform_geometry_save(ec, map);
5134 e_map_util_zoom(map, zoom, zoom, cx, cy);
5136 e_map_util_object_move_sync_set(map, EINA_TRUE);
5137 e_client_map_set(ec, map);
5138 e_client_map_enable_set(ec, EINA_TRUE);
5140 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5141 _e_client_transform_sub_apply(subc, ec, zoom);
5142 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5143 _e_client_transform_sub_apply(subc, ec, zoom);
5147 ec->transform.zoom = zoom;
5148 ec->transform.angle = angle;
5149 ec->transform.center.x = cx;
5150 ec->transform.center.y = cy;
5151 ec->transformed = EINA_TRUE;
5154 ////////////////////////////////////////////
5157 e_client_transform_clear(E_Client *ec)
5159 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5163 e_client_map_enable_set(ec, EINA_FALSE);
5164 e_client_map_set(ec, NULL);
5166 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5167 _e_client_transform_sub_apply(subc, ec, 1.0);
5168 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5169 _e_client_transform_sub_apply(subc, ec, 1.0);
5171 ec->transform.zoom = 1.0;
5172 ec->transform.angle = 0.0;
5173 ec->transformed = EINA_FALSE;
5177 e_client_transform_core_enable_get(E_Client *ec)
5179 if (!ec) return EINA_FALSE;
5180 return ec->transform_core.result.enable;
5184 e_client_transform_core_add(E_Client *ec, E_Util_Transform *transform)
5187 if (!transform) return;
5189 // duplication check
5190 if (ec->transform_core.transform_list &&
5191 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5196 ec->transform_core.transform_list = eina_list_append(ec->transform_core.transform_list, transform);
5197 ec->transform_core.changed = EINA_TRUE;
5198 e_util_transform_ref(transform);
5199 // e_client_transform_core_update(ec);
5203 e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform)
5206 if (!transform) return;
5208 if (ec->transform_core.transform_list &&
5209 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5211 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
5212 e_util_transform_unref(transform);
5213 ec->transform_core.changed = EINA_TRUE;
5216 e_client_transform_core_update(ec);
5220 e_client_transform_core_update(E_Client *ec)
5223 if (ec->new_client) return;
5224 if (!_e_client_transform_core_check_change(ec)) return;
5226 if (ec->transform_core.transform_list || ec->transform_core.parent.enable)
5228 E_Util_Transform_Rect source_rect;
5229 E_Util_Transform_Matrix matrix, boundary_matrix;
5230 E_Util_Transform_Zoom zoom;
5232 Eina_Bool background;
5233 E_Util_Transform *temp_trans;
5236 ec->transform_core.result.enable = EINA_TRUE;
5237 e_util_transform_rect_client_rect_get(&source_rect, ec);
5238 e_util_transform_init(&ec->transform_core.result.transform);
5240 // 2. merge transform
5241 EINA_LIST_FOREACH(ec->transform_core.transform_list, l, temp_trans)
5243 e_util_transform_merge(&ec->transform_core.result.transform, temp_trans);
5245 zoom = ec->transform_core.result.transform.zoom;
5247 // 2.5 check viewport
5248 if (e_util_transform_viewport_flag_get(&ec->transform_core.result.transform))
5250 int vx = 0, vy = 0, vw = 0, vh = 0;
5251 e_util_transform_viewport_get(&ec->transform_core.result.transform, &vx, &vy, &vw, &vh);
5252 e_util_transform_rect_init(&source_rect, vx, vy, vw, vh);
5255 // 3. apply background transform
5256 matrix = e_util_transform_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5258 if (e_util_transform_bg_transform_flag_get(&ec->transform_core.result.transform))
5260 boundary_matrix = e_util_transform_bg_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5261 background = EINA_TRUE;
5265 background = EINA_FALSE;
5266 boundary_matrix = matrix;
5269 if (background != ec->transform_core.background)
5273 e_comp_object_transform_bg_set(ec->frame, EINA_TRUE);
5277 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5280 ec->transform_core.background = background;
5283 // 3.1 if 24bit window then set transp rect
5288 e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle);
5291 if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect
5292 e_comp_object_transform_transp_set(ec->frame, EINA_TRUE);
5294 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5297 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5299 // 3.5 parent matrix multiply
5300 if (ec->transform_core.parent.enable)
5302 matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5304 boundary_matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5307 ec->transform_core.result.transform.use_zoom = EINA_TRUE;
5308 zoom.zoom_x *= ec->transform_core.parent.zoom.zoom_x;
5309 zoom.zoom_y *= ec->transform_core.parent.zoom.zoom_y;
5310 zoom.cx += ec->transform_core.parent.zoom.cx;
5311 zoom.cy += ec->transform_core.parent.zoom.cy;
5314 // 4. apply matrix to vertices
5315 ec->transform_core.result.matrix = matrix;
5316 ec->transform_core.result.inv_matrix = e_util_transform_matrix_inverse_get(&matrix);
5317 ec->transform_core.result.vertices = e_util_transform_rect_to_vertices(&source_rect);
5318 ec->transform_core.result.boundary.vertices = e_util_transform_rect_to_vertices(&source_rect);
5319 ec->transform_core.result.vertices = e_util_transform_matrix_multiply_rect_vertex(&matrix,
5320 &ec->transform_core.result.vertices);
5321 ec->transform_core.result.boundary.vertices = e_util_transform_matrix_multiply_rect_vertex(&boundary_matrix,
5322 &ec->transform_core.result.boundary.vertices);
5323 ec->transform_core.result.transform.zoom = zoom;
5325 // 5. apply vertices
5326 if (ec->transform_core.result.transform.use_zoom)
5328 // TODO: apply zoom values to vertices
5329 e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices,
5330 ec->transform_core.result.transform.zoom);
5331 e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices,
5332 ec->transform_core.result.transform.zoom);
5333 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5334 _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform,
5335 ec->transform_core.result.transform.zoom);
5339 e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices);
5340 e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices);
5341 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5342 _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform);
5345 // 6. subsurface update
5346 _e_client_transform_core_sub_update(ec, &ec->transform_core.result.vertices);
5348 if (!e_object_is_del(E_OBJECT(ec)))
5350 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5351 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5356 if (ec->transform_core.result.enable)
5358 ec->transform_core.result.enable = EINA_FALSE;
5359 _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL);
5360 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5361 ec->transform_core.background = EINA_FALSE;
5362 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5363 _e_client_transform_core_sub_update(ec, NULL);
5365 if (!e_object_is_del(E_OBJECT(ec)))
5367 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5368 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5373 e_comp_visibility_calculation_set(EINA_TRUE);
5377 e_client_transform_core_transform_count_get(E_Client *ec)
5380 if (!ec->transform_core.transform_list) return 0;
5381 return eina_list_count(ec->transform_core.transform_list);
5384 E_API E_Util_Transform*
5385 e_client_transform_core_transform_get(E_Client *ec, int index)
5387 if (!ec) return NULL;
5388 if (!ec->transform_core.transform_list) return NULL;
5389 if (index < 0 || index >= e_client_transform_core_transform_count_get(ec))
5392 return (E_Util_Transform*)eina_list_nth(ec->transform_core.transform_list, index);
5396 e_client_transform_core_input_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5398 E_Util_Transform_Vertex vertex, result_vertex;
5401 if (!e_client_transform_core_enable_get(ec)) return;
5403 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5405 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.inv_matrix, &vertex);
5406 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5410 e_client_transform_core_input_inv_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5412 E_Util_Transform_Vertex vertex, result_vertex;
5415 if (!e_client_transform_core_enable_get(ec)) return;
5417 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5419 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.matrix, &vertex);
5420 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5424 e_client_transform_core_input_inv_rect_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5428 if (!e_client_transform_core_enable_get(ec)) return;
5429 e_client_geometry_get(ec, NULL, NULL, &gw, &gh);
5431 e_util_transform_matrix_inv_rect_coords_get(&ec->transform_core.result.transform,
5432 &ec->transform_core.result.vertices,
5434 x, y, out_x, out_y);
5438 e_client_transform_core_direct_render_set(E_Client *ec, Eina_Bool set)
5440 EINA_SAFETY_ON_NULL_RETURN(ec);
5442 if (ec->transform_core.direct_render == set) return;
5444 ec->transform_core.direct_render = set;
5445 ec->transform_core.changed = EINA_TRUE;
5447 e_client_transform_core_update(ec);
5451 e_client_pixmap_change(E_Client *ec, E_Pixmap *newcp)
5453 E_Pixmap_Type oldtype, newtype;
5456 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
5457 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->pixmap, NULL);
5458 EINA_SAFETY_ON_NULL_RETURN_VAL(newcp, NULL);
5462 oldtype = e_pixmap_type_get(oldcp);
5463 if (oldtype >= E_PIXMAP_TYPE_MAX) return NULL;
5465 newtype = e_pixmap_type_get(newcp);
5466 if (newtype >= E_PIXMAP_TYPE_MAX) return NULL;
5468 if (eina_hash_find(clients_hash[oldtype], &oldcp))
5469 eina_hash_del_by_key(clients_hash[oldtype], &oldcp);
5470 e_pixmap_client_set(oldcp, NULL);
5473 e_pixmap_client_set(newcp, ec);
5475 eina_hash_add(clients_hash[newtype], &newcp, ec);
5481 e_client_window_role_set(E_Client *ec, const char *role)
5483 EINA_SAFETY_ON_NULL_RETURN(ec);
5485 if (eina_stringshare_replace(&ec->icccm.window_role, role))
5487 wl_signal_emit_mutable(&PRI(ec)->events.window_role_change, NULL);
5488 _e_client_hook_call(E_CLIENT_HOOK_WINDOW_ROLE_CHANGE, ec);
5493 e_client_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5497 res = e_comp_wl_key_send(ec, keycode, pressed, dev, time);
5503 e_client_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, unsigned int time)
5507 res = e_comp_wl_key_cancel(ec, keycode, dev, time);
5513 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)
5517 res = e_comp_wl_touch_send(ec, idx, x, y, pressed, dev, radius_x, radius_y, pressure, angle, time);
5523 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)
5527 res = e_comp_wl_touch_update_send(ec, idx, x, y, dev, radius_x, radius_y, pressure, angle, time);
5533 e_client_touch_cancel_send(E_Client *ec)
5537 res = e_comp_wl_touch_cancel_send(ec);
5543 e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5547 res = e_comp_wl_mouse_button_send(ec, buttons, pressed, dev, time);
5553 e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5557 res = e_comp_wl_mouse_move_send(ec, x, y, dev, time);
5563 e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time)
5567 res = e_comp_wl_mouse_wheel_send(ec, direction, z, dev, time);
5573 e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5577 res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
5583 e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
5587 res = e_comp_wl_mouse_out_send(ec, dev, time);
5593 e_client_video_client_has(E_Client *ec)
5595 return e_comp_wl_video_subsurface_has(ec);
5599 e_client_normal_client_has(E_Client *ec)
5601 return e_comp_wl_normal_subsurface_has(ec);
5605 e_client_cursor_hide(E_Client *ec)
5607 return e_comp_wl_cursor_hide(ec);
5611 e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
5615 ELOGF("TZVIS", "VIS_FORCE_OBSCURED :%d", ec, set);
5617 ec->visibility.force_obscured = set;
5618 e_comp_visibility_calculation_set(EINA_TRUE);
5621 EINTERN E_Capture_Save_State
5622 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)
5624 return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
5628 _e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *subc)
5630 E_Client *ec, *parent;
5636 ec->base_output_resolution.use = 0;
5637 ec->base_output_resolution.w = 0;
5638 ec->base_output_resolution.h = 0;
5639 if (ec->base_output_resolution.transform)
5641 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
5642 E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
5643 ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
5646 /* Update transform for toplevel surface.
5647 * The transform of subsurface will be updated by its parent accordingly. */
5648 parent = e_comp_wl_topmost_parent_get(ec);
5651 parent->transform_core.changed = EINA_TRUE;
5652 e_client_transform_core_update(parent);
5655 /* TODO: Do we need to apply it again if subsurface is destroyed? */
5659 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
5662 ec->base_output_resolution.use = 1;
5663 ec->base_output_resolution.w = width;
5664 ec->base_output_resolution.h = height;
5665 ec->base_output_resolution.transform = e_util_transform_new();
5666 e_util_transform_role_set(ec->base_output_resolution.transform, "base_output_resolution");
5667 e_client_transform_core_add(ec, ec->base_output_resolution.transform);
5669 if (!ec->base_output_resolution.hook_subsurf_create)
5671 ec->base_output_resolution.hook_subsurf_create =
5672 e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
5673 _e_client_base_output_resolution_hook_subsurf_create,
5679 e_client_base_output_resolution_transform_adjust(E_Client *ec)
5683 EINA_SAFETY_ON_NULL_RETURN(ec);
5684 if (!ec->base_output_resolution.use) return;
5685 if (!ec->base_output_resolution.transform) return;
5687 desk = e_comp_desk_find_by_ec(ec);
5688 EINA_SAFETY_ON_NULL_RETURN(desk);
5690 ELOGF("POL_APPINFO", "Apply TRANSFORM... desk:(%dx%d), ec:(%dx%d)",
5691 ec, desk->geom.w, desk->geom.h, ec->w, ec->h);
5693 e_util_transform_scale(ec->base_output_resolution.transform,
5694 (double)desk->geom.w /(double)ec->base_output_resolution.w,
5695 (double)desk->geom.h /(double)ec->base_output_resolution.h,
5697 e_client_transform_core_update(ec);
5701 e_client_base_output_resolution_update(E_Client *ec)
5703 E_Appinfo *eai = NULL;
5704 int configured_width, configured_height;
5708 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
5710 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5711 if (ec->base_output_resolution.use) return EINA_TRUE;
5713 /* Check whether it's subsurface or not
5714 * The resolution of subsurface will follow the resolution of its toplevel surface.
5715 * Transform for subsurface will be applied when toplevel surface does by
5716 * implementation of e_client_transform_core.
5718 if (e_comp_wl_subsurface_check(ec))
5721 desk = e_comp_desk_find_by_ec(ec);
5722 EINA_SAFETY_ON_NULL_RETURN_VAL(desk, EINA_FALSE);
5724 configured_width = e_config->configured_output_resolution.w;
5725 configured_height = e_config->configured_output_resolution.h;
5729 ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec,
5730 configured_width, configured_height, ec->netwm.pid);
5731 goto use_configured;
5734 eai = e_appinfo_find_with_pid(ec->netwm.pid);
5737 ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec,
5738 configured_width, configured_height, ec->netwm.pid);
5739 goto use_configured;
5742 if (!e_appinfo_base_output_resolution_available_get(eai))
5744 ELOGF("POL_APPINFO", "NO AVAILABLE BASE SCREEN RESOLUTION... QUERY base_output_resolution", ec);
5745 e_policy_base_output_resolution_info_update(ec->netwm.pid);
5748 if (!e_appinfo_base_output_resolution_get(eai, &width, &height))
5750 ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec,
5751 configured_width, configured_height, ec->netwm.pid);
5752 goto use_configured;
5755 if ((width == 0) && (height == 0))
5757 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution size:(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5761 if ((desk->geom.w == width) && (desk->geom.h == height))
5763 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);
5767 /* set the base_output_resolution of the e_client */
5768 _e_client_base_output_resolution_set(ec, width, height);
5770 ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5776 if ((desk->geom.w == configured_width) && (desk->geom.h == configured_height))
5778 ELOGF("POL_APPINFO", "SKIP use configured_output_resolution (same with desk size:(%d,%d), pid:%d)", ec, configured_width, configured_height, ec->netwm.pid);
5782 /* set the base_output_resolution of the e_client as a default */
5783 _e_client_base_output_resolution_set(ec, configured_width, configured_height);
5790 e_client_base_output_resolution_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5795 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5797 zone = e_comp_zone_find_by_ec(ec);
5798 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5800 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
5807 if (ec->base_output_resolution.use)
5809 if (w) *w = ec->base_output_resolution.w;
5810 if (h) *h = ec->base_output_resolution.h;
5817 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)
5822 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5824 zone = e_comp_zone_find_by_ec(ec);
5825 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5827 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, consider_obstacle_area);
5834 if (ec->base_output_resolution.use)
5836 // TODO: Consider obstacle area
5837 if (w) *w = ec->base_output_resolution.w;
5838 if (h) *h = ec->base_output_resolution.h;
5844 /* change the base_output_resolution of the bind_ec by checking the base_output_resolution of provider_ec's appinfo */
5846 e_client_base_output_resolution_rsm_update(E_Client *bind_ec, E_Client *provider_ec)
5848 E_Appinfo *epai = NULL;
5849 int configured_width, configured_height;
5851 E_Desk *bind_ec_desk;
5853 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec, EINA_FALSE);
5854 EINA_SAFETY_ON_NULL_RETURN_VAL(provider_ec, EINA_FALSE);
5856 bind_ec_desk = e_comp_desk_find_by_ec(bind_ec);
5857 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec_desk, EINA_FALSE);
5859 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5861 configured_width = e_config->configured_output_resolution.w;
5862 configured_height = e_config->configured_output_resolution.h;
5864 if (bind_ec->base_output_resolution.use)
5866 ELOGF("POL_APPINFO", "DELETE EXISTED BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5867 bind_ec->base_output_resolution.w, bind_ec->base_output_resolution.h, bind_ec->netwm.pid);
5869 bind_ec->base_output_resolution.use = 0;
5870 bind_ec->base_output_resolution.w = 0;
5871 bind_ec->base_output_resolution.h = 0;
5872 e_client_transform_core_remove(bind_ec, bind_ec->base_output_resolution.transform);
5873 E_FREE_FUNC(bind_ec->base_output_resolution.transform, e_util_transform_del);
5876 if (!provider_ec->netwm.pid)
5878 ELOGF("POL_APPINFO", "NO PROVIDER PID... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5879 configured_width, configured_height, provider_ec->netwm.pid);
5880 goto use_configured;
5883 epai = e_appinfo_find_with_pid(provider_ec->netwm.pid);
5886 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5887 configured_width, configured_height, provider_ec->netwm.pid);
5888 goto use_configured;
5891 if (!e_appinfo_base_output_resolution_get(epai, &width, &height))
5893 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5894 configured_width, configured_height, provider_ec->netwm.pid);
5895 goto use_configured;
5898 if ((width == 0) && (height == 0))
5900 ELOGF("POL_APPINFO", "NO PROVIDER WIDTH and HEIGHT... SKIP base_output_resolution due to size:(%d,%d) provider_pid:%d", provider_ec,
5901 width, height, provider_ec->netwm.pid);
5905 if ((bind_ec_desk->geom.w == width) && (bind_ec_desk->geom.h == height))
5907 ELOGF("POL_APPINFO", "SKIP SET BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5908 width, height, bind_ec->netwm.pid);
5912 /* set the base_output_resolution of the e_client */
5913 _e_client_base_output_resolution_set(bind_ec, width, height);
5914 e_client_base_output_resolution_transform_adjust(bind_ec);
5916 ELOGF("POL_APPINFO", "USE BINDER base_output_resolution(%d,%d) bind_pid:%d", bind_ec, width, height, bind_ec->netwm.pid);
5922 if ((bind_ec_desk->geom.w == configured_width) && (bind_ec_desk->geom.h == configured_height))
5924 ELOGF("POL_APPINFO", "SKIP BINDER use configured_output_resolution (same with desk size:(%d,%d), bind_pid:%d)", bind_ec,
5925 configured_width, configured_height, bind_ec->netwm.pid);
5929 /* set the base_output_resolution of the e_client as a default */
5930 _e_client_base_output_resolution_set(bind_ec, configured_width, configured_height);
5936 /* tizen_move_resize */
5938 e_client_pending_geometry_has(E_Client *ec)
5940 if (!eina_list_count(ec->surface_sync.pending_geometry))
5943 return ec->surface_sync.wait_commit;
5947 e_client_pending_geometry_flush(E_Client *ec)
5949 E_Client_Pending_Geometry *geo;
5951 if (!eina_list_count(ec->surface_sync.pending_geometry))
5953 EINA_LIST_FREE(ec->surface_sync.pending_geometry, geo)
5957 ec->surface_sync.wait_commit = EINA_FALSE;
5958 ELOGF("POSSIZE", "pending geometry has flushed", ec);
5963 e_client_pending_geometry_last_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5966 E_Client_Pending_Geometry *geo;
5972 EINA_LIST_REVERSE_FOREACH(ec->surface_sync.pending_geometry, l, geo)
5988 e_client_frame_focus_set(E_Client *ec, Eina_Bool focus)
5991 evas_object_focus_set(ec->frame, focus);
5995 e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h)
5999 if (ec->internal || ec->input_only)
6001 evas_object_geometry_set(ec->frame, x, y, w, h);
6005 if ((ec->w != w) || (ec->h != h))
6007 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);
6008 ec->move_after_resize = EINA_TRUE;
6010 e_client_pos_set(ec, x, y);
6011 evas_object_resize(ec->frame, w, h);
6014 evas_object_geometry_set(ec->frame, x, y, w, h);
6019 e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
6023 if (ec->internal || ec->input_only)
6025 e_client_util_move_without_frame(ec, x, y);
6026 e_client_util_resize_without_frame(ec, w, h);
6030 if ((ec->w != w) || (ec->h != h))
6032 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);
6033 ec->move_after_resize = EINA_TRUE;
6035 e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
6036 e_client_pos_set(ec, x, y);
6037 e_client_util_resize_without_frame(ec, w, h);
6041 e_client_util_move_without_frame(ec, x, y);
6042 e_client_util_resize_without_frame(ec, w, h);
6048 e_client_layer_set(E_Client *ec,
6051 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6052 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6053 if (!ec->frame) return EINA_FALSE;
6055 if (e_comp_canvas_client_layer_map(layer) == 9999)
6056 return EINA_FALSE; //invalid layer is not allowed
6058 #ifdef REFACTOR_DESK_AREA
6060 if (ec->desk_area.enable)
6062 if (e_client_layer_set_by_desk_area(ec, layer))
6064 // restack according to desk group rule
6065 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6069 ec->desk_area.layer_backup = layer;
6072 evas_object_layer_set(ec->frame, layer);
6073 if (ec->layer != layer)
6075 /* check exceptional case */
6076 if ((ec->fullscreen) &&
6077 (ec->saved.layer != layer))
6079 ELOGF("LAYER", "(%d) fail to backup at saved.layer for fullscreen", ec, layer);
6082 // if e_comp_object fail to change ec->layer due to ec->layer_pending or block
6083 // leave log and apply ec->layer according to set
6084 // as a result it restores back to given layer when pending or block is free
6085 ELOGF("LAYER", "change layer from %d to %d if in case layer pending(%d) or block(%d)",
6086 ec, ec->layer, layer, ec->layer_pending, ec->layer_block);
6087 if (ec->layer_pending || ec->layer_block)
6094 wl_signal_emit_mutable(&PRI(ec)->events.set_layer, NULL);
6100 e_client_layer_get(E_Client *ec)
6104 E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM);
6105 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM);
6106 if (!ec->frame) return E_LAYER_BOTTOM;
6108 layer = evas_object_layer_get(ec->frame);
6109 if (ec->layer != layer)
6111 /* client could be on temperory layer while pending or block,
6112 * in that case, client restores back to ec->layer after pending/block finish */
6113 if (ec->layer_block || ec->layer_pending)
6116 /* otherwise, client is on unexpected layer */
6117 ELOGF("LAYER", "layer dismatch ec->layer %d | evas obj layer %d ",
6118 ec, ec->layer, layer);
6120 if (e_comp_canvas_client_layer_map(layer) == 9999)
6121 return E_LAYER_BOTTOM; //not on E_LAYER_CLIENT
6127 #ifdef REFACTOR_DESK_AREA
6130 _e_client_desk_area_original_layer_save(E_Client *ec, E_Layer layer)
6133 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6134 ec->desk_area.layer_backup = layer;
6138 e_client_layer_set_by_desk_area(E_Client *ec, E_Layer layer)
6144 if (!ec) return EINA_FALSE;
6145 if (!ec->frame) return EINA_FALSE;
6146 if (!ec->desk_area.enable) return EINA_FALSE;
6147 if (!ec->desk_area.desk_area) return EINA_FALSE;
6149 eda = ec->desk_area.desk_area;
6151 // save original layer
6152 _e_client_desk_area_original_layer_save(ec, layer);
6154 // get desk_area layer
6155 edg_layer = (E_Layer)e_desk_area_layer_get(eda);
6156 org_layer = e_client_desk_area_original_layer_get(ec);
6158 ELOGF("EDG", "layer_set by desk_area... layer:%d, org_layer:%d, new_layer:%d", ec, layer, org_layer, edg_layer);
6159 if (org_layer == edg_layer)
6165 evas_object_layer_set(ec->frame, edg_layer);
6166 if (edg_layer == ec->layer)
6174 e_client_desk_area_original_layer_restore(E_Client *ec)
6178 // Do we need to check ec->desk_area.enable?
6179 // if ec->desk_area.enable is true, then e_client_layer_set calls
6180 // e_desk_area_ec_edg_layer_set(). that's too bad. :(
6181 // so, we MUST make a policy for ordering of the desk group layer restore
6182 // and the desk group enable.
6183 if (ec->desk_area.enable) return;
6184 e_client_layer_set(ec, ec->desk_area.layer_backup);
6188 e_client_desk_area_original_layer_get(E_Client *ec)
6190 if (!ec) return E_LAYER_DESKTOP;
6192 if (ec->desk_area.enable)
6193 return ec->desk_area.layer_backup;
6199 e_client_desk_area_client_layer_set(E_Client *ec, E_Desk_Area_Client_Layer edgc_layer)
6201 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6202 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6203 if ((edgc_layer < E_DESK_AREA_CLIENT_LAYER_DESKTOP) ||
6204 (edgc_layer >= E_DESK_AREA_CLIENT_LAYER_MAX))
6207 ec->desk_area.edgc_layer = edgc_layer;
6211 EINTERN E_Desk_Area_Client_Layer
6212 e_client_desk_area_client_layer_get(E_Client *ec)
6214 E_OBJECT_CHECK_RETURN(ec, E_DESK_AREA_CLIENT_LAYER_DESKTOP);
6216 return ec->desk_area.edgc_layer;
6219 //FIXME: use e_desk_area_ec_reassign(eda, ec) instead of this api
6221 e_client_desk_area_set(E_Client *ec, E_Desk_Area *eda)
6223 E_Desk_Area *old_edg;
6225 if (!ec) return EINA_FALSE;
6227 #if 0 // if this is removed.. then below if (eda != old_edg) is removed also...
6228 if (ec->desk_area.desk_area == eda)
6232 ELOGF("EDG", "Desk Group Set (new:%p, old:%p)", ec, eda, ec->desk_area.desk_area);
6233 old_edg = ec->desk_area.desk_area;
6235 e_desk_area_ec_remove(old_edg, ec);
6237 ec->desk_area.desk_area = eda;
6238 e_desk_area_ec_add(eda, ec);
6240 #if 0 // if this is removed.. then above if (ec->desk_area.desk_area == eda) is removed also...
6244 e_desk_area_ec_update(eda, ec);
6245 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6253 _raise_between_sibling_under_parent(E_Client *ec)
6255 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);
6256 e_client_stack_below(ec, ec->parent);
6260 _raise_between_sibling_on_parent(E_Client *ec)
6262 E_Client *top_child = NULL;
6263 top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
6266 ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
6267 e_client_stack_above(ec, ec->parent);
6271 if (top_child != ec)
6273 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);
6274 e_client_stack_above(ec, top_child);
6277 ELOGF("POL", "RAISE child window between sibling... already on the top. STAY", ec);
6282 _raise_belong_to_parent(E_Client *ec)
6284 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6285 _raise_between_sibling_under_parent(ec);
6287 _raise_between_sibling_on_parent(ec);
6291 e_client_raise(E_Client *ec)
6295 #ifdef REFACTOR_DESK_AREA
6297 if (ec->desk_area.enable)
6300 eda = ec->desk_area.desk_area;
6303 e_desk_area_ec_raise(eda, ec);
6309 if (ec->parent && e_client_is_belong_to_parent(ec))
6310 _raise_belong_to_parent(ec);
6312 evas_object_raise(ec->frame);
6314 wl_signal_emit_mutable(&PRI(ec)->events.raise, NULL);
6318 _e_client_transient_for_below_group_make(E_Client *ec, Eina_List **list)
6320 // list : Head is the bottommost child
6326 EINA_LIST_REVERSE_FOREACH(ec->transients, l, child)
6328 if (!child) continue;
6329 if (e_client_transient_policy_get(child) != E_TRANSIENT_BELOW) continue;
6330 if (!e_client_is_belong_to_parent(child)) continue;
6332 *list = eina_list_prepend(*list, child);
6333 _e_client_transient_for_group_make(child, list);
6338 e_client_transient_child_bottom_get(E_Client *ec)
6340 E_Client *bottom_ec = NULL;
6341 Eina_List *transient_below_list = NULL;
6342 Eina_List *l = NULL;
6344 _e_client_transient_for_below_group_make(ec, &transient_below_list);
6346 if (transient_below_list)
6348 E_Client *temp_ec = NULL;
6349 E_Client *temp_ec2 = NULL;
6351 E_CLIENT_FOREACH(temp_ec)
6353 if (bottom_ec) break;
6361 EINA_LIST_FOREACH(transient_below_list, l, temp_ec2)
6363 if (temp_ec == temp_ec2)
6365 bottom_ec = temp_ec2;
6370 eina_list_free(transient_below_list);
6376 _lower_between_sibling_under_parent(E_Client *ec)
6378 E_Client *bottom_child = NULL;
6379 bottom_child = e_client_transient_child_bottom_get(ec->parent);
6382 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);
6383 e_client_stack_below(ec, ec->parent);
6387 if (bottom_child != ec)
6389 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);
6390 e_client_stack_below(ec, bottom_child);
6393 ELOGF("POL", "LOWER child window between sibling... already under the bottom. STAY", ec);
6398 _lower_between_sibling_on_parent(E_Client *ec)
6400 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);
6401 e_client_stack_above(ec, ec->parent);
6405 _lower_belong_to_parent(E_Client *ec)
6407 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6408 _lower_between_sibling_under_parent(ec);
6410 _lower_between_sibling_on_parent(ec);
6414 e_client_lower(E_Client *ec)
6418 #ifdef REFACTOR_DESK_AREA
6420 if (ec->desk_area.enable)
6423 eda = ec->desk_area.desk_area;
6426 e_desk_area_ec_lower(eda, ec);
6428 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6434 if (ec->parent && e_client_is_belong_to_parent(ec))
6435 _lower_belong_to_parent(ec);
6437 evas_object_lower(ec->frame);
6439 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6443 e_client_stack_above(E_Client *ec, E_Client *above)
6446 if (!ec->frame) return;
6448 if (!above->frame) return;
6450 #ifdef REFACTOR_DESK_AREA
6452 if (ec->desk_area.enable)
6455 eda = ec->desk_area.desk_area;
6458 e_desk_area_ec_stack_above(eda, ec, above);
6464 evas_object_stack_above(ec->frame, above->frame);
6466 wl_signal_emit_mutable(&PRI(ec)->events.stack_above, NULL);
6470 e_client_stack_below(E_Client *ec, E_Client *below)
6473 if (!ec->frame) return;
6475 if (!below->frame) return;
6477 #ifdef REFACTOR_DESK_AREA
6479 if (ec->desk_area.enable)
6482 eda = ec->desk_area.desk_area;
6485 e_desk_area_ec_stack_below(eda, ec, below);
6491 evas_object_stack_below(ec->frame, below->frame);
6493 wl_signal_emit_mutable(&PRI(ec)->events.stack_below, NULL);
6497 e_client_show_pending_set(E_Client *ec)
6501 ec->show_pending.count++;
6502 ELOGF("E_CLIENT", "SET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6503 return ec->show_pending.count;
6507 e_client_show_pending_unset(E_Client *ec)
6510 if (ec->show_pending.count <= 0) return 0;
6512 ec->show_pending.count--;
6513 ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6514 if (ec->show_pending.count == 0 && ec->show_pending.running)
6516 ec->show_pending.running = EINA_FALSE;
6519 ELOGF("E_CLIENT", "evas_object_show by unset show_pending", ec);
6520 evas_object_show(ec->frame);
6521 //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
6526 return ec->show_pending.count;
6530 _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6534 Eina_Bool res = EINA_TRUE;
6535 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6540 EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc)
6542 res = _e_client_surface_tree_foreach_helper(subc, func, data);
6549 res = func(data, ec);
6552 EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc)
6554 res = _e_client_surface_tree_foreach_helper(subc,
6567 e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6569 EINA_SAFETY_ON_NULL_RETURN(ec);
6570 EINA_SAFETY_ON_NULL_RETURN(func);
6572 _e_client_surface_tree_foreach_helper(ec, func, data);
6575 EINTERN E_Comp_Wl_Client_Data *
6576 e_client_cdata_new(E_Client *ec)
6578 E_Comp_Wl_Client_Data *cdata;
6580 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6582 if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1)))
6584 ERR("Could not allocate new E_Comp_Wl_Client_Data structure");
6587 ec->comp_data = cdata;
6593 e_client_cdata_free(E_Client *ec)
6595 EINA_SAFETY_ON_NULL_RETURN(ec);
6596 if (!ec->comp_data) return;
6598 E_FREE(ec->comp_data);
6601 EINTERN E_Comp_Wl_Client_Data *
6602 e_client_cdata_get(E_Client *ec)
6604 if (!ec) return NULL;
6606 return ec->comp_data;
6610 e_client_map_set(E_Client *ec, E_Map *em)
6612 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6614 return e_map_set_to_comp_object(em, ec->frame);
6618 e_client_map_get(const E_Client *ec)
6620 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6622 return e_map_get_from_comp_object(ec->frame);
6626 e_client_map_enable_set(E_Client *ec, Eina_Bool enable)
6628 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6629 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE);
6631 evas_object_map_enable_set(ec->frame, enable);
6637 e_client_belong_to_parent_set(E_Client *ec, Eina_Bool set)
6640 ec->belong_to_parent = set;
6644 e_client_is_belong_to_parent(E_Client *ec)
6646 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6647 return ec->belong_to_parent;
6651 e_client_transient_policy_set(E_Client *ec, E_Transient policy)
6654 ec->transient_policy = policy;
6658 e_client_transient_policy_get(E_Client *ec)
6660 if (!ec) return E_TRANSIENT_ABOVE;
6661 return ec->transient_policy;
6665 e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb)
6667 if (_e_client_resize_object_create_cb && cb)
6668 CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!");
6669 _e_client_resize_object_create_cb = cb;
6673 e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
6677 // FYI, we consider 0 and 1 to be the same value as a default unit size.
6678 ec->manage_resize.unit_size = unit_size;
6682 e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
6685 ec->desk_zoom.enable = enable;
6689 e_client_desk_zoom_enable_get(E_Client *ec)
6691 if (!ec) return EINA_FALSE;
6692 return ec->desk_zoom.enable;
6696 e_client_layout_apply(E_Client *ec, Eina_Bool apply)
6699 ec->apply_layout = apply;
6703 e_client_is_layout_apply(E_Client *ec)
6705 if (!ec) return EINA_FALSE;
6706 return ec->apply_layout;
6710 e_client_from_surface_resource(struct wl_resource *surface_resource)
6712 EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, NULL);
6714 return e_comp_wl_util_client_from_surface_resource(surface_resource);
6718 e_client_fps_update(E_Client *ec)
6723 EINA_SAFETY_ON_NULL_RETURN(ec);
6725 if (!ec->fps.enabled) return;
6727 tim = ecore_time_get();
6729 dt = tim - ec->fps.frametimes[0];
6731 ec->fps.frametimes[0] = tim;
6735 if (ec->fps.lapse == 0.0)
6737 ec->fps.lapse = tim;
6738 ec->fps.flapse = ec->fps.cframes;
6740 else if ((tim - ec->fps.lapse) >= 0.5)
6742 ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
6743 (tim - ec->fps.lapse);
6744 ec->fps.lapse = tim;
6745 ec->fps.flapse = ec->fps.cframes;
6751 e_client_fps_get(E_Client *ec, double *fps)
6753 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6755 if (ec->fps.old_fps == ec->fps.fps)
6758 if (ec->fps.fps > 0.0)
6761 ec->fps.old_fps = ec->fps.fps;
6769 e_client_fps_enable(E_Client *ec, Eina_Bool enable)
6771 EINA_SAFETY_ON_NULL_RETURN(ec);
6773 ec->fps.enabled = enable;
6777 e_client_explicit_sync_get(E_Client *ec)
6779 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6781 return ec->explicit_sync;
6785 e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable)
6787 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6789 ec->explicit_sync = enable;
6795 e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec)
6797 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, -1);
6799 return ec->acquire_fence_fd;
6803 e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd)
6805 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6807 ec->acquire_fence_fd = fd;
6813 e_client_intercept_hook_auto_placement_call(E_Client *ec)
6815 // no need to call the intercept hook if ec is NULL.
6816 if (!ec) return EINA_FALSE;
6818 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
6820 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT Intercepted.", ec);
6828 e_client_iconify_event_send(E_Client *ec)
6830 EINA_SAFETY_ON_NULL_RETURN(ec);
6832 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
6836 e_client_uniconify_event_send(E_Client *ec)
6838 EINA_SAFETY_ON_NULL_RETURN(ec);
6840 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
6844 e_client_stack_transient_for_done_notify(E_Client *ec)
6846 EINA_SAFETY_ON_NULL_RETURN(ec);
6848 wl_signal_emit_mutable(&PRI(ec)->events.stack_transient_for_done, NULL);
6851 #ifdef REFACTOR_DESK_AREA
6853 e_client_subsurface_stack_update(E_Client *ec)
6855 EINA_SAFETY_ON_NULL_RETURN(ec);
6857 wl_signal_emit_mutable(&PRI(ec)->events.subsurface_stack_update, ec);
6862 e_client_eval_pre_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6865 wl_signal_add(&priv->events.eval_pre_fetch, listener);
6869 e_client_eval_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6872 wl_signal_add(&priv->events.eval_fetch, listener);
6876 e_client_eval_pre_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6879 wl_signal_add(&priv->events.eval_pre_post_fetch, listener);
6883 e_client_eval_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6886 wl_signal_add(&priv->events.eval_post_fetch, listener);
6890 e_client_eval_pre_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6893 wl_signal_add(&priv->events.eval_pre_frame_assign, listener);
6897 e_client_eval_post_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6900 wl_signal_add(&priv->events.eval_post_frame_assign, listener);
6904 e_client_eval_pre_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6907 wl_signal_add(&priv->events.eval_pre_new_client, listener);
6911 e_client_eval_post_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6914 wl_signal_add(&priv->events.eval_post_new_client, listener);
6918 e_client_eval_visibility_listener_add(E_Client *ec, struct wl_listener *listener)
6921 wl_signal_add(&priv->events.eval_visibility, listener);
6925 e_client_eval_visibility_end_listener_add(E_Client *ec, struct wl_listener *listener)
6928 wl_signal_add(&priv->events.eval_visibility_end, listener);
6932 e_client_eval_end_listener_add(E_Client *ec, struct wl_listener *listener)
6935 wl_signal_add(&priv->events.eval_end, listener);
6939 e_client_move_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6942 wl_signal_add(&priv->events.move_begin, listener);
6946 e_client_move_update_listener_add(E_Client *ec, struct wl_listener *listener)
6949 wl_signal_add(&priv->events.move_update, listener);
6953 e_client_move_end_listener_add(E_Client *ec, struct wl_listener *listener)
6956 wl_signal_add(&priv->events.move_end, listener);
6960 e_client_move_resize_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6963 wl_signal_add(&priv->events.move_resize_begin, listener);
6967 e_client_move_resize_update_listener_add(E_Client *ec, struct wl_listener *listener)
6970 wl_signal_add(&priv->events.move_resize_update, listener);
6974 e_client_move_resize_end_listener_add(E_Client *ec, struct wl_listener *listener)
6977 wl_signal_add(&priv->events.move_resize_end, listener);
6981 e_client_destroy_listener_add(E_Client *ec, struct wl_listener *listener)
6984 wl_signal_add(&priv->events.destroy, listener);
6988 e_client_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6991 wl_signal_add(&priv->events.new_client, listener);
6995 e_client_new_client_post_listener_add(E_Client *ec, struct wl_listener *listener)
6998 wl_signal_add(&priv->events.new_client_post, listener);
7002 e_client_unredirect_listener_add(E_Client *ec, struct wl_listener *listener)
7005 wl_signal_add(&priv->events.unredirect, listener);
7009 e_client_redirect_listener_add(E_Client *ec, struct wl_listener *listener)
7012 wl_signal_add(&priv->events.redirect, listener);
7016 e_client_aux_hint_change_listener_add(E_Client *ec, struct wl_listener *listener)
7019 wl_signal_add(&priv->events.aux_hint_change, listener);
7023 e_client_window_role_change_listener_add(E_Client *ec, struct wl_listener *listener)
7026 wl_signal_add(&priv->events.window_role_change, listener);
7030 e_client_transform_change_listener_add(E_Client *ec, struct wl_listener *listener)
7033 wl_signal_add(&priv->events.transform_change, listener);
7037 e_client_activate_done_listener_add(E_Client *ec, struct wl_listener *listener)
7040 wl_signal_add(&priv->events.activate_done, listener);
7044 e_client_mouse_in_listener_add(E_Client *ec, struct wl_listener *listener)
7047 wl_signal_add(&priv->events.mouse_in, listener);
7051 e_client_mouse_out_listener_add(E_Client *ec, struct wl_listener *listener)
7054 wl_signal_add(&priv->events.mouse_out, listener);
7058 e_client_mouse_down_listener_add(E_Client *ec, struct wl_listener *listener)
7061 wl_signal_add(&priv->events.mouse_down, listener);
7065 e_client_focus_set_listener_add(E_Client *ec, struct wl_listener *listener)
7068 wl_signal_add(&priv->events.focus_set, listener);
7072 e_client_focus_unset_listener_add(E_Client *ec, struct wl_listener *listener)
7075 wl_signal_add(&priv->events.focus_unset, listener);
7079 e_client_focus_defer_set_listener_add(E_Client *ec, struct wl_listener *listener)
7082 wl_signal_add(&priv->events.focus_defer_set, listener);
7086 e_client_focus_latest_set_listener_add(E_Client *ec, struct wl_listener *listener)
7089 wl_signal_add(&priv->events.focus_latest_set, listener);
7093 e_client_iconify_listener_add(E_Client *ec, struct wl_listener *listener)
7096 wl_signal_add(&priv->events.iconify, listener);
7100 e_client_uniconify_listener_add(E_Client *ec, struct wl_listener *listener)
7103 wl_signal_add(&priv->events.uniconify, listener);
7107 e_client_maximize_listener_add(E_Client *ec, struct wl_listener *listener)
7110 wl_signal_add(&priv->events.maximize, listener);
7114 e_client_unmaximize_listener_add(E_Client *ec, struct wl_listener *listener)
7117 wl_signal_add(&priv->events.unmaximize, listener);
7121 e_client_fullscreen_pre_listener_add(E_Client *ec, struct wl_listener *listener)
7124 wl_signal_add(&priv->events.fullscreen_pre, listener);
7128 e_client_fullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7131 wl_signal_add(&priv->events.fullscreen, listener);
7135 e_client_unfullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7138 wl_signal_add(&priv->events.unfullscreen, listener);
7142 e_client_move_listener_add(E_Client *ec, struct wl_listener *listener)
7145 wl_signal_add(&priv->events.move, listener);
7149 e_client_raise_listener_add(E_Client *ec, struct wl_listener *listener)
7152 wl_signal_add(&priv->events.raise, listener);
7156 e_client_lower_listener_add(E_Client *ec, struct wl_listener *listener)
7159 wl_signal_add(&priv->events.lower, listener);
7163 e_client_stack_below_listener_add(E_Client *ec, struct wl_listener *listener)
7166 wl_signal_add(&priv->events.stack_below, listener);
7170 e_client_stack_above_listener_add(E_Client *ec, struct wl_listener *listener)
7173 wl_signal_add(&priv->events.stack_above, listener);
7177 e_client_set_layer_listener_add(E_Client *ec, struct wl_listener *listener)
7180 wl_signal_add(&priv->events.set_layer, listener);
7184 e_client_stack_transient_for_done_listener_add(E_Client *ec, struct wl_listener *listener)
7187 wl_signal_add(&priv->events.stack_transient_for_done, listener);
7191 e_client_stick_listener_add(E_Client *ec, struct wl_listener *listener)
7194 wl_signal_add(&priv->events.stick, listener);
7198 e_client_unstick_listener_add(E_Client *ec, struct wl_listener *listener)
7201 wl_signal_add(&priv->events.unstick, listener);
7204 EINTERN struct wl_listener *
7205 e_client_destroy_listener_get(E_Client *ec, wl_notify_func_t notify)
7207 API_ENTRY_VAL(NULL);
7208 return wl_signal_get(&priv->events.destroy, notify);
7211 #ifdef REFACTOR_DESK_AREA
7213 e_client_get_above_listener_add(E_Client *ec, struct wl_listener *listener)
7216 wl_signal_add(&priv->events.get_above, listener);
7220 e_client_get_below_listener_add(E_Client *ec, struct wl_listener *listener)
7223 wl_signal_add(&priv->events.get_below, listener);
7227 e_client_get_visible_above_listener_add(E_Client *ec, struct wl_listener *listener)
7230 wl_signal_add(&priv->events.get_visible_above, listener);
7234 e_client_get_visible_below_listener_add(E_Client *ec, struct wl_listener *listener)
7237 wl_signal_add(&priv->events.get_visible_below, listener);
7241 e_client_subsurface_stack_update_listener_add(E_Client *ec, struct wl_listener *listener)
7244 wl_signal_add(&priv->events.subsurface_stack_update, listener);
7249 e_client_shell_configure_send(E_Client *ec, uint32_t edges, int32_t width, int32_t height)
7251 EINA_SAFETY_ON_NULL_RETURN(ec);
7252 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7254 if ((!ec->comp_data->shell.surface) ||
7255 (!ec->comp_data->shell.configure_send))
7258 ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, edges, width, height);
7262 e_client_shell_configure(E_Client *ec, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
7264 EINA_SAFETY_ON_NULL_RETURN(ec);
7265 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7267 if ((!ec->comp_data->shell.surface) ||
7268 (!ec->comp_data->shell.configure))
7271 ec->comp_data->shell.configure(ec->comp_data->shell.surface, x, y, width, height);
7275 e_client_shell_ping(E_Client *ec)
7277 EINA_SAFETY_ON_NULL_RETURN(ec);
7278 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7280 if ((!ec->comp_data->shell.surface) ||
7281 (!ec->comp_data->shell.ping))
7284 ec->comp_data->shell.ping(ec->comp_data->shell.surface);
7288 _e_client_shell_map(E_Client *ec)
7290 EINA_SAFETY_ON_NULL_RETURN(ec);
7291 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7293 if ((!ec->comp_data->shell.surface) ||
7294 (!ec->comp_data->shell.map))
7297 ec->comp_data->shell.map(ec->comp_data->shell.surface);
7301 e_client_shell_unmap(E_Client *ec)
7303 EINA_SAFETY_ON_NULL_RETURN(ec);
7304 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7306 if ((!ec->comp_data->shell.surface) ||
7307 (!ec->comp_data->shell.unmap))
7310 ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
7314 e_client_show(E_Client *ec)
7316 EINA_SAFETY_ON_NULL_RETURN(ec);
7317 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7319 if (ec->comp_data->mapped)
7322 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.map) &&
7325 ELOGF("E_CLIENT", "Map.", ec);
7326 _e_client_shell_map(ec);
7328 else if (ec->internal || e_comp_wl_subsurface_can_show(ec) ||
7329 (ec == e_comp_wl->drag_client))
7331 ELOGF("E_CLIENT", "Map. internal:%d, drag:%d",
7332 ec, ec->internal, (ec == e_comp_wl->drag_client));
7333 ec->visible = EINA_TRUE;
7335 evas_object_show(ec->frame);
7336 ec->comp_data->mapped = 1;
7341 e_client_hide(E_Client *ec)
7345 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7347 if (!ec->comp_data->mapped)
7350 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap))
7352 ELOGF("E_CLIENT", "Unmap", ec);
7354 if (priv->hide_by_request)
7355 ELOGF("COMP", "Currenlty hide_by_request state.", ec);
7357 if (ec->show_pending.count > 0)
7359 ELOGF("E_CLIENT", "Reset show_pending!!! (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
7360 ec->show_pending.count = 0;
7361 if (ec->show_pending.running)
7363 // need to send visibility false;
7364 ec->visibility.obscured = E_VISIBILITY_UNOBSCURED;
7365 ELOGF("POL_VIS", "CLIENT VIS ON (fake). argb:%d, opaque:%2d", ec, ec->argb, ec->visibility.opaque);
7368 ec->show_pending.running = EINA_FALSE;
7370 e_client_shell_unmap(ec);
7372 else if ((ec->internal) || (e_comp_wl_subsurface_check(ec)) ||
7373 (ec == e_comp_wl->drag_client))
7375 ELOGF("E_CLIENT", "Unmap. internal:%d, sub:%p, drag:%d",
7376 ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client));
7377 ec->visible = EINA_FALSE;
7378 evas_object_hide(ec->frame);
7379 ec->comp_data->mapped = 0;