2 #include "e_client_intern.h"
3 #include "e_actions_intern.h"
5 #define PRI(ec) ((E_Client_Private *)e_object_data_get(E_OBJECT(ec)))
8 EINA_SAFETY_ON_NULL_RETURN(ec); \
9 E_Client_Private *priv = PRI(ec)
11 #define API_ENTRY_VAL(ret) \
12 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ret); \
13 E_Client_Private *priv = PRI(ec)
15 typedef struct _E_Client_Private E_Client_Private;
17 struct _E_Client_Private
21 struct wl_signal eval_pre_fetch;
22 struct wl_signal eval_fetch;
23 struct wl_signal eval_pre_post_fetch;
24 struct wl_signal eval_post_fetch;
25 struct wl_signal eval_pre_frame_assign;
26 struct wl_signal eval_post_frame_assign;
27 struct wl_signal eval_pre_new_client;
28 struct wl_signal eval_post_new_client;
29 struct wl_signal eval_visibility;
30 struct wl_signal eval_visibility_end;
31 struct wl_signal eval_end;
33 struct wl_signal move_begin;
34 struct wl_signal move_update;
35 struct wl_signal move_end;
36 struct wl_signal move_resize_begin;
37 struct wl_signal move_resize_update;
38 struct wl_signal move_resize_end;
40 struct wl_signal destroy;
41 struct wl_signal new_client;
42 struct wl_signal new_client_post;
44 struct wl_signal unredirect;
45 struct wl_signal redirect;
47 struct wl_signal aux_hint_change;
48 struct wl_signal window_role_change;
49 struct wl_signal transform_change;
50 struct wl_signal activate_done;
52 struct wl_signal mouse_in;
53 struct wl_signal mouse_out;
54 struct wl_signal mouse_down;
56 struct wl_signal focus_set;
57 struct wl_signal focus_unset;
58 struct wl_signal focus_defer_set;
59 struct wl_signal focus_latest_set;
61 struct wl_signal iconify;
62 struct wl_signal uniconify;
63 struct wl_signal maximize;
64 struct wl_signal unmaximize;
65 struct wl_signal fullscreen_pre;
66 struct wl_signal fullscreen;
67 struct wl_signal unfullscreen;
69 struct wl_signal move;
71 struct wl_signal set_layer;
72 struct wl_signal raise;
73 struct wl_signal lower;
74 struct wl_signal stack_below;
75 struct wl_signal stack_above;
76 struct wl_signal stack_transient_for_done;
78 struct wl_signal stick;
79 struct wl_signal unstick;
81 #ifdef REFACTOR_DESK_AREA
82 struct wl_signal get_above;
83 struct wl_signal get_below;
84 struct wl_signal get_visible_above;
85 struct wl_signal get_visible_below;
86 struct wl_signal subsurface_stack_update;
90 Eina_Bool hide_by_request;
93 static int _e_client_hooks_delete = 0;
94 static int _e_client_hooks_walking = 0;
96 static int _e_client_intercept_hooks_delete = 0;
97 static int _e_client_intercept_hooks_walking = 0;
99 E_API int E_EVENT_CLIENT_ADD = -1;
100 E_API int E_EVENT_CLIENT_REMOVE = -1;
101 E_API int E_EVENT_CLIENT_ZONE_SET = -1;
102 E_API int E_EVENT_CLIENT_DESK_SET = -1;
103 E_API int E_EVENT_CLIENT_RESIZE = -1;
104 E_API int E_EVENT_CLIENT_MOVE = -1;
105 E_API int E_EVENT_CLIENT_SHOW = -1;
106 E_API int E_EVENT_CLIENT_HIDE = -1;
107 E_API int E_EVENT_CLIENT_ICONIFY = -1;
108 E_API int E_EVENT_CLIENT_UNICONIFY = -1;
109 E_API int E_EVENT_CLIENT_STACK = -1;
110 E_API int E_EVENT_CLIENT_FOCUS_IN = -1;
111 E_API int E_EVENT_CLIENT_FOCUS_OUT = -1;
112 E_API int E_EVENT_CLIENT_PROPERTY = -1;
113 E_API int E_EVENT_CLIENT_FULLSCREEN = -1;
114 E_API int E_EVENT_CLIENT_UNFULLSCREEN = -1;
115 #ifdef _F_ZONE_WINDOW_ROTATION_
116 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = -1;
117 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = -1;
118 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1;
119 E_API int E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = -1;
121 E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1;
122 E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1;
123 E_API int E_EVENT_CLIENT_FOCUS_SKIP_SET = -1;
124 E_API int E_EVENT_CLIENT_FOCUS_SKIP_UNSET = -1;
126 static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client
128 static E_Client *ecmove = NULL;
129 static E_Client *ecresize = NULL;
130 static E_Client *action_client = NULL;
132 static Eina_Bool comp_grabbed = EINA_FALSE;
134 static Eina_List *handlers = NULL;
135 static Eina_List *hooks = NULL;
137 static Ecore_Event_Handler *action_handler_mouse = NULL;
138 static Ecore_Timer *action_timer = NULL;
139 static Eina_Rectangle action_orig = {0, 0, 0, 0};
141 static E_Client_Resize_Object_Create_Cb _e_client_resize_object_create_cb = NULL;
143 EINTERN void e_client_focused_set(E_Client *ec);
144 static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list);
145 static Evas_Object *_e_client_resize_object_create(E_Client *ec);
146 static void _e_client_resize_object_del(E_Client *ec);
147 static void _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y);
148 static void _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y);
150 static Eina_Inlist *_e_client_hooks[] =
152 [E_CLIENT_HOOK_EVAL_PRE_FETCH] = NULL,
153 [E_CLIENT_HOOK_EVAL_FETCH] = NULL,
154 [E_CLIENT_HOOK_EVAL_PRE_POST_FETCH] = NULL,
155 [E_CLIENT_HOOK_EVAL_POST_FETCH] = NULL,
156 [E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN] = NULL,
157 [E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN] = NULL,
158 [E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT] = NULL,
159 [E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT] = NULL,
160 [E_CLIENT_HOOK_EVAL_END] = NULL,
161 [E_CLIENT_HOOK_FOCUS_SET] = NULL,
162 [E_CLIENT_HOOK_FOCUS_UNSET] = NULL,
163 [E_CLIENT_HOOK_NEW_CLIENT] = NULL,
164 [E_CLIENT_HOOK_MOVE_BEGIN] = NULL,
165 [E_CLIENT_HOOK_MOVE_UPDATE] = NULL,
166 [E_CLIENT_HOOK_MOVE_END] = NULL,
167 [E_CLIENT_HOOK_RESIZE_BEGIN] = NULL,
168 [E_CLIENT_HOOK_RESIZE_UPDATE] = NULL,
169 [E_CLIENT_HOOK_RESIZE_END] = NULL,
170 [E_CLIENT_HOOK_FULLSCREEN_PRE] = NULL,
171 [E_CLIENT_HOOK_DEL] = NULL,
172 [E_CLIENT_HOOK_UNREDIRECT] = NULL,
173 [E_CLIENT_HOOK_REDIRECT] = NULL,
174 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
175 [E_CLIENT_HOOK_NEW_CLIENT_POST] = NULL,
177 [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL,
178 [E_CLIENT_HOOK_ICONIFY] = NULL,
179 [E_CLIENT_HOOK_UNICONIFY] = NULL,
180 [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL,
181 [E_CLIENT_HOOK_WINDOW_ROLE_CHANGE] = NULL,
182 [E_CLIENT_HOOK_TRANSFORM_CHANGE] = NULL,
183 [E_CLIENT_HOOK_ACTIVATE_DONE] = NULL,
184 [E_CLIENT_HOOK_EVAL_VISIBILITY_END] = NULL,
187 static Eina_Inlist *_e_client_intercept_hooks[] =
189 [E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT] = NULL,
190 [E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT] = NULL,
193 ///////////////////////////////////////////
196 _e_client_hooks_clean(void)
202 for (x = 0; x < E_CLIENT_HOOK_LAST; x++)
203 EINA_INLIST_FOREACH_SAFE(_e_client_hooks[x], l, ch)
205 if (!ch->delete_me) continue;
206 _e_client_hooks[x] = eina_inlist_remove(_e_client_hooks[x], EINA_INLIST_GET(ch));
212 _e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
216 e_object_ref(E_OBJECT(ec));
217 _e_client_hooks_walking++;
218 EINA_INLIST_FOREACH(_e_client_hooks[hookpoint], ch)
220 if (ch->delete_me) continue;
221 ch->func(ch->data, ec);
222 if ((hookpoint != E_CLIENT_HOOK_DEL) &&
223 (hookpoint != E_CLIENT_HOOK_MOVE_END) &&
224 (hookpoint != E_CLIENT_HOOK_RESIZE_END) &&
225 (hookpoint != E_CLIENT_HOOK_FOCUS_UNSET) &&
226 e_object_is_del(E_OBJECT(ec)))
229 _e_client_hooks_walking--;
230 if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
231 _e_client_hooks_clean();
232 return !!e_object_unref(E_OBJECT(ec));
235 ///////////////////////////////////////////
238 _e_client_intercept_hooks_clean(void)
241 E_Client_Intercept_Hook *ch;
244 for (x = 0; x < E_CLIENT_INTERCEPT_HOOK_LAST; x++)
245 EINA_INLIST_FOREACH_SAFE(_e_client_intercept_hooks[x], l, ch)
247 if (!ch->delete_me) continue;
248 _e_client_intercept_hooks[x] =
249 eina_inlist_remove(_e_client_intercept_hooks[x], EINA_INLIST_GET(ch));
255 _e_client_intercept_hook_call(E_Client_Intercept_Hook_Point hookpoint, E_Client *ec)
257 E_Client_Intercept_Hook *ch;
258 Eina_Bool ret = EINA_TRUE;
260 if (e_object_is_del(E_OBJECT(ec)))
262 if (hookpoint != E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT)
268 e_object_ref(E_OBJECT(ec));
269 _e_client_intercept_hooks_walking++;
270 EINA_INLIST_FOREACH(_e_client_intercept_hooks[hookpoint], ch)
272 if (ch->delete_me) continue;
273 if (!(ch->func(ch->data, ec)))
279 _e_client_intercept_hooks_walking--;
280 if ((_e_client_intercept_hooks_walking == 0) &&
281 (_e_client_intercept_hooks_delete > 0))
282 _e_client_intercept_hooks_clean();
284 e_object_unref(E_OBJECT(ec));
289 _e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
292 e_object_unref(E_OBJECT(ev->ec));
297 _e_client_event_simple(E_Client *ec, int type)
301 ev = E_NEW(E_Event_Client, 1);
305 e_object_ref(E_OBJECT(ec));
306 ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
310 _e_client_event_add(E_Client *ec)
315 ec->reg_ev.add = EINA_TRUE;
316 ELOGF("COMP", "SEND E_EVENT_CLIENT_ADD event", ec);
317 _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
321 _e_client_event_remove(E_Client *ec)
326 ec->reg_ev.add = EINA_FALSE;
327 ELOGF("COMP", "SEND E_EVENT_CLIENT_REMOVE event", ec);
328 _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
332 _e_client_event_show(E_Client *ec)
337 ec->reg_ev.show = EINA_TRUE;
338 _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
342 _e_client_event_hide(E_Client *ec)
344 if (!ec->reg_ev.show)
347 ec->reg_ev.show = EINA_FALSE;
348 _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
352 _e_client_event_property(E_Client *ec, int prop)
354 E_Event_Client_Property *ev;
356 ev = E_NEW(E_Event_Client_Property, 1);
361 e_object_ref(E_OBJECT(ec));
362 ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
365 ////////////////////////////////////////////////
368 _e_client_action_input_win_del(void)
370 if (!comp_grabbed) return 0;
372 e_comp_ungrab_input(1, 1);
378 _e_client_action_finish(void)
381 _e_client_action_input_win_del();
383 E_FREE_FUNC(action_timer, ecore_timer_del);
384 E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
387 action_client->keyboard_resizing = 0;
389 action_client = NULL;
393 _e_client_transform_point_transform(int cx, int cy, double angle, int x, int y, int *tx, int *ty)
395 double s = sin(angle * M_PI / 180);
396 double c = cos(angle * M_PI / 180);
403 ry = - x * s + y * c;
413 _e_client_transform_geometry_save(E_Client *ec, E_Map *map)
419 for (i = 0; i < 4; i ++)
421 e_map_point_precise_coord_get(map, i,
422 &ec->transform.saved[i].x,
423 &ec->transform.saved[i].y,
424 &ec->transform.saved[i].z);
429 _e_client_transform_resize(E_Client *ec)
433 double dx = 0, dy = 0;
438 if (!ec->transformed) return;
440 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
446 cx = ec->client.x + pw / 2;
447 cy = ec->client.y + ph / 2;
449 /* step 1: Rotate resized object and get map points */
450 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
451 e_map_util_points_populate_from_geometry(map,
452 ec->client.x, ec->client.y,
455 e_map_util_rotate(map, ec->transform.angle, cx, cy);
456 e_map_util_zoom(map, ec->transform.zoom, ec->transform.zoom, cx, cy);
458 for (i = 0; i < 4; i++)
459 e_map_point_precise_coord_get(map, i, &px[i], &py[i], NULL);
463 /* step 2: get adjusted values to keep up fixed position according
465 switch (ec->resize_mode)
467 case E_POINTER_RESIZE_R:
468 case E_POINTER_RESIZE_BR:
469 dx = ec->transform.saved[0].x - px[0];
470 dy = ec->transform.saved[0].y - py[0];
472 case E_POINTER_RESIZE_BL:
473 case E_POINTER_RESIZE_B:
474 dx = ec->transform.saved[1].x - px[1];
475 dy = ec->transform.saved[1].y - py[1];
477 case E_POINTER_RESIZE_TL:
478 case E_POINTER_RESIZE_L:
479 dx = ec->transform.saved[2].x - px[2];
480 dy = ec->transform.saved[2].y - py[2];
482 case E_POINTER_RESIZE_T:
483 case E_POINTER_RESIZE_TR:
484 dx = ec->transform.saved[3].x - px[3];
485 dy = ec->transform.saved[3].y - py[3];
491 ec->transform.adjusted.x = dx;
492 ec->transform.adjusted.y = dy;
494 /* step 3: set each points of the quadrangle */
495 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
496 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
498 for (i = 0; i < 4; i++)
499 e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0);
501 e_client_map_set(ec, map);
502 e_client_map_enable_set(ec, EINA_TRUE);
507 _e_client_transform_resize_handle(E_Client *ec)
510 int new_x, new_y, new_w, new_h;
514 Evas_Point current, moveinfo;
517 if (e_object_is_del(E_OBJECT(ec))) return;
518 if (e_client_util_ignored_get(ec)) return;
519 if (!ec->transformed) return;
521 zone = e_comp_zone_find_by_ec(ec);
524 button_id = ec->moveinfo.down.button;
526 org_w = ec->mouse.last_down[button_id - 1].w;
527 org_h = ec->mouse.last_down[button_id - 1].h;
529 new_w = ec->client.w;
530 new_h = ec->client.h;
531 new_x = ec->client.x;
532 new_y = ec->client.y;
534 /* step 1: get center coordinate its' based on original object geometry*/
535 cx = ec->client.x + org_w / 2;
536 cy = ec->client.y + org_h / 2;
538 /* step 2: transform coordinates of mouse position
539 * subtract adjusted value from mouse position is needed */
540 current.x = ec->mouse.current.mx - ec->transform.adjusted.x;
541 current.y = ec->mouse.current.my - ec->transform.adjusted.y;
542 moveinfo.x = ec->moveinfo.down.mx - ec->transform.adjusted.x;
543 moveinfo.y = ec->moveinfo.down.my - ec->transform.adjusted.y;
545 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
546 current.x, current.y,
547 ¤t.x, ¤t.y);
548 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
549 moveinfo.x, moveinfo.y,
550 &moveinfo.x, &moveinfo.y);
552 /* step 3: calculate new size */
553 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
554 (ec->resize_mode == E_POINTER_RESIZE_R) ||
555 (ec->resize_mode == E_POINTER_RESIZE_BR))
557 if ((button_id >= 1) && (button_id <= 3))
558 new_w = org_w + (current.x - moveinfo.x);
560 new_w = ec->moveinfo.down.w + (current.x - moveinfo.x);
562 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
563 (ec->resize_mode == E_POINTER_RESIZE_L) ||
564 (ec->resize_mode == E_POINTER_RESIZE_BL))
566 if ((button_id >= 1) && (button_id <= 3))
567 new_w = org_w - (current.x - moveinfo.x);
569 new_w = ec->moveinfo.down.w - (current.x - moveinfo.x);
572 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
573 (ec->resize_mode == E_POINTER_RESIZE_T) ||
574 (ec->resize_mode == E_POINTER_RESIZE_TR))
576 if ((button_id >= 1) && (button_id <= 3))
577 new_h = org_h - (current.y - moveinfo.y);
579 new_h = ec->moveinfo.down.h - (current.y - moveinfo.y);
581 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
582 (ec->resize_mode == E_POINTER_RESIZE_B) ||
583 (ec->resize_mode == E_POINTER_RESIZE_BR))
585 if ((button_id >= 1) && (button_id <= 3))
586 new_h = org_h + (current.y - moveinfo.y);
588 new_h = ec->moveinfo.down.h + (current.y - moveinfo.y);
591 new_w = MIN(new_w, zone->w);
592 new_h = MIN(new_h, zone->h);
594 /* step 4: move to new position */
595 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
596 (ec->resize_mode == E_POINTER_RESIZE_L) ||
597 (ec->resize_mode == E_POINTER_RESIZE_BL))
598 new_x += (new_w - org_w);
599 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
600 (ec->resize_mode == E_POINTER_RESIZE_T) ||
601 (ec->resize_mode == E_POINTER_RESIZE_TR))
602 new_y += (new_h - org_h);
604 /* step 5: set geometry to new value */
605 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
609 _e_client_transform_resize_begin(E_Client *ec)
612 if (!ec->transformed) return;
614 map = e_client_map_get(ec);
615 _e_client_transform_geometry_save(ec, map);
620 _e_client_transform_resize_end(E_Client *ec)
623 int new_x = 0, new_y = 0;
626 if (!ec->transformed) return;
628 map = e_client_map_get(ec);
631 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
637 cx = ec->client.x + pw / 2 + ec->transform.adjusted.x;
638 cy = ec->client.y + ph / 2 + ec->transform.adjusted.y;
640 if (ec->transform.zoom != 1.0)
644 tmp_map = e_map_dup(map);
645 e_map_util_zoom(tmp_map,
646 1 / ec->transform.zoom,
647 1 / ec->transform.zoom,
650 _e_client_transform_geometry_save(ec, tmp_map);
655 _e_client_transform_geometry_save(ec, map);
658 /* move original object to adjusted position after resizing */
659 _e_client_transform_point_transform(cx, cy,
661 ec->transform.saved[0].x,
662 ec->transform.saved[0].y,
664 e_client_util_move_without_frame(ec, new_x, new_y);
665 e_map_util_object_move_sync_set(map, EINA_TRUE);
670 _e_client_transform_move_end(E_Client *ec)
674 double dx, dy, px, py;
677 if (!ec->transformed) return;
679 map = e_client_map_get(ec);
682 if (ec->transform.zoom != 1.0)
684 e_map_point_precise_coord_get(map, 0, &px, &py, NULL);
686 dx = px - ec->transform.saved[0].x;
687 dy = py - ec->transform.saved[0].y;
689 for (i = 0; i < 4; i++)
691 ec->transform.saved[i].x += dx;
692 ec->transform.saved[i].y += dy;
696 _e_client_transform_geometry_save(ec, map);
701 e_client_intercept_hook_focus_revert_call(E_Client *ec)
703 // no need to call the intercept hook if ec is NULL.
704 if (!ec) return EINA_FALSE;
706 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
708 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT Intercepted.", ec);
716 e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
718 E_Client *above = NULL;
720 int x = 0, y = 0, w = 0, h = 0;
721 int ax = 0, ay = 0, aw = 0, ah = 0;
723 if (!ec) return NULL;
725 e_client_geometry_get(ec, &x, &y, &w, &h);
727 zone = e_comp_zone_find_by_ec(ec);
729 E_RECTS_CLIP_TO_RECT(x, y, w, h, zone->x, zone->y, zone->w, zone->h);
731 above = e_client_above_get(ec);
735 (above->layer <= ec->layer))
737 above = e_client_above_get(above);
741 if ((!e_object_is_del(E_OBJECT(above))) &&
742 (!e_client_util_ignored_get(above)) &&
744 (!above->iconic || e_policy_visibility_client_is_uniconic(above)) &&
745 (!above->bg_state) &&
747 (!above->visibility.force_obscured) &&
750 e_client_geometry_get(above, &ax, &ay, &aw, &ah);
751 if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h))
754 above = e_client_above_get(above);
761 e_client_check_obscured_by_children_group(E_Client *ec)
763 E_Client *cec = NULL;
764 Eina_List *transients = NULL, *l = NULL;
766 _e_client_transient_for_group_make(ec, &transients);
767 if (!transients) return NULL;
769 EINA_LIST_FOREACH(transients, l, cec)
771 if (E_CONTAINS(cec->x, cec->y, cec->w, cec->h, ec->x, ec->y, ec->w, ec->h))
773 if (!cec->argb) break;
774 if (cec->visibility.opaque > 0) break;
778 eina_list_free(transients);
784 e_client_check_really_iconified(E_Client *ec)
786 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
788 if (!ec->iconic) return EINA_FALSE;
790 return ((!e_policy_visibility_client_is_uniconic(ec) &&
791 !e_policy_visibility_client_is_uniconify_render_running(ec)) ||
792 (e_client_is_iconified_by_client(ec)));
796 _e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client)
798 E_Event_Client_Focus_Skip_Set *ev;
800 ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1);
804 ev->by_client = by_client;
805 e_object_ref(E_OBJECT(ec));
807 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
811 _e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client)
813 E_Event_Client_Focus_Skip_Unset *ev;
815 ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1);
819 ev->by_client = by_client;
820 e_object_ref(E_OBJECT(ec));
822 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
826 e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client)
832 if (ec->icccm.accepts_focus)
834 ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client);
835 ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
836 ec->changes.accepts_focus = 1;
839 _e_client_event_focus_skip_set(ec, by_client);
844 if (!ec->icccm.accepts_focus)
846 ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client);
847 ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
848 ec->changes.accepts_focus = 1;
851 _e_client_event_focus_skip_unset(ec, by_client);
857 e_client_check_above_focused(E_Client *ec)
859 E_Client *focus = NULL;
860 E_Client *above = NULL;
862 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
864 focus = e_client_focused_get();
865 if (!focus) return EINA_FALSE;
867 above = e_client_above_get(ec);
873 above = e_client_above_get(above);
880 _e_client_private_init(E_Client *ec)
882 E_Client_Private *priv;
884 priv = E_NEW(E_Client_Private, 1);
888 wl_signal_init(&priv->events.eval_pre_fetch);
889 wl_signal_init(&priv->events.eval_fetch);
890 wl_signal_init(&priv->events.eval_pre_post_fetch);
891 wl_signal_init(&priv->events.eval_post_fetch);
892 wl_signal_init(&priv->events.eval_pre_frame_assign);
893 wl_signal_init(&priv->events.eval_post_frame_assign);
894 wl_signal_init(&priv->events.eval_pre_new_client);
895 wl_signal_init(&priv->events.eval_post_new_client);
896 wl_signal_init(&priv->events.eval_visibility);
897 wl_signal_init(&priv->events.eval_visibility_end);
898 wl_signal_init(&priv->events.eval_end);
899 wl_signal_init(&priv->events.move_begin);
900 wl_signal_init(&priv->events.move_update);
901 wl_signal_init(&priv->events.move_end);
902 wl_signal_init(&priv->events.move_resize_begin);
903 wl_signal_init(&priv->events.move_resize_update);
904 wl_signal_init(&priv->events.move_resize_end);
905 wl_signal_init(&priv->events.destroy);
906 wl_signal_init(&priv->events.new_client);
907 wl_signal_init(&priv->events.new_client_post);
908 wl_signal_init(&priv->events.unredirect);
909 wl_signal_init(&priv->events.redirect);
910 wl_signal_init(&priv->events.aux_hint_change);
911 wl_signal_init(&priv->events.window_role_change);
912 wl_signal_init(&priv->events.transform_change);
913 wl_signal_init(&priv->events.activate_done);
914 wl_signal_init(&priv->events.mouse_in);
915 wl_signal_init(&priv->events.mouse_out);
916 wl_signal_init(&priv->events.mouse_down);
917 wl_signal_init(&priv->events.focus_set);
918 wl_signal_init(&priv->events.focus_unset);
919 wl_signal_init(&priv->events.focus_defer_set);
920 wl_signal_init(&priv->events.focus_latest_set);
921 wl_signal_init(&priv->events.iconify);
922 wl_signal_init(&priv->events.uniconify);
923 wl_signal_init(&priv->events.maximize);
924 wl_signal_init(&priv->events.unmaximize);
925 wl_signal_init(&priv->events.fullscreen_pre);
926 wl_signal_init(&priv->events.fullscreen);
927 wl_signal_init(&priv->events.unfullscreen);
928 wl_signal_init(&priv->events.move);
929 wl_signal_init(&priv->events.set_layer);
930 wl_signal_init(&priv->events.raise);
931 wl_signal_init(&priv->events.lower);
932 wl_signal_init(&priv->events.stack_below);
933 wl_signal_init(&priv->events.stack_above);
934 wl_signal_init(&priv->events.stack_transient_for_done);
935 wl_signal_init(&priv->events.stick);
936 wl_signal_init(&priv->events.unstick);
937 #ifdef REFACTOR_DESK_AREA
938 wl_signal_init(&priv->events.get_above);
939 wl_signal_init(&priv->events.get_below);
940 wl_signal_init(&priv->events.get_visible_above);
941 wl_signal_init(&priv->events.get_visible_below);
942 wl_signal_init(&priv->events.subsurface_stack_update);
945 e_object_data_set(E_OBJECT(ec), priv);
951 _e_client_private_finish(E_Client *ec)
953 E_Client_Private *priv;
956 e_object_data_set(E_OBJECT(ec), NULL);
962 _e_client_free(E_Client *ec)
964 g_rec_mutex_lock(&e_comp->ec_list_mutex);
966 e_comp_object_redirected_set(ec->frame, 0);
967 e_comp_object_render_update_del(ec->frame);
969 E_OBJECT(ec)->references++;
972 e_comp->new_clients--;
974 if (ec->e.state.video_parent && ec->e.state.video_parent_client)
976 ec->e.state.video_parent_client->e.state.video_child =
977 eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
979 if (ec->e.state.video_child)
983 EINA_LIST_FREE(ec->e.state.video_child, tmp)
984 tmp->e.state.video_parent_client = NULL;
986 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
988 E_FREE_FUNC(ec->map_timer, ecore_timer_del);
990 ec->transients = eina_list_free(ec->transients);
991 eina_stringshare_replace(&ec->border.name, NULL);
992 eina_stringshare_replace(&ec->bordername, NULL);
993 eina_stringshare_replace(&ec->icccm.name, NULL);
994 #if defined(__cplusplus) || defined(c_plusplus)
995 eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
997 eina_stringshare_replace(&ec->icccm.class, NULL);
999 eina_stringshare_replace(&ec->icccm.title, NULL);
1000 eina_stringshare_replace(&ec->icccm.window_role, NULL);
1001 eina_stringshare_replace(&ec->netwm.name, NULL);
1003 E_FREE_FUNC(ec->frame, evas_object_del);
1005 E_OBJECT(ec)->references--;
1006 ELOGF("COMP", "CLIENT FREE", ec);
1008 e_uuid_store_entry_del(ec->uuid);
1010 _e_client_private_finish(ec);
1013 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1017 _e_client_del(E_Client *ec)
1022 g_rec_mutex_lock(&e_comp->ec_list_mutex);
1026 if (ec == e_comp_object_dim_client_get())
1028 INF("[DIM] client deleted\n");
1029 e_comp_object_dim_client_set(NULL);
1032 if (ec->cur_mouse_action)
1034 if (ec->cur_mouse_action->func.end)
1035 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1037 if (action_client == ec) _e_client_action_finish();
1041 e_client_comp_hidden_set(ec, 1);
1042 evas_object_pass_events_set(ec->frame, 1);
1045 E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
1047 wl_signal_emit_mutable(&PRI(ec)->events.destroy, NULL);
1049 /* must be called before parent/child clear */
1050 _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
1052 _e_client_event_remove(ec);
1054 ELOGF("COMP", "CLIENT DEL", ec);
1058 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
1061 EINA_LIST_FREE(ec->transients, child)
1062 child->parent = NULL;
1064 type = e_pixmap_type_get(ec->pixmap);
1065 if (type < E_PIXMAP_TYPE_MAX)
1066 eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
1067 e_comp->clients = eina_list_remove(e_comp->clients, ec);
1068 e_comp_object_render_update_del(ec->frame);
1069 e_comp_post_update_purge(ec);
1070 if (e_pixmap_free(ec->pixmap))
1071 e_pixmap_client_set(ec->pixmap, NULL);
1074 // base_output_resolution
1075 e_util_transform_del(ec->base_output_resolution.transform);
1076 ec->base_output_resolution.transform = NULL;
1077 E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
1079 if (ec->transform_core.transform_list)
1081 E_Util_Transform *transform;
1083 EINA_LIST_FREE(ec->transform_core.transform_list, transform)
1085 e_util_transform_unref(transform);
1089 ec->transform_core.result.enable = EINA_FALSE;
1091 _e_client_resize_object_del(ec);
1093 e_comp_visibility_calculation_set(EINA_TRUE);
1095 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1098 ///////////////////////////////////////////
1101 _e_client_cb_kill_timer(void *data)
1103 E_Client *ec = data;
1105 // dont wait until it's hung -
1108 if (ec->netwm.pid > 1)
1109 kill(ec->netwm.pid, SIGKILL);
1111 ec->kill_timer = NULL;
1112 return ECORE_CALLBACK_CANCEL;
1116 _e_client_cb_ping_poller(void *data)
1121 if (e_object_is_del(E_OBJECT(ec)))
1123 ec->ping_poller = NULL;
1124 return ECORE_CALLBACK_CANCEL;
1132 evas_object_smart_callback_call(ec->frame, "unhung", NULL);
1133 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1138 /* if time between last ping and now is greater
1139 * than half the ping interval... */
1140 if ((ecore_loop_time_get() - ec->ping) >
1141 ((e_config->ping_clients_interval *
1142 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
1147 evas_object_smart_callback_call(ec->frame, "hung", NULL);
1148 /* FIXME: if below dialog is up - hide it now */
1150 if (ec->delete_requested)
1152 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
1153 e_client_act_kill_begin(ec);
1157 ec->ping_poller = NULL;
1159 return ECORE_CALLBACK_CANCEL;
1162 ///////////////////////////////////////////
1165 _e_client_action_input_win_new(void)
1169 CRI("DOUBLE COMP GRAB! ACK!!!!");
1172 comp_grabbed = e_comp_grab_input(1, 1);
1173 if (!comp_grabbed) _e_client_action_input_win_del();
1174 return comp_grabbed;
1178 _e_client_action_init(E_Client *ec)
1180 action_orig.x = ec->x;
1181 action_orig.y = ec->y;
1182 action_orig.w = ec->w;
1183 action_orig.h = ec->h;
1187 action_client->keyboard_resizing = 0;
1193 _e_client_move_begin(E_Client *ec)
1195 if ((ec->fullscreen) || (ec->lock_user_location))
1198 if (!_e_client_action_input_win_new()) return 0;
1202 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
1203 _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
1206 if (ecmove == ec) ecmove = NULL;
1207 _e_client_action_input_win_del();
1210 if (!ec->lock_user_stacking)
1212 if (e_config->border_raise_on_mouse_action)
1217 e_comp_client_override_add(ec);
1223 _e_client_move_end(E_Client *ec)
1226 _e_client_action_input_win_del();
1228 wl_signal_emit_mutable(&PRI(ec)->events.move_end, NULL);
1229 _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
1231 if (ec->transformed)
1232 _e_client_transform_move_end(ec);
1235 e_comp_client_override_del(ec);
1242 _e_client_action_move_timeout(void *data EINA_UNUSED)
1244 _e_client_move_end(action_client);
1245 _e_client_action_finish();
1246 return ECORE_CALLBACK_CANCEL;
1250 _e_client_action_move_timeout_add(void)
1252 E_FREE_FUNC(action_timer, ecore_timer_del);
1253 if (e_config->border_keyboard.timeout)
1254 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
1258 _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1260 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1263 ERR("no action_client!");
1265 if (action_client) _e_client_move_end(action_client);
1266 _e_client_action_finish();
1267 return ECORE_CALLBACK_DONE;
1271 _e_client_moveinfo_gather(E_Client *ec, const char *source)
1273 if (e_util_glob_match(source, "mouse,*,1"))
1274 ec->moveinfo.down.button = 1;
1275 else if (e_util_glob_match(source, "mouse,*,2"))
1276 ec->moveinfo.down.button = 2;
1277 else if (e_util_glob_match(source, "mouse,*,3"))
1278 ec->moveinfo.down.button = 3;
1280 ec->moveinfo.down.button = 0;
1281 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1283 ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
1284 ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
1288 ec->moveinfo.down.mx = ec->mouse.current.mx;
1289 ec->moveinfo.down.my = ec->mouse.current.my;
1294 _e_client_move_handle(E_Client *ec)
1298 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1300 x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
1301 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1302 y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
1303 (ec->mouse.current.my - ec->moveinfo.down.my);
1307 x = ec->moveinfo.down.x +
1308 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1309 y = ec->moveinfo.down.y +
1310 (ec->mouse.current.my - ec->moveinfo.down.my);
1313 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1314 _e_client_stay_within_canvas(ec, x, y, &x, &y);
1317 _e_client_stay_within_canvas_margin(ec, x, y, &x, &y);
1319 evas_object_move(ec->frame, x, y);
1321 if (e_client_transform_core_enable_get(ec))
1323 e_client_transform_core_update(ec);
1327 static Evas_Object *
1328 _e_client_resize_object_rectangle_get(E_Client *ec)
1330 Evas_Object *resize_obj = NULL;
1332 resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame));
1333 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1335 if (e_config->resize_object.customize)
1337 evas_object_color_set(resize_obj,
1338 e_config->resize_object.r,
1339 e_config->resize_object.g,
1340 e_config->resize_object.b,
1341 e_config->resize_object.a);
1344 evas_object_color_set(resize_obj, 128, 128, 128, 100);
1349 static Evas_Object *
1350 _e_client_resize_object_image_get(E_Client *ec)
1353 Evas_Object *resize_obj = NULL;
1355 if (!e_config->resize_object.image_path)
1357 ELOGF("COMP", "NO resize_object image! Make default resize_object", ec);
1361 resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame));
1362 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1364 evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL);
1365 err = evas_object_image_load_error_get(resize_obj);
1366 if (err != EVAS_LOAD_ERROR_NONE)
1368 ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object",
1369 ec, e_config->resize_object.image_path, err);
1370 evas_object_del(resize_obj);
1375 evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h);
1376 evas_object_image_filled_set(resize_obj, EINA_TRUE);
1378 evas_object_image_border_set(resize_obj,
1379 e_config->resize_object.border_width.l,
1380 e_config->resize_object.border_width.r,
1381 e_config->resize_object.border_width.t,
1382 e_config->resize_object.border_width.b);
1387 return _e_client_resize_object_rectangle_get(ec);
1390 static Evas_Object *
1391 _e_client_resize_object_create(E_Client *ec)
1393 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL);
1395 Evas_Object *resize_obj = NULL;
1397 if (_e_client_resize_object_create_cb)
1398 resize_obj = _e_client_resize_object_create_cb(ec);
1401 if (e_config->resize_object.type == 1) // image object
1403 resize_obj = _e_client_resize_object_image_get(ec);
1407 resize_obj = _e_client_resize_object_rectangle_get(ec);
1410 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1412 evas_object_pass_events_set(resize_obj, EINA_TRUE);
1413 evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame));
1414 evas_object_stack_above(resize_obj, ec->frame);
1415 evas_object_name_set(resize_obj, "resize_object");
1421 _e_client_resize_object_del(E_Client *ec)
1423 if (ec == NULL) return;
1424 if (ec->manage_resize.resize_obj == NULL) return;
1426 evas_object_hide(ec->manage_resize.resize_obj);
1427 evas_object_del(ec->manage_resize.resize_obj);
1428 ec->manage_resize.resize_obj = NULL;
1432 _e_client_resize_handle(E_Client *ec)
1435 int new_x, new_y, new_w, new_h;
1437 int trans_x = 0, trans_y = 0;
1438 int trans_w = 0, trans_h = 0;
1440 if (ec->transformed)
1442 _e_client_transform_resize_handle(ec);
1451 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
1452 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1453 (ec->resize_mode == E_POINTER_RESIZE_BR))
1455 if ((ec->moveinfo.down.button >= 1) &&
1456 (ec->moveinfo.down.button <= 3))
1457 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
1458 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1460 w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
1462 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1463 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1464 (ec->resize_mode == E_POINTER_RESIZE_BL))
1466 if ((ec->moveinfo.down.button >= 1) &&
1467 (ec->moveinfo.down.button <= 3))
1468 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
1469 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1471 w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
1474 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1475 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1476 (ec->resize_mode == E_POINTER_RESIZE_TR))
1478 if ((ec->moveinfo.down.button >= 1) &&
1479 (ec->moveinfo.down.button <= 3))
1480 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
1481 (ec->mouse.current.my - ec->moveinfo.down.my);
1483 h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
1485 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
1486 (ec->resize_mode == E_POINTER_RESIZE_B) ||
1487 (ec->resize_mode == E_POINTER_RESIZE_BR))
1489 if ((ec->moveinfo.down.button >= 1) &&
1490 (ec->moveinfo.down.button <= 3))
1491 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
1492 (ec->mouse.current.my - ec->moveinfo.down.my);
1494 h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
1499 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1500 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1501 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1502 (ec->resize_mode == E_POINTER_RESIZE_BL))
1504 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1505 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1506 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1507 (ec->resize_mode == E_POINTER_RESIZE_TR))
1514 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1517 zone = e_comp_zone_find_by_ec(ec);
1520 w = MIN(w, zone->w);
1521 h = MIN(h, zone->h);
1524 e_client_resize_limit(ec, &new_w, &new_h);
1526 if (ec->manage_resize.enable_aspect_ratio)
1528 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1529 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1530 (ec->resize_mode == E_POINTER_RESIZE_BL) ||
1531 (ec->resize_mode == E_POINTER_RESIZE_TR) ||
1532 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1533 (ec->resize_mode == E_POINTER_RESIZE_BR))
1535 new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w;
1537 else if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1538 (ec->resize_mode == E_POINTER_RESIZE_B))
1540 new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h;
1542 new_h += ec->manage_resize.header_h;
1543 new_h += ec->manage_resize.footer_h;
1546 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1547 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1548 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1549 (ec->resize_mode == E_POINTER_RESIZE_BL))
1550 new_x += (w - new_w);
1551 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1552 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1553 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1554 (ec->resize_mode == E_POINTER_RESIZE_TR))
1555 new_y += (h - new_h);
1557 if (e_config->interactive_resize)
1559 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
1563 if (ec->manage_resize.resize_obj == NULL)
1565 ec->manage_resize.resize_obj = _e_client_resize_object_create(ec);
1566 EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj);
1569 if (e_client_transform_core_enable_get(ec))
1571 e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y);
1572 e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h);
1573 evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h);
1576 evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h);
1577 evas_object_show(ec->manage_resize.resize_obj);
1579 ec->manage_resize.x = new_x;
1580 ec->manage_resize.y = new_y;
1581 ec->manage_resize.w = new_w;
1582 ec->manage_resize.h = new_h;
1587 _e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
1589 if (ppu <= 1) return size;
1591 unsigned int remainder = size % ppu;
1592 if (remainder == 0) return size;
1594 int gap = size - start_size;
1595 int new_size = size;
1597 new_size = size + (ppu - remainder);
1599 new_size = size - remainder;
1605 _e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
1609 if (prev_pos == pos)
1612 new_pos = (prev_pos + prev_size) - size;
1618 _e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
1620 if (ec->manage_resize.unit_size <= 1) return;
1622 ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
1623 ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
1625 ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
1626 ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
1630 _e_client_resize_end(E_Client *ec)
1632 ec->resize_mode = E_POINTER_RESIZE_NONE;
1633 _e_client_action_input_win_del();
1635 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_end, NULL);
1636 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
1638 if (ec->transformed)
1639 _e_client_transform_resize_end(ec);
1642 e_comp_client_override_del(ec);
1646 if (!e_config->interactive_resize)
1648 if (ec->manage_resize.resize_obj)
1650 if (ec->manage_resize.unit_size > 1)
1651 _e_client_adjust_geometry_by_resize_ppu(ec);
1653 e_client_frame_geometry_set(ec,
1654 ec->manage_resize.x,
1655 ec->manage_resize.y,
1656 ec->manage_resize.w,
1657 ec->manage_resize.h);
1658 _e_client_resize_object_del(ec);
1666 _e_client_action_resize_timeout(void *data EINA_UNUSED)
1668 _e_client_resize_end(action_client);
1669 _e_client_action_finish();
1670 return ECORE_CALLBACK_CANCEL;
1674 _e_client_action_resize_timeout_add(void)
1676 E_FREE_FUNC(action_timer, ecore_timer_del);
1677 if (e_config->border_keyboard.timeout)
1678 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
1682 _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1684 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1687 ERR("no action_client!");
1689 if (action_client) _e_client_resize_end(action_client);
1690 _e_client_action_finish();
1691 return ECORE_CALLBACK_DONE;
1694 ////////////////////////////////////////////////
1697 _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty)
1700 Eina_Bool res = EINA_FALSE;
1701 Eina_List *list = NULL, *l;
1702 Eina_Rectangle *data;
1704 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
1706 e_client_geometry_get(ec, &x, &y, &w, &h);
1707 e_comp_object_input_rect_get(ec->frame, &list);
1710 EINA_LIST_FOREACH(list, l, data)
1712 if ((tx >= x + data->x) && (tx <= x + data->x + data->w) &&
1713 (ty >= y + data->y) && (ty <= y + data->y + data->h))
1719 list = eina_list_free(list);
1723 if ((tx >= x) && (tx <= x + w) &&
1724 (ty >= y) && (ty <= y + h))
1734 _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *client)
1736 /* If a border was specified which should be excluded from the list
1737 * (because it will be closed shortly for example), skip */
1738 if (e_client_util_ignored_get(client) || (!e_desk_has_ec(desk, client))) return EINA_TRUE;
1739 if (!evas_object_visible_get(client->frame)) return EINA_TRUE;
1740 if (e_policy_client_is_cursor(client)) return EINA_TRUE;
1741 if (e_comp_wl->drag_client == client) return EINA_TRUE;
1747 _e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
1749 E_Client *ec = NULL, *cec;
1751 E_CLIENT_REVERSE_FOREACH(cec)
1753 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1754 if ((exclude) && (cec == exclude)) continue;
1755 if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1757 /* If the layer is higher, the position of the window is higher
1758 * (always on top vs always below) */
1759 if (!ec || (cec->layer > ec->layer))
1766 _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
1768 E_Client *ec = NULL, *cec;
1770 E_CLIENT_REVERSE_FOREACH(cec)
1772 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1774 Eina_List *list = NULL;
1775 Eina_Rectangle *rect;
1776 Eina_Bool inside = EINA_FALSE;
1777 e_comp_object_input_rect_get(cec->frame, &list);
1780 EINA_LIST_FREE(list, rect)
1782 if (E_INSIDE(x, y, rect->x, rect->y, rect->w, rect->h))
1786 else if (E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1791 if (!inside) continue;
1792 /* If the layer is higher, the position of the window is higher
1793 * (always on top vs always below) */
1794 if (!ec || (cec->layer > ec->layer))
1801 ////////////////////////////////////////////////
1804 _e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
1807 E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
1810 zone = e_comp_zone_find_by_ec(ec);
1817 if (eina_list_count(e_comp->zones) == 1)
1826 zone_left = e_comp_zone_xy_get((x - w + 5), y);
1827 zone_right = e_comp_zone_xy_get((x + w + 5), y);
1828 zone_above = e_comp_zone_xy_get(x, (y - h + 5));
1829 zone_below = e_comp_zone_xy_get(x, (y + h + 5));
1831 if (!(zone_above) && (y))
1832 zone_above = e_comp_zone_xy_get(x, (h - 5));
1834 if (!(zone_left) && (x))
1835 zone_left = e_comp_zone_xy_get((x - 5), y);
1838 w = zone_right->x + zone_right->w;
1841 w = zone->x + zone->w;
1844 h = zone_below->y + zone_below->h;
1847 h = zone->y + zone->h;
1849 if ((zone_left) && (zone_right))
1850 w = zone->w + zone_right->x;
1852 if ((zone_above) && (zone_below))
1853 h = zone->h + zone_below->y;
1855 if (x) x -= zone->w;
1856 if (y) y -= zone->h;
1858 if (zx) *zx = x > 0 ? x : 0;
1859 if (zy) *zy = y > 0 ? y : 0;
1865 _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
1867 int new_x_max, new_y_max;
1872 zone = e_comp_zone_find_by_ec(ec);
1875 if (new_x) *new_x = x;
1876 if (new_y) *new_y = y;
1880 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1882 new_x_max = zw - ec->w;
1883 new_y_max = zh - ec->h;
1884 lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
1885 lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
1919 _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
1921 int new_x_max, new_y_max, new_x_min, new_y_min;
1922 int margin_w, margin_h;
1927 zone = e_comp_zone_find_by_ec(ec);
1930 if (new_x) *new_x = x;
1931 if (new_y) *new_y = y;
1938 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1943 new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
1944 new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
1945 new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
1946 new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
1950 else if (x <= new_x_min)
1955 else if (y <= new_y_min)
1960 ////////////////////////////////////////////////
1963 _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set)
1965 if (ec->transform_core.activate == set) return;
1967 ec->transform_core.activate = set;
1971 if (ec->transform_core.result.enable)
1972 e_client_map_enable_set(ec, EINA_TRUE);
1976 e_client_map_enable_set(ec, EINA_FALSE);
1981 _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1983 E_Client *ec = data;
1985 if (stopping) return; //ignore all of this if we're shutting down!
1986 if (e_object_is_del(data)) return; //client is about to die
1987 if (ec->cur_mouse_action)
1989 if (ec->cur_mouse_action->func.end_mouse)
1990 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
1991 else if (ec->cur_mouse_action->func.end)
1992 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1993 E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
1995 if (action_client == ec) _e_client_action_finish();
1997 ec->want_focus = ec->take_focus = 0;
1999 _e_client_transform_core_activate_set(ec, EINA_FALSE);
2001 if (ec->new_client) return;
2002 _e_client_event_hide(ec);
2008 _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2010 E_Client *ec = data;
2014 if (e_object_is_del(data)) return;
2016 ec->pre_res_change.valid = 0;
2018 _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
2020 evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
2021 if ((e_config->transient.move) && (ec->transients))
2023 Eina_List *list = eina_list_clone(ec->transients);
2026 EINA_LIST_FREE(list, child)
2028 if (child->vkbd.vkbd) continue;
2030 evas_object_move(child->frame,
2031 child->x + x - ec->pre_cb.x,
2032 child->y + y - ec->pre_cb.y);
2035 if (ec->moving || (ecmove == ec))
2037 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2038 _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
2041 if ((!ec->moving) && (ec->transformed))
2043 map = e_client_map_get(ec);
2044 _e_client_transform_geometry_save(ec, map);
2048 ec->pre_cb.x = x; ec->pre_cb.y = y;
2050 wl_signal_emit_mutable(&PRI(ec)->events.move, NULL);
2052 e_comp_visibility_calculation_set(EINA_TRUE);
2056 _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2058 E_Client *ec = data;
2059 Evas_Coord x, y, w, h;
2061 if (e_object_is_del(data)) return;
2063 ec->pre_res_change.valid = 0;
2065 _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
2067 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
2068 if ((e_config->transient.resize) && (ec->transients))
2070 Eina_List *list = eina_list_clone(ec->transients);
2073 EINA_LIST_FREE(list, child)
2075 Evas_Coord nx, ny, nw, nh;
2077 if ((ec->pre_cb.w > 0) && (ec->pre_cb.h > 0))
2079 nx = x + (((child->x - x) * w) / ec->pre_cb.w);
2080 ny = y + (((child->y - y) * h) / ec->pre_cb.h);
2081 nw = (child->w * w) / ec->pre_cb.w;
2082 nh = (child->h * h) / ec->pre_cb.h;
2083 nx += ((nw - child->w) / 2);
2084 ny += ((nh - child->h) / 2);
2085 evas_object_move(child->frame, nx, ny);
2090 if (e_client_util_resizing_get(ec) || (ecresize == ec))
2092 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2093 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
2095 ec->pre_cb.w = w; ec->pre_cb.h = h;
2097 e_client_transform_core_update(ec);
2098 e_comp_visibility_calculation_set(EINA_TRUE);
2102 _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2104 E_Client *ec = data;
2106 if (e_object_is_del(data)) return;
2108 _e_client_transform_core_activate_set(ec, EINA_TRUE);
2110 _e_client_event_show(ec);
2115 _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2117 E_Client *ec = data;
2118 E_Comp_Wl_Client_Data *child_cdata = NULL;
2120 if (e_object_is_del(data)) return;
2121 if (ec->layer_block) return;
2122 if (ec->layer_pending) return;
2123 if (e_config->transient.raise && ec->transients)
2125 Eina_List *list = eina_list_clone(ec->transients);
2126 E_Client *child, *below = NULL, *above = NULL;
2127 E_Transient transient_policy;
2129 E_LIST_REVERSE_FREE(list, child)
2131 child_cdata = e_client_cdata_get(child);
2132 if (child_cdata && !child_cdata->mapped)
2134 ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child));
2138 /* Don't stack iconic transients. If the user wants these shown,
2139 * that's another option.
2141 if (child->iconic && e_client_is_iconified_by_client(child)) continue;
2143 transient_policy = e_client_transient_policy_get(child);
2144 if (transient_policy == E_TRANSIENT_ABOVE)
2147 e_client_stack_below(child, below);
2149 e_client_stack_above(child, ec);
2152 else if (transient_policy == E_TRANSIENT_BELOW)
2155 e_client_stack_below(child, above);
2157 e_client_stack_below(child, ec);
2163 _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
2165 e_comp_visibility_calculation_set(EINA_TRUE);
2168 ////////////////////////////////////////////////
2170 _e_client_aux_hint_eval(E_Client *ec)
2174 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2176 E_Comp_Wl_Aux_Hint *hint;
2178 if (cdata && cdata->aux_hint.changed)
2180 wl_signal_emit_mutable(&PRI(ec)->events.aux_hint_change, NULL);
2181 _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
2183 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
2185 hint->changed = EINA_FALSE;
2188 ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec, hint->id, hint->hint, hint->val);
2189 if (hint->hint) eina_stringshare_del(hint->hint);
2190 if (hint->val) eina_stringshare_del(hint->val);
2191 cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
2195 cdata->aux_hint.changed = 0;
2200 _e_client_eval(E_Client *ec)
2203 unsigned int prop = 0;
2206 if (e_object_is_del(E_OBJECT(ec)))
2208 CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
2213 TRACE_DS_BEGIN(CLIENT:EVAL);
2215 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_new_client, NULL);
2216 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec))
2222 if ((ec->new_client) && (!e_client_util_ignored_get(ec)))
2224 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2225 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2232 if (ec->changes.size)
2234 ec->changes.size = 0;
2235 evas_object_resize(ec->frame, ec->w, ec->h);
2237 prop |= E_CLIENT_PROPERTY_SIZE;
2239 if (ec->changes.pos)
2241 ec->changes.tz_position = 0;
2242 ec->changes.pos = 0;
2243 evas_object_move(ec->frame, ec->x, ec->y);
2244 prop |= E_CLIENT_PROPERTY_POS;
2247 if (ec->changes.reset_gravity)
2249 ec->changes.reset_gravity = 0;
2250 prop |= E_CLIENT_PROPERTY_GRAVITY;
2253 if (ec->changes.title)
2255 ec->changes.title = 0;
2256 prop |= E_CLIENT_PROPERTY_TITLE;
2259 if ((ec->changes.visible) && (ec->visible) && (ec->new_client) && (!ec->iconic))
2263 e_input_device_pointer_xy_get(NULL, &x, &y);
2264 if ((!ec->placed) && (!ec->re_manage) &&
2265 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
2266 (!((ec->icccm.transient_for != 0) ||
2268 (!ecmove) && (!ecresize))
2270 /* Set this window into moving state */
2272 ec->cur_mouse_action = e_action_find("window_move");
2273 if (ec->cur_mouse_action)
2275 if ((!ec->cur_mouse_action->func.end_mouse) &&
2276 (!ec->cur_mouse_action->func.end))
2277 ec->cur_mouse_action = NULL;
2278 if (ec->cur_mouse_action)
2281 tx = x - (ec->w >> 1);
2282 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
2284 e_client_pos_set(ec, tx, ty);
2286 ec->changes.pos = 1;
2291 evas_object_show(ec->frame);
2292 if (evas_object_visible_get(ec->frame))
2294 ec->changes.visible = 0;
2295 _e_client_event_show(ec);
2298 else if ((ec->changes.visible) && (ec->new_client))
2300 ec->changes.visible = 0;
2302 _e_client_event_hide(ec);
2305 if (ec->changes.icon)
2307 ec->changes.icon = 0;
2311 e_comp->new_clients--;
2313 ec->changed = ec->changes.pos || ec->changes.size ||
2314 ec->changes.stack || ec->changes.prop || ec->changes.border ||
2315 ec->changes.reset_gravity ||
2316 ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
2317 ec->changes.internal_state ||
2318 ec->changes.need_maximize || ec->changes.need_unmaximize;
2319 ec->changes.stack = 0;
2321 if (ec->changes.need_maximize)
2323 E_Maximize max = ec->maximized;
2324 ec->maximized = E_MAXIMIZE_NONE;
2325 e_client_maximize(ec, max);
2326 ec->changes.need_maximize = 0;
2328 else if (ec->changes.need_unmaximize)
2330 e_client_unmaximize(ec, ec->maximized);
2331 ec->changes.need_unmaximize = 0;
2334 if (ec->need_fullscreen)
2336 e_client_fullscreen(ec, e_config->fullscreen_policy);
2337 ec->need_fullscreen = 0;
2340 if (ec->changes.accepts_focus)
2342 if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus))
2345 ec->changes.accepts_focus = 0;
2349 if (send_event && prop)
2351 _e_client_event_property(ec, prop);
2354 _e_client_aux_hint_eval(ec);
2356 e_client_transform_core_update(ec);
2358 wl_signal_emit_mutable(&PRI(ec)->events.eval_end, NULL);
2359 _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
2365 e_client_frame_update(E_Client *ec)
2367 const char *bordername;
2369 EINA_SAFETY_ON_NULL_RETURN(ec);
2370 if (e_object_is_del(E_OBJECT(ec))) return;
2372 ec->border.changed = 0;
2373 if (!e_comp_object_frame_allowed(ec->frame)) return;
2374 if (ec->fullscreen || ec->borderless)
2375 bordername = "borderless";
2376 else if (ec->bordername)
2377 bordername = ec->bordername;
2378 else if (((ec->icccm.transient_for != 0) || (ec->dialog)) &&
2379 (ec->icccm.min_w == ec->icccm.max_w) &&
2380 (ec->icccm.min_h == ec->icccm.max_h))
2381 bordername = "noresize_dialog";
2382 else if ((ec->icccm.min_w == ec->icccm.max_w) &&
2383 (ec->icccm.min_h == ec->icccm.max_h))
2384 bordername = "noresize";
2385 else if (ec->shaped)
2386 bordername = "shaped";
2387 else if ((ec->netwm.state.skip_taskbar) ||
2388 (ec->netwm.state.skip_pager))
2389 bordername = "skipped";
2391 else if ((ec->internal) && (ec->icccm.class) &&
2392 (!strncmp(ec->icccm.class, "e_fwin", 6)))
2393 bordername = "internal_fileman";
2396 bordername = e_config->theme_default_border_style;
2397 if (!bordername) bordername = "default";
2399 e_client_border_set(ec, bordername);
2403 _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
2405 if (!ec || !m) return EINA_FALSE;
2406 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
2408 if ((int)ec->netwm.type != m->window_type)
2411 #if defined(__cplusplus) || defined(c_plusplus)
2414 if (!ec->icccm.cpp_class)
2417 if (!e_util_glob_match(ec->icccm.cpp_class, m->clas))
2423 if (!ec->icccm.class)
2426 if (!e_util_glob_match(ec->icccm.class, m->clas))
2433 if (ec->icccm.name && e_util_glob_match(ec->icccm.name, m->name))
2436 if (ec->icccm.title && e_util_glob_match(ec->icccm.title, m->name))
2439 if (ec->netwm.name && e_util_glob_match(ec->netwm.name, m->name))
2447 e_client_type_update(E_Client *ec)
2449 E_Config_Client_Type *m;
2453 if (!e_config->client_types) return 0;
2455 EINA_LIST_FOREACH(e_config->client_types, l, m)
2457 if (!_e_client_type_match(ec, m)) continue;
2460 type = m->client_type;
2465 if (ec->client_type != type)
2467 ec->client_type = type;
2468 _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
2471 return ec->client_type;
2475 _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom)
2477 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2481 int ox = 0, oy = 0, ow, oh;
2485 EINA_SAFETY_ON_FALSE_RETURN(e_comp_wl_subsurface_check(ec));
2487 e_comp_wl_subsurface_position_get(ec, &ox, &oy);
2488 ow = cdata->width_from_viewport;
2489 oh = cdata->height_from_viewport;
2491 map = e_client_map_get(epc);
2492 e_map_point_coord_get(map, 0, &px, &py, 0);
2495 mx = ox * zoom + px;
2496 my = oy * zoom + py;
2500 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
2501 e_map_util_points_populate_from_geometry(map, mx, my, mw, mh, 0);
2502 e_map_util_object_move_sync_set(map, EINA_TRUE);
2503 e_client_map_set(ec, map);
2504 e_client_map_enable_set(ec, EINA_TRUE);
2506 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2507 _e_client_transform_sub_apply(subc, ec, zoom);
2508 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
2509 _e_client_transform_sub_apply(subc, ec, zoom);
2515 _e_client_transient_for_group_make(E_Client *ec, Eina_List **list)
2521 if (!e_config->transient.raise) return;
2523 EINA_LIST_FOREACH(ec->transients, l, child)
2525 if (!child) continue;
2526 if (child->iconic) continue;
2527 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
2529 *list = eina_list_prepend(*list, child);
2530 _e_client_transient_for_group_make(child, list);
2536 e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus)
2538 E_Client *top_ec = NULL;
2539 Eina_List *transient_list = NULL;
2541 _e_client_transient_for_group_make(ec, &transient_list);
2545 Eina_List *l = NULL;
2546 E_Client *temp_ec = NULL;
2547 E_Client *temp_ec2 = NULL;
2549 E_CLIENT_REVERSE_FOREACH(temp_ec)
2558 EINA_LIST_FOREACH(transient_list, l, temp_ec2)
2560 if (temp_ec == temp_ec2)
2564 if ((temp_ec2->icccm.accepts_focus) ||
2565 (temp_ec2->icccm.take_focus))
2578 eina_list_free(transient_list);
2583 #ifdef EC_IS_NOT_VISIBLE
2584 # undef EC_IS_NOT_VISIBLE
2586 #define EC_IS_NOT_VISIBLE if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED)
2589 e_client_visibility_touched_check(E_Client *ec)
2593 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
2595 tx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x);
2596 ty = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y);
2598 return _e_client_position_inside_input_rect(ec, tx, ty);
2602 e_client_visibility_change_notify(E_Client *ec)
2604 EINA_SAFETY_ON_NULL_RETURN(ec);
2606 if (ec->visibility.changed)
2607 _e_client_event_simple(ec, E_EVENT_CLIENT_VISIBILITY_CHANGE);
2609 wl_signal_emit_mutable(&PRI(ec)->events.eval_visibility, NULL);
2610 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY, ec);
2614 e_client_visibility_end_notify(void)
2616 // FIXME: This hook means that the visiblitiy calculation of a zone is done
2617 // at this idle handler.This is a hook for a zone, not for a client.
2618 // Therefore, this hook may be defined as a zone hook,
2619 // ex) E_ZONE_HOOK_EVAL_VISIBILITY_END or E_ZONE_HOOK_EVAL_VISIBILITY_DONE.
2620 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY_END, NULL);
2624 _e_client_transform_core_check_change(E_Client *ec)
2628 Eina_Bool check = EINA_FALSE;
2629 if (!ec) return EINA_FALSE;
2632 evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
2634 // check client position or size change
2635 if (ec->x != ec->transform_core.backup.client_x ||
2636 ec->y != ec->transform_core.backup.client_y ||
2637 ec->w != ec->transform_core.backup.client_w ||
2638 ec->h != ec->transform_core.backup.client_h ||
2639 w != ec->transform_core.backup.frame_w ||
2640 h != ec->transform_core.backup.frame_h ||
2641 ec->argb != ec->transform_core.backup.argb)
2644 ec->transform_core.backup.client_x = ec->x;
2645 ec->transform_core.backup.client_y = ec->y;
2646 ec->transform_core.backup.client_w = ec->w;
2647 ec->transform_core.backup.client_h = ec->h;
2648 ec->transform_core.backup.frame_w = w;
2649 ec->transform_core.backup.frame_h = h;
2650 ec->transform_core.backup.argb = ec->argb;
2653 // check new transform or del transform
2654 if (ec->transform_core.changed)
2657 ec->transform_core.changed = EINA_FALSE;
2660 // check each transform change
2661 if (ec->transform_core.transform_list)
2665 E_Util_Transform *transform;
2667 EINA_LIST_FOREACH_SAFE(ec->transform_core.transform_list, l, l_next, transform)
2669 // del transform check
2670 if (e_util_transform_ref_count_get(transform) <= 1)
2672 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
2673 e_util_transform_unref(transform);
2678 // transform change test
2679 if (e_util_transform_change_get(transform))
2682 e_util_transform_change_unset(transform);
2687 if (e_comp_wl_subsurface_check(ec))
2689 // check parent matrix change
2690 E_Client *parent = e_comp_wl_subsurface_parent_get(ec);
2691 if (parent && parent->transform_core.result.enable)
2693 ec->transform_core.parent.enable = EINA_TRUE;
2695 if (!e_util_transform_matrix_equal_check(&ec->transform_core.parent.matrix,
2696 &parent->transform_core.result.matrix))
2699 ec->transform_core.parent.matrix = parent->transform_core.result.matrix;
2701 if (memcmp(&ec->transform_core.parent.zoom, &parent->transform_core.result.transform.zoom, sizeof(E_Util_Transform_Zoom)) != 0)
2704 ec->transform_core.parent.zoom = parent->transform_core.result.transform.zoom;
2707 else if (ec->transform_core.parent.enable)
2709 ec->transform_core.parent.enable = EINA_FALSE;
2710 e_util_transform_matrix_load_identity(&ec->transform_core.parent.matrix);
2711 ec->transform_core.parent.zoom.zoom_x = 1.0;
2712 ec->transform_core.parent.zoom.zoom_y = 1.0;
2713 ec->transform_core.parent.zoom.cx = 0;
2714 ec->transform_core.parent.zoom.cy = 0;
2723 _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2725 int minx = 99999, miny = 99999;
2726 int maxx = -99999, maxy = -99999;
2731 if (!ec->frame) return;
2732 if (!ec->transform_core.result.enable) return;
2733 if (!vertices) return;
2735 for (i = 0; i < 4; ++i)
2740 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2742 if (x < minx) minx = x;
2743 if (y < miny) miny = y;
2744 if (x > maxx) maxx = x;
2745 if (y > maxy) maxy = y;
2748 ec->transform_core.result.boundary.x = minx;
2749 ec->transform_core.result.boundary.y = miny;
2750 ec->transform_core.result.boundary.w = maxx - minx;
2751 ec->transform_core.result.boundary.h = maxy - miny;
2753 ELOGF("COMP", "[Transform][boundary][%d %d %d %d]",
2755 ec->transform_core.result.boundary.x,
2756 ec->transform_core.result.boundary.y,
2757 ec->transform_core.result.boundary.w,
2758 ec->transform_core.result.boundary.h);
2762 _e_client_transform_core_map_new(Evas_Object *obj,
2763 E_Util_Transform_Rect_Vertex *vertices,
2764 E_Util_Transform *transform,
2765 Eina_Bool direct_render)
2772 map = e_map_new_with_direct_render(direct_render);
2773 EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL);
2775 e_map_util_points_populate_from_object_full(map, obj, 0);
2776 e_map_util_points_color_set(map, 255, 255, 255, 255);
2778 for (i = 0 ; i < 4 ; ++i)
2783 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2784 e_map_point_coord_set(map, i, x, y, 1.0);
2786 if (transform && e_util_transform_texcoord_flag_get(transform))
2791 e_util_transform_texcoord_get(transform, i, &u, &v);
2792 e_map_point_image_uv_set(map, i, u, v);
2800 _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec,
2802 E_Util_Transform_Rect_Vertex *vertices,
2803 E_Util_Transform *transform,
2804 E_Util_Transform_Zoom zoom)
2812 map = _e_client_transform_core_map_new(obj, vertices, transform,
2813 ec->transform_core.direct_render);
2814 EINA_SAFETY_ON_NULL_RETURN(map);
2816 e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy);
2818 e_comp_object_map_set(obj, map);
2820 if (ec->transform_core.activate)
2821 e_comp_object_map_enable_set(obj, EINA_TRUE);
2823 e_comp_object_map_enable_set(obj, EINA_FALSE);
2828 evas_object_map_enable_set(obj, EINA_FALSE);
2832 _e_client_transform_core_vertices_apply(E_Client *ec,
2834 E_Util_Transform_Rect_Vertex *vertices,
2835 E_Util_Transform *transform)
2843 map = _e_client_transform_core_map_new(obj, vertices, transform,
2844 ec->transform_core.direct_render);
2845 EINA_SAFETY_ON_NULL_RETURN(map);
2847 e_comp_object_map_set(obj, map);
2849 if (ec->transform_core.activate)
2850 e_comp_object_map_enable_set(obj, EINA_TRUE);
2852 e_comp_object_map_enable_set(obj, EINA_FALSE);
2857 evas_object_map_enable_set(obj, EINA_FALSE);
2861 _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2865 E_Comp_Wl_Client_Data *cdata;
2869 cdata = e_client_cdata_get(ec);
2872 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2873 e_client_transform_core_update(subc);
2875 EINA_LIST_FOREACH(cdata->sub.below_list, l, subc)
2876 e_client_transform_core_update(subc);
2880 _e_client_cb_hook_shell_surface_ready(void *data EINA_UNUSED, E_Client *ec)
2882 if (EINA_UNLIKELY(!ec))
2885 _e_client_aux_hint_eval(ec);
2888 // FIXME: This function has to be deleted and it remains for the backward compatibility.
2889 // Please find and fix to use e_comp_visibility_calculation_set(EINA_TRUE)
2890 // instead of e_client_visibility_calculate() call at e20 modules.
2892 e_client_visibility_calculate(void)
2894 e_comp_visibility_calculation_set(EINA_TRUE);
2898 e_client_visibility_skip_set(E_Client *ec, Eina_Bool skip)
2902 ELOGF("POL_VIS", "visibility skip set to %d", ec, skip);
2903 ec->visibility.skip = skip;
2907 e_client_post_raise_lower_set(E_Client *ec, Eina_Bool raise_set, Eina_Bool lower_set)
2911 ec->post_raise = raise_set;
2912 ec->post_lower = lower_set;
2916 e_client_first_mapped_get(E_Client *ec)
2918 if (!ec) return EINA_FALSE;
2920 return ec->first_mapped;
2923 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec)
2925 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2926 EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE);
2928 return cdata->mapped;
2932 e_client_mapped_set(E_Client *ec, Eina_Bool set)
2934 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2935 EINA_SAFETY_ON_NULL_RETURN(cdata);
2937 cdata->mapped = set;
2941 ////////////////////////////////////////////////
2943 e_client_clients_hash_exist()
2947 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
2949 if (eina_hash_population(clients_hash[pix_id]))
2957 e_client_idler_before(Eina_Bool *check_focus)
2962 *check_focus = EINA_FALSE;
2964 if (!e_client_clients_hash_exist()) return;
2966 TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
2968 EINA_LIST_FOREACH(e_comp->clients, l, ec)
2970 // pass 1 - eval0. fetch properties on new or on change and
2971 // call hooks to decide what to do - maybe move/resize
2972 if (ec->ignored || (!ec->changed)) continue;
2974 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_fetch, NULL);
2975 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
2978 /* FETCH is hooked by the compositor to get client hints */
2979 wl_signal_emit_mutable(&PRI(ec)->events.eval_fetch, NULL);
2980 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
2984 e_client_type_update(ec);
2987 /* PRE_POST_FETCH calls e_remember apply for new client */
2988 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_post_fetch, NULL);
2989 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
2990 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_fetch, NULL);
2991 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
2992 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_frame_assign, NULL);
2993 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
2995 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_frame_assign, NULL);
2996 _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
2998 // pass 2 - show and hide windows needing hide and eval (main eval)
2999 E_CLIENT_FOREACH(ec)
3001 if (e_object_is_del(E_OBJECT(ec))) continue;
3004 // ignored client but needing eval (aux hint) such as remote surfaces
3007 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3008 if (cdata && cdata->first_commit)
3009 _e_client_aux_hint_eval(ec);
3014 if (ec->changes.visible)
3018 if ((!ec->new_client) &&
3019 (!ec->changes.pos) &&
3020 (!ec->changes.size))
3022 evas_object_show(ec->frame);
3023 ec->changes.visible = !evas_object_visible_get(ec->frame);
3028 evas_object_hide(ec->frame);
3029 ec->changes.visible = 0;
3036 e_comp_visibility_calculation_set(EINA_TRUE);
3037 if (ec->changes.accepts_focus)
3038 *check_focus = EINA_TRUE;
3039 ec->changes.accepts_focus = 0;
3042 if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
3044 evas_object_show(ec->frame);
3045 ec->changes.visible = !evas_object_visible_get(ec->frame);
3046 ec->changed = ec->changes.visible;
3047 e_comp_visibility_calculation_set(EINA_TRUE);
3059 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3060 clients_hash[pix_id] = eina_hash_pointer_new(NULL);
3062 E_COMP_WL_HOOK_APPEND(hooks, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _e_client_cb_hook_shell_surface_ready, NULL);
3064 E_EVENT_CLIENT_ADD = ecore_event_type_new();
3065 E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
3066 E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
3067 E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
3068 E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
3069 E_EVENT_CLIENT_MOVE = ecore_event_type_new();
3070 E_EVENT_CLIENT_SHOW = ecore_event_type_new();
3071 E_EVENT_CLIENT_HIDE = ecore_event_type_new();
3072 E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
3073 E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
3074 E_EVENT_CLIENT_STACK = ecore_event_type_new();
3075 E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
3076 E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
3077 E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
3078 E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
3079 E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
3080 #ifdef _F_ZONE_WINDOW_ROTATION_
3081 E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
3082 E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
3083 E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new();
3084 E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = ecore_event_type_new();
3086 E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new();
3087 E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new();
3088 E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();;
3089 E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();;
3091 return (!!clients_hash[1]);
3095 e_client_shutdown(void)
3098 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3099 E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
3101 E_FREE_LIST(hooks, e_comp_wl_hook_del);
3102 E_FREE_LIST(handlers, ecore_event_handler_del);
3107 e_client_unignore(E_Client *ec)
3110 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3111 if (!ec->ignored) return;
3114 _e_client_event_add(ec);
3118 _e_client_convert_fullscreen_layer(int layer)
3120 if (layer <= E_LAYER_CLIENT_NORMAL)
3121 return E_LAYER_CLIENT_NORMAL;
3122 else if (layer <= E_LAYER_CLIENT_ABOVE)
3123 return E_LAYER_CLIENT_ABOVE;
3124 else if (layer <= E_LAYER_CLIENT_EDGE)
3125 return E_LAYER_CLIENT_EDGE;
3127 return E_LAYER_CLIENT_FULLSCREEN;
3131 e_client_new(E_Pixmap *cp, int first_map, int internal)
3136 type = e_pixmap_type_get(cp);
3137 if (type >= E_PIXMAP_TYPE_MAX) return NULL;
3138 if (eina_hash_find(clients_hash[type], &cp)) return NULL;
3140 ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
3141 if (!ec) return NULL;
3142 e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
3144 if (!_e_client_private_init(ec))
3146 e_object_del(E_OBJECT(ec));
3150 uuid_generate(ec->uuid);
3152 ec->focus_policy_override = E_FOCUS_LAST;
3153 e_client_size_set(ec, 1, 1);
3154 ec->internal = internal;
3157 e_pixmap_client_set(cp, ec);
3158 ec->resize_mode = E_POINTER_RESIZE_NONE;
3159 ec->layer = E_LAYER_CLIENT_NORMAL;
3160 ec->first_mapped = EINA_FALSE;
3161 ec->post_raise = EINA_TRUE;
3162 ec->post_lower = EINA_FALSE;
3163 ec->animatable = EINA_TRUE;
3164 ec->maximize_type = e_config->maximize_policy & E_MAXIMIZE_TYPE;
3165 ec->fullscreen_layer = _e_client_convert_fullscreen_layer(e_config->fullscreen_layer);
3167 /* FIXME: if first_map is 1 then we should ignore the first hide event
3168 * or ensure the window is already hidden and events flushed before we
3169 * create a border for it */
3172 ec->changes.pos = 1;
3176 e_comp->new_clients++;
3178 ec->exp_iconify.by_client = 0;
3179 ec->exp_iconify.not_raise = 0;
3180 ec->exp_iconify.skip_iconify = 0;
3181 ec->exp_iconify.skip_by_remote = 0;
3182 if (e_config->deiconify_approve)
3183 ec->exp_iconify.deiconify_update= 1;
3185 ec->exp_iconify.deiconify_update= 0;
3186 if (e_config->use_buffer_flush)
3187 ec->exp_iconify.buffer_flush = 1;
3189 ec->exp_iconify.buffer_flush = 0;
3191 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
3193 wl_signal_emit_mutable(&PRI(ec)->events.new_client, NULL);
3194 if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec))
3196 /* delete the above allocated object */
3197 //e_object_del(E_OBJECT(ec));
3201 _e_client_aux_hint_eval(ec);
3203 ec->icccm.title = NULL;
3204 ec->icccm.name = NULL;
3205 #if defined(__cplusplus) || defined(c_plusplus)
3206 ec->icccm.cpp_class = NULL;
3208 ec->icccm.class = NULL;
3210 ec->icccm.min_w = 1;
3211 ec->icccm.min_h = 1;
3212 ec->icccm.max_w = 32767;
3213 ec->icccm.max_h = 32767;
3216 ec->netwm.name = NULL;
3217 ec->netwm.state.skip_taskbar = 0;
3218 ec->netwm.state.skip_pager = 0;
3219 ec->netwm.opacity = 255;
3221 ec->visibility.obscured = E_VISIBILITY_UNKNOWN;
3222 ec->visibility.opaque = -1;
3223 ec->visibility.changed = 0;
3224 ec->visibility.skip = 0;
3225 ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN;
3227 ec->transform.zoom = 1.0;
3228 ec->transform.angle = 0.0;
3229 ec->transform_core.direct_render = EINA_TRUE;
3230 ec->transform_core.activate = EINA_TRUE;
3232 ec->pointer_enter_sent = EINA_FALSE;
3234 ec->acquire_fence_fd = -1;
3238 e_comp->clients = eina_list_append(e_comp->clients, ec);
3239 eina_hash_add(clients_hash[type], &ec->pixmap, ec);
3241 ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored);
3243 _e_client_event_add(ec);
3244 e_comp_object_client_add(ec);
3247 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
3248 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
3249 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
3250 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
3251 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
3254 wl_signal_emit_mutable(&PRI(ec)->events.new_client_post, NULL);
3256 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
3257 _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec);
3260 ec->manage_resize.resize_obj = NULL;
3261 ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0;
3262 ec->manage_resize.enable_aspect_ratio = EINA_FALSE;
3263 ec->manage_resize.aw = ec->manage_resize.ah = 0;
3264 ec->manage_resize.header_h = 0;
3265 ec->manage_resize.footer_h = 0;
3267 ec->visibility.ignore_geometry = e_config->calc_vis_ignore_geometry;
3272 E_API Eina_Bool e_client_is_internal(E_Client *ec)
3274 E_OBJECT_CHECK_RETURN(ec, EINA_TRUE);
3275 return ec->internal;
3279 e_client_desk_iconify_skip_set(E_Client *ec, Eina_Bool skip)
3282 ec->user_skip_winlist = skip;
3286 e_client_desk_iconify_skip_get(E_Client *ec)
3288 if (!ec) return EINA_FALSE;
3289 return ec->user_skip_winlist;
3293 e_client_comp_grabbed_get(void)
3295 return comp_grabbed;
3299 e_client_action_get(void)
3301 return action_client;
3305 //////////////////////////////////////////////////////////
3308 e_client_mouse_in(E_Client *ec, int x, int y)
3312 if (comp_grabbed) return;
3313 if (e_object_is_del(E_OBJECT(ec))) return;
3314 desk = e_comp_desk_find_by_ec(ec);
3315 if (desk && desk->animate_count) return;
3316 ec->mouse.current.mx = x;
3317 ec->mouse.current.my = y;
3320 wl_signal_emit_mutable(&PRI(ec)->events.mouse_in, NULL);
3324 e_client_mouse_out(E_Client *ec, int x, int y)
3328 if (comp_grabbed) return;
3329 if (ec->fullscreen) return;
3330 if (e_object_is_del(E_OBJECT(ec))) return;
3331 desk = e_comp_desk_find_by_ec(ec);
3332 if (desk && desk->animate_count) return;
3334 ec->mouse.current.mx = x;
3335 ec->mouse.current.my = y;
3338 wl_signal_emit_mutable(&PRI(ec)->events.mouse_out, NULL);
3342 e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
3344 EINA_SAFETY_ON_NULL_RETURN(ec);
3345 if (action_client) return;
3346 ec->mouse.current.mx = output->x;
3347 ec->mouse.current.my = output->y;
3351 e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
3353 EINA_SAFETY_ON_NULL_RETURN(ec);
3355 if (action_client || ec->iconic || e_client_util_ignored_get(ec)) return;
3356 if ((button >= 1) && (button <= 3))
3358 ec->mouse.last_down[button - 1].mx = output->x;
3359 ec->mouse.last_down[button - 1].my = output->y;
3360 ec->mouse.last_down[button - 1].x = ec->x;
3361 ec->mouse.last_down[button - 1].y = ec->y;
3362 ec->mouse.last_down[button - 1].w = ec->w;
3363 ec->mouse.last_down[button - 1].h = ec->h;
3367 ec->moveinfo.down.x = ec->x;
3368 ec->moveinfo.down.y = ec->y;
3369 ec->moveinfo.down.w = ec->w;
3370 ec->moveinfo.down.h = ec->h;
3372 ec->mouse.current.mx = output->x;
3373 ec->mouse.current.my = output->y;
3374 if ((button >= 1) && (button <= 3))
3376 ec->mouse.last_down[button - 1].mx = output->x;
3377 ec->mouse.last_down[button - 1].my = output->y;
3378 ec->mouse.last_down[button - 1].x = ec->x;
3379 ec->mouse.last_down[button - 1].y = ec->y;
3380 ec->mouse.last_down[button - 1].w = ec->w;
3381 ec->mouse.last_down[button - 1].h = ec->h;
3385 ec->moveinfo.down.x = ec->x;
3386 ec->moveinfo.down.y = ec->y;
3387 ec->moveinfo.down.w = ec->w;
3388 ec->moveinfo.down.h = ec->h;
3390 ec->mouse.current.mx = output->x;
3391 ec->mouse.current.my = output->y;
3393 wl_signal_emit_mutable(&PRI(ec)->events.mouse_down, NULL);
3397 e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
3399 EINA_SAFETY_ON_NULL_RETURN(ec);
3400 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3401 if ((button >= 1) && (button <= 3))
3403 ec->mouse.last_up[button - 1].mx = output->x;
3404 ec->mouse.last_up[button - 1].my = output->y;
3405 ec->mouse.last_up[button - 1].x = ec->x;
3406 ec->mouse.last_up[button - 1].y = ec->y;
3408 ec->mouse.current.mx = output->x;
3409 ec->mouse.current.my = output->y;
3410 /* also we don't pass the same params that went in - then again that */
3411 /* should be ok as we are just ending the action if it has an end */
3412 if (ec->cur_mouse_action)
3414 if (ec->cur_mouse_action->func.end_mouse)
3415 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
3416 else if (ec->cur_mouse_action->func.end)
3417 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
3418 e_object_unref(E_OBJECT(ec->cur_mouse_action));
3419 ec->cur_mouse_action = NULL;
3422 if ((button >= 1) && (button <= 3))
3424 ec->mouse.last_up[button - 1].mx = output->x;
3425 ec->mouse.last_up[button - 1].my = output->y;
3426 ec->mouse.last_up[button - 1].x = ec->x;
3427 ec->mouse.last_up[button - 1].y = ec->y;
3432 e_client_stay_within_canvas_margin(E_Client *ec)
3439 _e_client_stay_within_canvas_margin(ec, ec->x, ec->y, &new_x, &new_y);
3441 if ((ec->x != new_x) || (ec->y != new_y))
3442 evas_object_move(ec->frame, new_x, new_y);
3447 e_client_mouse_move(E_Client *ec, Evas_Point *output)
3449 EINA_SAFETY_ON_NULL_RETURN(ec);
3450 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3451 ec->mouse.current.mx = output->x;
3452 ec->mouse.current.my = output->y;
3453 if (e_client_util_moving_get(ec))
3455 _e_client_move_handle(ec);
3457 else if (e_client_util_resizing_get(ec))
3459 _e_client_resize_handle(ec);
3462 ///////////////////////////////////////////////////////
3465 e_client_res_change_geometry_save(E_Client *ec)
3468 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3470 if (ec->pre_res_change.valid) return;
3471 ec->pre_res_change.valid = 1;
3472 ec->pre_res_change.x = ec->x;
3473 ec->pre_res_change.y = ec->y;
3474 ec->pre_res_change.w = ec->w;
3475 ec->pre_res_change.h = ec->h;
3476 ec->pre_res_change.saved.x = ec->saved.x;
3477 ec->pre_res_change.saved.y = ec->saved.y;
3478 ec->pre_res_change.saved.w = ec->saved.w;
3479 ec->pre_res_change.saved.h = ec->saved.h;
3483 e_client_res_change_geometry_restore(E_Client *ec)
3489 unsigned char valid : 1;
3498 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3499 if (!ec->pre_res_change.valid) return;
3500 if (ec->new_client) return;
3502 zone = e_comp_zone_find_by_ec(ec);
3505 memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
3509 e_client_unfullscreen(ec);
3510 e_client_fullscreen(ec, e_config->fullscreen_policy);
3512 else if (ec->maximized != E_MAXIMIZE_NONE)
3516 max = ec->maximized;
3517 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
3518 e_client_maximize(ec, max);
3522 int x, y, w, h, zx, zy, zw, zh;
3524 ec->saved.x = ec->pre_res_change.saved.x;
3525 ec->saved.y = ec->pre_res_change.saved.y;
3526 ec->saved.w = ec->pre_res_change.saved.w;
3527 ec->saved.h = ec->pre_res_change.saved.h;
3529 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
3531 if (ec->saved.w > zw)
3533 if ((ec->saved.x + ec->saved.w) > (zx + zw))
3534 ec->saved.x = zx + zw - ec->saved.w;
3536 if (ec->saved.h > zh)
3538 if ((ec->saved.y + ec->saved.h) > (zy + zh))
3539 ec->saved.y = zy + zh - ec->saved.h;
3541 x = ec->pre_res_change.x;
3542 y = ec->pre_res_change.y;
3543 w = ec->pre_res_change.w;
3544 h = ec->pre_res_change.h;
3549 if ((x + w) > (zx + zw))
3551 if ((y + h) > (zy + zh))
3553 evas_object_geometry_set(ec->frame, x, y, w, h);
3555 memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
3559 e_client_pos_set(E_Client *ec, int x, int y)
3567 e_client_pos_get(E_Client *ec, int *x, int *y)
3583 e_client_size_set(E_Client *ec, int w, int h)
3591 e_client_size_get(E_Client *ec, int *w, int *h)
3607 e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
3615 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3617 if (e_client_transform_core_enable_get(ec))
3619 gx = ec->transform_core.result.boundary.x;
3620 gy = ec->transform_core.result.boundary.y;
3621 gw = ec->transform_core.result.boundary.w;
3622 gh = ec->transform_core.result.boundary.h;
3628 evas_object_geometry_get(ec->frame, &gx, &gy, &gw, &gh);
3629 if (gw == 0 && gh == 0)
3631 /* In this case, there is no image buffer in e_comp_object, thus it
3632 * should return geometry value of ec itself. It usually happens if
3633 * new ec is not mapped yet.
3657 e_client_above_get(const E_Client *ec)
3659 #ifdef REFACTOR_DESK_AREA
3660 E_Client_Data_Get_Above data;
3662 E_OBJECT_CHECK_RETURN(ec, NULL);
3663 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3665 data.above_ec = NULL;
3667 wl_signal_emit_mutable(&PRI(ec)->events.get_above, &data);
3669 return data.above_ec;
3674 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3675 if (EINA_INLIST_GET(ec)->next) //check current layer
3677 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3681 ELOGF("FATAL", "CHECK the ec inlist next", ec);
3684 if (!e_object_is_del(E_OBJECT(ec2)))
3688 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3689 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3691 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3692 /* go up the layers until we find one */
3693 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3695 if (!e_comp->layers[x].clients) continue;
3696 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3700 ELOGF("FATAL", "EC exist above layer. ec layer_map:%d, cur layer_map:%d",
3701 ec, e_comp_canvas_layer_map(ec->layer), x);
3704 if (!e_object_is_del(E_OBJECT(ec2)))
3706 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3711 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3718 e_client_below_get(const E_Client *ec)
3720 #ifdef REFACTOR_DESK_AREA
3721 E_Client_Data_Get_Below data;
3723 E_OBJECT_CHECK_RETURN(ec, NULL);
3724 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3726 data.below_ec = NULL;
3728 wl_signal_emit_mutable(&PRI(ec)->events.get_below, &data);
3730 return data.below_ec;
3735 E_Layer ec_layer, ec_layer_cw;
3738 E_OBJECT_CHECK_RETURN(ec, NULL);
3739 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3741 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3742 if (EINA_INLIST_GET(ec)->prev) //check current layer
3744 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3746 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3749 ELOGF("FATAL", "CHECK the ec inlist prev", ec);
3752 if (!e_object_is_del(E_OBJECT(ec2)))
3757 // check layer validation
3758 ec_layer = ec->layer;
3759 if (ec->layer_block || ec->layer_pending)
3761 cw_layer = e_comp_object_layer_get(ec->frame);
3764 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3765 if (ec_layer != ec_layer_cw)
3767 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);
3768 ec_layer = ec_layer_cw;
3773 if (ec_layer == E_LAYER_CLIENT_DESKTOP) return NULL;
3774 if (e_comp_canvas_client_layer_map(ec_layer) == 9999) return NULL;
3776 /* go down the layers until we find one */
3777 x = e_comp_canvas_layer_map(ec_layer);
3780 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3781 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3783 if (!e_comp->layers[x].clients) continue;
3784 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3788 ELOGF("FATAL", "EC exist below layer. ec layer_map:%d, cur layer_map:%d",
3789 ec, e_comp_canvas_layer_map(ec_layer), x);
3792 if (!e_object_is_del(E_OBJECT(ec2)))
3794 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3799 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3806 e_client_visible_above_get(E_Client *ec)
3808 #ifdef REFACTOR_DESK_AREA
3809 E_Client_Data_Get_Visible_Above data;
3811 E_OBJECT_CHECK_RETURN(ec, NULL);
3812 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3814 data.above_ec = NULL;
3816 wl_signal_emit_mutable(&PRI(ec)->events.get_visible_above, &data);
3818 return data.above_ec;
3823 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3824 if (EINA_INLIST_GET(ec)->next) //check current layer
3826 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3828 if (ec == ec2) continue;
3829 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3830 (!e_client_util_ignored_get(ec2)) &&
3837 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3838 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3840 /* go up the layers until we find one */
3841 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3843 if (!e_comp->layers[x].clients) continue;
3844 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3846 if (ec == ec2) continue;
3847 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3848 (!e_client_util_ignored_get(ec2)) &&
3860 e_client_visible_below_get(E_Client *ec)
3862 #ifdef REFACTOR_DESK_AREA
3863 E_Client_Data_Get_Visible_Below data;
3865 E_OBJECT_CHECK_RETURN(ec, NULL);
3866 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3868 data.below_ec = NULL;
3870 wl_signal_emit_mutable(&PRI(ec)->events.get_visible_below, &data);
3872 return data.below_ec;
3877 E_Layer ec_layer, ec_layer_cw;
3880 E_OBJECT_CHECK_RETURN(ec, NULL);
3881 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3883 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3884 if (EINA_INLIST_GET(ec)->prev) //check current layer
3886 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3888 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3889 if (ec == ec2) continue;
3890 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3891 (!e_client_util_ignored_get(ec2)) &&
3898 // check layer validation
3899 ec_layer = ec->layer;
3900 if (ec->layer_block || ec->layer_pending)
3902 cw_layer = e_comp_object_layer_get(ec->frame);
3905 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3906 if (ec_layer != ec_layer_cw)
3908 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);
3909 ec_layer = ec_layer_cw;
3914 /* go down the layers until we find one */
3915 if (e_comp_canvas_layer_map(ec->layer) > e_comp_canvas_layer_map(E_LAYER_MAX)) return NULL;
3916 x = e_comp_canvas_layer_map(ec->layer);
3919 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3921 if (!e_comp->layers[x].clients) continue;
3922 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3924 if (ec == ec2) continue;
3925 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3926 (!e_client_util_ignored_get(ec2)) &&
3938 e_client_bottom_get(void)
3940 #ifdef REFACTOR_DESK_AREA
3944 // get the bottom ec from current desk at current zone
3945 zone = e_zone_current_get();
3946 desk = e_desk_current_get(zone);
3948 return e_desk_bottom_ec_get(desk);
3951 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3952 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3956 if (!e_comp->layers[x].clients) continue;
3957 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3958 if (!e_object_is_del(E_OBJECT(ec2)))
3960 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3964 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3971 e_client_top_get(void)
3973 #ifdef REFACTOR_DESK_AREA
3977 // get the top ec from current desk at current zone
3978 zone = e_zone_current_get();
3979 desk = e_desk_current_get(zone);
3981 return e_desk_top_ec_get(desk);
3984 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3985 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3989 if (!e_comp->layers[x].clients) continue;
3990 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3991 if (!e_object_is_del(E_OBJECT(ec2)))
3993 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3997 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
4003 EINTERN unsigned int
4004 e_clients_count(void)
4006 return eina_list_count(e_comp->clients);
4011 * Set a callback which will be called just prior to updating the
4012 * move coordinates for a border
4015 e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
4017 ec->move_intercept_cb = cb;
4020 ///////////////////////////////////////
4022 E_API E_Client_Hook *
4023 e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
4027 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_HOOK_LAST, NULL);
4028 ch = E_NEW(E_Client_Hook, 1);
4029 if (!ch) return NULL;
4030 ch->hookpoint = hookpoint;
4032 ch->data = (void*)data;
4033 _e_client_hooks[hookpoint] = eina_inlist_append(_e_client_hooks[hookpoint], EINA_INLIST_GET(ch));
4038 e_client_hook_del(E_Client_Hook *ch)
4041 if (_e_client_hooks_walking == 0)
4043 _e_client_hooks[ch->hookpoint] = eina_inlist_remove(_e_client_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4047 _e_client_hooks_delete++;
4050 ///////////////////////////////////////
4052 E_API E_Client_Intercept_Hook *
4053 e_client_intercept_hook_add(E_Client_Intercept_Hook_Point hookpoint, E_Client_Intercept_Hook_Cb func, const void *data)
4055 E_Client_Intercept_Hook *ch;
4057 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_INTERCEPT_HOOK_LAST, NULL);
4058 ch = E_NEW(E_Client_Intercept_Hook, 1);
4059 if (!ch) return NULL;
4060 ch->hookpoint = hookpoint;
4062 ch->data = (void*)data;
4063 _e_client_intercept_hooks[hookpoint] = eina_inlist_append(_e_client_intercept_hooks[hookpoint], EINA_INLIST_GET(ch));
4068 e_client_intercept_hook_del(E_Client_Intercept_Hook *ch)
4073 if (_e_client_intercept_hooks_walking == 0)
4075 _e_client_intercept_hooks[ch->hookpoint] =
4076 eina_inlist_remove(_e_client_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4080 _e_client_intercept_hooks_delete++;
4084 e_client_focus_latest_set(E_Client *ec)
4086 EINA_SAFETY_ON_NULL_RETURN(ec);
4088 wl_signal_emit_mutable(&PRI(ec)->events.focus_latest_set, NULL);
4092 e_client_focus_defer_set(E_Client *ec)
4094 EINA_SAFETY_ON_NULL_RETURN(ec);
4096 wl_signal_emit_mutable(&PRI(ec)->events.focus_defer_set, NULL);
4100 e_client_focused_set(E_Client *ec)
4102 E_Client *focused_ec;
4106 ELOGF("FOCUS", "CLIENT FOCUSED_SET : SET", ec);
4108 ELOGF("FOCUS", "CLIENT FOCUSED_SET : UNSET", NULL);
4110 focused_ec = e_comp_focused_ec_get();
4111 if (ec == focused_ec) return;
4113 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
4115 // unset the current focused_ec if focused_ec is not being deleted
4118 if (!e_object_is_del(E_OBJECT(focused_ec)))
4120 // FIXME: Remove focus_unset event of client.
4121 // Instead, make zone focus_unset event and use it.
4122 wl_signal_emit_mutable(&PRI(focused_ec)->events.focus_unset, NULL);
4123 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, focused_ec);
4125 if (e_object_ref_get(E_OBJECT(focused_ec)) > 0)
4127 _e_client_event_simple(focused_ec, E_EVENT_CLIENT_FOCUS_OUT);
4132 // clear the current focused_ec when ec is NULL
4135 zone = e_comp_zone_find_by_ec(focused_ec);
4136 e_zone_focus_clear(zone);
4141 // FIXME: Remove focus_set event of client.
4142 // Instead, make zone focus_set event and use it.
4143 // set the new current focused_ec
4144 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, NULL);
4145 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
4147 // send the client_focuse_in event
4148 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
4154 e_client_activate(E_Client *ec)
4157 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4159 TRACE_DS_BEGIN(CLIENT:ACTIVATE);
4161 ELOGF("COMP", "Set launching flag..", ec);
4162 ec->launching = EINA_TRUE;
4164 ec->exp_iconify.not_raise = 0;
4168 if (!ec->lock_user_iconify)
4169 e_client_uniconify(ec);
4171 ELOGF("COMP", "Un-Set ICONIFY BY CLIENT", ec);
4172 ec->exp_iconify.by_client = 0;
4173 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
4175 wl_signal_emit_mutable(&PRI(ec)->events.activate_done, NULL);
4176 _e_client_hook_call(E_CLIENT_HOOK_ACTIVATE_DONE, ec);
4182 e_client_focused_get(void)
4184 return e_comp_focused_ec_get();
4188 e_client_lost_windows_get(E_Zone *zone)
4190 Eina_List *list = NULL;
4193 int loss_overlap = 5;
4195 E_OBJECT_CHECK_RETURN(zone, NULL);
4196 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
4197 EINA_LIST_FOREACH(e_comp->clients, l, ec)
4199 if (!e_zone_has_ec(zone, ec)) continue;
4200 if (e_client_util_ignored_get(ec)) continue;
4202 if (!E_INTERSECTS(zone->x + loss_overlap,
4203 zone->y + loss_overlap,
4204 zone->w - (2 * loss_overlap),
4205 zone->h - (2 * loss_overlap),
4206 ec->x, ec->y, ec->w, ec->h))
4208 list = eina_list_append(list, ec);
4214 ///////////////////////////////////////
4217 e_client_maximized_geometry_set(E_Client *ec, int x, int y, int w, int h)
4221 ec->maximized_info.x = x;
4222 ec->maximized_info.y = y;
4223 ec->maximized_info.w = w;
4224 ec->maximized_info.h = h;
4226 e_client_frame_geometry_set(ec, x, y, w, h);
4230 e_client_maximized_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
4234 if (x) *x = ec->maximized_info.x;
4235 if (y) *y = ec->maximized_info.y;
4236 if (w) *w = ec->maximized_info.w;
4237 if (h) *h = ec->maximized_info.h;
4241 e_client_maximize_update(E_Client *ec)
4246 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4250 max = ec->maximized;
4252 e_client_maximize(ec, max);
4257 e_client_maximize(E_Client *ec, E_Maximize max)
4260 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4262 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
4264 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
4266 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
4272 ec->changes.need_maximize = 1;
4273 ec->maximized &= ~E_MAXIMIZE_TYPE;
4274 ec->maximized |= max;
4279 if (!ec->fullscreen)
4281 // call the maximize hook of a client
4282 wl_signal_emit_mutable(&PRI(ec)->events.maximize, &max);
4284 // store the E_Maximize value
4285 ec->maximized = max;
4286 ec->changes.need_unmaximize = 0;
4288 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
4292 // store the E_Maximize value
4293 ec->maximized = max;
4294 ec->changes.need_unmaximize = 0;
4299 e_client_unmaximize(E_Client *ec, E_Maximize max)
4302 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4304 if (!(max & E_MAXIMIZE_DIRECTION))
4306 CRI("BUG: Unmaximize call without direction!");
4311 ec->changes.need_unmaximize = 1;
4316 /* Remove directions not used */
4317 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
4318 /* Can only remove existing maximization directions */
4321 if (!ec->fullscreen)
4323 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
4325 // call the unmaximize hook of a client
4326 wl_signal_emit_mutable(&PRI(ec)->events.unmaximize, &max);
4328 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
4331 ec->maximized = E_MAXIMIZE_NONE;
4332 ec->changes.need_unmaximize = 0;
4336 e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
4339 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4341 if (ec->fullscreen) return;
4343 // call the fullscreen_pre hook of a client
4344 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
4345 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
4347 if (ec->skip_fullscreen) return;
4350 ec->need_fullscreen = 1;
4354 ec->saved.layer = ec->layer;
4355 e_client_layer_set(ec, ec->fullscreen_layer);
4359 // call the fullscreen hook of a client
4360 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
4362 ec->fullscreen_policy = policy;
4364 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
4368 e_client_unfullscreen(E_Client *ec)
4371 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4373 ec->need_fullscreen = 0;
4375 if (!ec->fullscreen) return;
4379 E_Fullscreen policy = ec->fullscreen_policy;
4381 // call the unfullscreen hook of a client
4382 wl_signal_emit_mutable(&PRI(ec)->events.unfullscreen, &policy);
4384 e_client_layer_set(ec, ec->saved.layer);
4386 ec->fullscreen_policy = E_FULLSCREEN_RESIZE;
4388 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
4391 ///////////////////////////////////////
4393 e_client_is_parent_iconify_by_client(E_Client *ec)
4395 E_Client *parent = ec->parent;
4396 if (!parent) return EINA_FALSE;
4398 if ((parent->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) ||
4399 (parent->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT))
4406 e_client_iconify(E_Client *ec)
4409 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4411 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4412 Eina_Bool iconified_by_client = e_client_is_iconified_by_client(ec);
4414 ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d",
4415 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4416 ec->exp_iconify.by_client, ec->exp_iconify.type);
4418 if (ec->iconic) return;
4419 if (ec->exp_iconify.skip_iconify && !iconified_by_client) return;
4420 if (ec->exp_iconify.skip_by_remote) return;
4421 if (!cdata || !cdata->mapped)
4423 if (!iconified_by_client)
4425 ELOGF("TZVIS", "Not mapped.. So, don't iconify", ec);
4430 ELOGF("TZVIS", "Not mapped.. But, iconify by user request", ec);
4434 TRACE_DS_BEGIN(CLIENT:ICONIFY);
4436 wl_signal_emit_mutable(&PRI(ec)->events.iconify, NULL);
4437 _e_client_hook_call(E_CLIENT_HOOK_ICONIFY, ec);
4443 e_client_uniconify(E_Client *ec)
4445 E_Comp_Wl_Client_Data *cdata;
4448 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4450 cdata = e_client_cdata_get(ec);
4452 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
4453 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4454 ec->exp_iconify.by_client, ec->exp_iconify.type,
4455 cdata ? cdata->mapped : 0);
4457 if (!ec->iconic) return;
4459 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
4461 // call the uniconify hook of a client
4462 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
4463 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
4469 e_client_iconified_type_set(E_Client *ec, E_Iconified_Type type)
4472 ec->exp_iconify.type = type;
4475 EINTERN E_Iconified_Type
4476 e_client_iconified_type_get(E_Client *ec)
4478 if (!ec) return E_ICONIFIED_TYPE_NONE;
4479 return ec->exp_iconify.type;
4482 E_API Eina_Bool e_client_is_iconified_by_client(E_Client *ec)
4484 if (!ec) return EINA_FALSE;
4486 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT)
4489 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_DESK_ICONIFY_BY_CLIENT)
4492 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
4495 if (ec->exp_iconify.by_client)
4497 ELOGF("POL", "CHECK. mismatch value. by_client:%d, type:%d", ec, ec->exp_iconify.by_client, ec->exp_iconify.type);
4504 ///////////////////////////////////////
4506 EINTERN void e_client_hide_by_request_set(E_Client *ec, Eina_Bool set)
4509 priv->hide_by_request = set;
4512 EINTERN Eina_Bool e_client_hide_by_request_get(E_Client *ec)
4514 API_ENTRY_VAL(EINA_FALSE);
4515 return priv->hide_by_request;
4518 ///////////////////////////////////////
4521 e_client_stick(E_Client *ec)
4524 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4525 if (ec->sticky) return;
4527 // call the stick hook of a client
4528 wl_signal_emit_mutable(&PRI(ec)->events.stick, NULL);
4530 // send the sticky property event of a client
4531 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4535 e_client_unstick(E_Client *ec)
4538 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4540 if (!ec->sticky) return;
4542 // call the unstick hook of a client
4543 wl_signal_emit_mutable(&PRI(ec)->events.unstick, NULL);
4545 // send the sticky property event of a client
4546 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4550 e_client_pinned_set(E_Client *ec, Eina_Bool set)
4554 EINA_SAFETY_ON_NULL_RETURN(ec);
4556 layer = E_LAYER_CLIENT_ABOVE;
4558 layer = E_LAYER_CLIENT_NORMAL;
4560 e_client_layer_set(ec, layer);
4565 ///////////////////////////////////////
4568 e_client_border_set(E_Client *ec, const char *name)
4570 Eina_Stringshare *pborder;
4572 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
4573 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
4574 if (!e_comp_object_frame_allowed(ec->frame)) return EINA_FALSE;
4575 if (ec->border.changed)
4576 CRI("CALLING WHEN border.changed SET!");
4578 if (!e_util_strcmp(ec->border.name, name)) return EINA_TRUE;
4579 pborder = ec->border.name;
4580 ec->border.name = eina_stringshare_add(name);
4581 if (e_comp_object_frame_theme_set(ec->frame, name))
4583 eina_stringshare_del(pborder);
4586 eina_stringshare_del(ec->border.name);
4587 ec->border.name = pborder;
4591 ///////////////////////////////////////
4594 e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
4597 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4600 if (ec->comp_hidden == hidden) return;
4601 ec->comp_hidden = hidden;
4602 evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
4605 ///////////////////////////////////////
4608 e_client_act_move_keyboard(E_Client *ec)
4610 EINA_SAFETY_ON_NULL_RETURN(ec);
4612 if (!_e_client_move_begin(ec))
4615 _e_client_action_init(ec);
4616 _e_client_action_move_timeout_add();
4618 wl_signal_emit_mutable(&PRI(ec)->events.move_update, NULL);
4619 if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
4620 evas_object_freeze_events_set(ec->frame, 1);
4622 if (!action_handler_mouse)
4623 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
4627 e_client_act_resize_keyboard(E_Client *ec)
4629 EINA_SAFETY_ON_NULL_RETURN(ec);
4631 ec->resize_mode = E_POINTER_RESIZE_TL;
4632 ec->keyboard_resizing = 1;
4633 if (!e_client_resize_begin(ec))
4635 ec->keyboard_resizing = 0;
4639 _e_client_action_init(ec);
4640 _e_client_action_resize_timeout_add();
4641 evas_object_freeze_events_set(ec->frame, 1);
4643 if (!action_handler_mouse)
4644 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
4648 e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
4651 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4652 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4657 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4658 _e_client_moveinfo_gather(ec, source);
4660 if (!_e_client_move_begin(ec))
4663 _e_client_action_init(ec);
4667 e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4670 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4671 if (!ec->moving) return;
4672 _e_client_move_end(ec);
4673 _e_client_action_finish();
4677 e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, E_Pointer_Mode resize_mode)
4680 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4681 if (ec->lock_user_size) return;
4682 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4686 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4687 _e_client_moveinfo_gather(ec, source);
4689 if (resize_mode != E_POINTER_RESIZE_NONE)
4691 ec->resize_mode = resize_mode;
4695 /* Use canvas.x, canvas.y of event.
4696 * Transformed coordinates has to be considered for accurate resize_mode
4697 * rather than absolute coordinates. */
4698 if ((ev->canvas.x > (ec->x + ec->w / 5)) &&
4699 (ev->canvas.x < (ec->x + ec->w * 4 / 5)))
4701 if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_T;
4702 else ec->resize_mode = E_POINTER_RESIZE_B;
4704 else if (ev->canvas.x < (ec->x + ec->w / 2))
4706 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;
4707 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TL;
4708 else ec->resize_mode = E_POINTER_RESIZE_BL;
4712 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;
4713 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TR;
4714 else ec->resize_mode = E_POINTER_RESIZE_BR;
4718 if (!e_client_resize_begin(ec))
4720 _e_client_action_init(ec);
4724 e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4727 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4728 if (e_client_util_resizing_get(ec))
4730 _e_client_resize_end(ec);
4731 ec->changes.reset_gravity = 1;
4732 if (!e_object_is_del(E_OBJECT(ec)))
4735 _e_client_action_finish();
4739 e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
4742 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4746 e_client_act_close_begin(E_Client *ec)
4749 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4750 if (ec->lock_close) return;
4751 if (ec->icccm.delete_request)
4753 ec->delete_requested = 1;
4754 evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
4756 else if (e_config->kill_if_close_not_possible)
4758 e_client_act_kill_begin(ec);
4763 e_client_act_kill_begin(E_Client *ec)
4766 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4767 if (ec->internal) return;
4768 if (ec->lock_close) return;
4769 if ((ec->netwm.pid > 1) && (e_config->kill_process))
4771 kill(ec->netwm.pid, SIGINT);
4772 ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
4773 _e_client_cb_kill_timer, ec);
4776 evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
4779 ////////////////////////////////////////////
4782 e_client_ping(E_Client *ec)
4785 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4787 if (!e_config->ping_clients) return;
4789 EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
4792 evas_object_smart_callback_call(ec->frame, "ping", NULL);
4793 ec->ping = ecore_loop_time_get();
4794 if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
4795 ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
4796 e_config->ping_clients_interval,
4797 _e_client_cb_ping_poller, ec);
4800 ////////////////////////////////////////////
4802 e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y)
4804 // TODO: remove(deprecate) this e_client_cursor_map_apply.
4808 e_client_move_cancel(void)
4810 if (!ecmove) return;
4811 if (ecmove->cur_mouse_action)
4816 e_object_ref(E_OBJECT(ec));
4817 if (ec->cur_mouse_action->func.end_mouse)
4818 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4819 else if (ec->cur_mouse_action->func.end)
4820 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4821 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4822 ec->cur_mouse_action = NULL;
4823 e_object_unref(E_OBJECT(ec));
4826 _e_client_move_end(ecmove);
4830 e_client_resize_cancel(void)
4832 if (!ecresize) return;
4833 if (ecresize->cur_mouse_action)
4838 e_object_ref(E_OBJECT(ec));
4839 if (ec->cur_mouse_action->func.end_mouse)
4840 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4841 else if (ec->cur_mouse_action->func.end)
4842 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4843 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4844 ec->cur_mouse_action = NULL;
4845 e_object_unref(E_OBJECT(ec));
4848 _e_client_resize_end(ecresize);
4852 e_client_resize_begin(E_Client *ec)
4854 if ((ec->fullscreen) || (ec->lock_user_size))
4856 if (!_e_client_action_input_win_new()) goto error;
4858 if (ec->manage_resize.enable_aspect_ratio)
4860 ELOGF("RESIZE", "Set resize aspect ratio.. ratio(%dx%d)", ec, ec->w, ec->h);
4861 ec->manage_resize.aw = ec->w;
4862 ec->manage_resize.ah = ec->h - ec->manage_resize.header_h - ec->manage_resize.footer_h;
4865 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
4866 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
4867 if (ec->transformed)
4868 _e_client_transform_resize_begin(ec);
4869 if (!e_client_util_resizing_get(ec))
4871 if (ecresize == ec) ecresize = NULL;
4872 _e_client_action_input_win_del();
4875 if (!ec->lock_user_stacking)
4877 if (e_config->border_raise_on_mouse_action)
4882 e_comp_client_override_add(ec);
4886 ec->resize_mode = E_POINTER_RESIZE_NONE;
4891 ////////////////////////////////////////////
4894 e_client_frame_recalc(E_Client *ec)
4896 EINA_SAFETY_ON_NULL_RETURN(ec);
4897 if (!ec->frame) return;
4898 evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
4901 ////////////////////////////////////////////
4904 e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
4907 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4909 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4910 _e_client_moveinfo_gather(ec, sig);
4911 if (!_e_client_move_begin(ec)) return;
4915 e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4918 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4919 if (!ec->moving) return;
4920 _e_client_move_end(ec);
4924 e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
4926 int resize_mode = E_POINTER_RESIZE_BR;
4929 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4931 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4932 if (!strcmp(dir, "tl"))
4934 resize_mode = E_POINTER_RESIZE_TL;
4936 else if (!strcmp(dir, "t"))
4938 resize_mode = E_POINTER_RESIZE_T;
4940 else if (!strcmp(dir, "tr"))
4942 resize_mode = E_POINTER_RESIZE_TR;
4944 else if (!strcmp(dir, "r"))
4946 resize_mode = E_POINTER_RESIZE_R;
4948 else if (!strcmp(dir, "br"))
4950 resize_mode = E_POINTER_RESIZE_BR;
4952 else if (!strcmp(dir, "b"))
4954 resize_mode = E_POINTER_RESIZE_B;
4956 else if (!strcmp(dir, "bl"))
4958 resize_mode = E_POINTER_RESIZE_BL;
4960 else if (!strcmp(dir, "l"))
4962 resize_mode = E_POINTER_RESIZE_L;
4964 ec->resize_mode = resize_mode;
4965 _e_client_moveinfo_gather(ec, sig);
4966 if (!e_client_resize_begin(ec))
4971 e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4974 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4975 if (!e_client_util_resizing_get(ec)) return;
4976 _e_client_resize_handle(ec);
4977 _e_client_resize_end(ec);
4978 ec->changes.reset_gravity = 1;
4982 ////////////////////////////////////////////
4985 e_client_resize_limit(E_Client *ec, int *w, int *h)
4988 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4991 e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
4995 if ((ec->icccm.max_w > 0) && (*w > ec->icccm.max_w)) *w = ec->icccm.max_w;
4996 else if (*w < ec->icccm.min_w)
4997 *w = ec->icccm.min_w;
4998 if ((ec->icccm.max_h > 0) && (*h > ec->icccm.max_h)) *h = ec->icccm.max_h;
4999 else if (*h < ec->icccm.min_h)
5000 *h = ec->icccm.min_h;
5003 e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
5006 ////////////////////////////////////////////
5011 e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
5015 /* We need to ensure that we can get the comp window for the
5016 * zone of either the given desk or the desk of the excluded
5017 * window, so return if neither is given */
5019 e_input_device_pointer_xy_get(NULL, &x, &y);
5021 e_input_device_pointer_xy_get(NULL, &x, &y);
5027 desk = exclude->desk;
5031 desk = e_desk_current_get(exclude->zone);
5033 desk = e_desk_current_get(e_zone_current_get());
5037 return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
5040 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
5042 if (!desk) return NULL;
5044 return _e_client_under_pointer_helper(desk, exclude, x, y);
5047 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
5049 if (!desk) return NULL;
5051 return _e_client_under_pointer_input_helper(desk, x, y);
5054 ////////////////////////////////////////////
5056 ////////////////////////////////////////////
5059 e_client_redirected_set(E_Client *ec, Eina_Bool set)
5061 EINA_SAFETY_ON_NULL_RETURN(ec);
5062 if (ec->input_only) return;
5064 if (ec->redirected == set) return;
5067 e_client_frame_recalc(ec);
5069 wl_signal_emit_mutable(&PRI(ec)->events.redirect, NULL);
5070 if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
5074 wl_signal_emit_mutable(&PRI(ec)->events.unredirect, NULL);
5075 if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
5077 e_comp_object_redirected_set(ec->frame, set);
5078 ec->redirected = !!set;
5081 ////////////////////////////////////////////
5084 e_client_transform_update(E_Client *ec)
5086 if (e_client_util_resizing_get(ec))
5087 _e_client_transform_resize(ec);
5090 ////////////////////////////////////////////
5093 e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy)
5096 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5100 if (e_comp_wl_subsurface_check(ec))
5103 /* check if it's different with current state */
5104 if ((ec->transform.angle == angle) &&
5105 (ec->transform.zoom == zoom) &&
5106 (ec->transform.center.x == cx) &&
5107 (ec->transform.center.y == cy))
5110 /* use previous value if any required value is invalid */
5112 angle = ec->transform.angle;
5114 zoom = ec->transform.zoom;
5115 if (!E_INSIDE(cx, cy,
5116 ec->client.x, ec->client.y,
5117 ec->client.w, ec->client.h))
5119 cx = ec->transform.center.x;
5120 cy = ec->transform.center.y;
5123 if ((angle == 0) && (zoom == 1.0))
5125 e_client_transform_clear(ec);
5129 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
5130 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
5132 e_map_util_rotate(map, angle, cx, cy);
5133 _e_client_transform_geometry_save(ec, map);
5135 e_map_util_zoom(map, zoom, zoom, cx, cy);
5137 e_map_util_object_move_sync_set(map, EINA_TRUE);
5138 e_client_map_set(ec, map);
5139 e_client_map_enable_set(ec, EINA_TRUE);
5141 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5142 _e_client_transform_sub_apply(subc, ec, zoom);
5143 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5144 _e_client_transform_sub_apply(subc, ec, zoom);
5148 ec->transform.zoom = zoom;
5149 ec->transform.angle = angle;
5150 ec->transform.center.x = cx;
5151 ec->transform.center.y = cy;
5152 ec->transformed = EINA_TRUE;
5155 ////////////////////////////////////////////
5158 e_client_transform_clear(E_Client *ec)
5160 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5164 e_client_map_enable_set(ec, EINA_FALSE);
5165 e_client_map_set(ec, NULL);
5167 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5168 _e_client_transform_sub_apply(subc, ec, 1.0);
5169 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5170 _e_client_transform_sub_apply(subc, ec, 1.0);
5172 ec->transform.zoom = 1.0;
5173 ec->transform.angle = 0.0;
5174 ec->transformed = EINA_FALSE;
5178 e_client_transform_core_enable_get(E_Client *ec)
5180 if (!ec) return EINA_FALSE;
5181 return ec->transform_core.result.enable;
5185 e_client_transform_core_add(E_Client *ec, E_Util_Transform *transform)
5188 if (!transform) return;
5190 // duplication check
5191 if (ec->transform_core.transform_list &&
5192 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5197 ec->transform_core.transform_list = eina_list_append(ec->transform_core.transform_list, transform);
5198 ec->transform_core.changed = EINA_TRUE;
5199 e_util_transform_ref(transform);
5200 // e_client_transform_core_update(ec);
5204 e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform)
5207 if (!transform) return;
5209 if (ec->transform_core.transform_list &&
5210 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5212 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
5213 e_util_transform_unref(transform);
5214 ec->transform_core.changed = EINA_TRUE;
5217 e_client_transform_core_update(ec);
5221 e_client_transform_core_update(E_Client *ec)
5224 if (ec->new_client) return;
5225 if (!_e_client_transform_core_check_change(ec)) return;
5227 if (ec->transform_core.transform_list || ec->transform_core.parent.enable)
5229 E_Util_Transform_Rect source_rect;
5230 E_Util_Transform_Matrix matrix, boundary_matrix;
5231 E_Util_Transform_Zoom zoom;
5233 Eina_Bool background;
5234 E_Util_Transform *temp_trans;
5237 ec->transform_core.result.enable = EINA_TRUE;
5238 e_util_transform_rect_client_rect_get(&source_rect, ec);
5239 e_util_transform_init(&ec->transform_core.result.transform);
5241 // 2. merge transform
5242 EINA_LIST_FOREACH(ec->transform_core.transform_list, l, temp_trans)
5244 e_util_transform_merge(&ec->transform_core.result.transform, temp_trans);
5246 zoom = ec->transform_core.result.transform.zoom;
5248 // 2.5 check viewport
5249 if (e_util_transform_viewport_flag_get(&ec->transform_core.result.transform))
5251 int vx = 0, vy = 0, vw = 0, vh = 0;
5252 e_util_transform_viewport_get(&ec->transform_core.result.transform, &vx, &vy, &vw, &vh);
5253 e_util_transform_rect_init(&source_rect, vx, vy, vw, vh);
5256 // 3. apply background transform
5257 matrix = e_util_transform_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5259 if (e_util_transform_bg_transform_flag_get(&ec->transform_core.result.transform))
5261 boundary_matrix = e_util_transform_bg_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5262 background = EINA_TRUE;
5266 background = EINA_FALSE;
5267 boundary_matrix = matrix;
5270 if (background != ec->transform_core.background)
5274 e_comp_object_transform_bg_set(ec->frame, EINA_TRUE);
5278 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5281 ec->transform_core.background = background;
5284 // 3.1 if 24bit window then set transp rect
5289 e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle);
5292 if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect
5293 e_comp_object_transform_transp_set(ec->frame, EINA_TRUE);
5295 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5298 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5300 // 3.5 parent matrix multiply
5301 if (ec->transform_core.parent.enable)
5303 matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5305 boundary_matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5308 ec->transform_core.result.transform.use_zoom = EINA_TRUE;
5309 zoom.zoom_x *= ec->transform_core.parent.zoom.zoom_x;
5310 zoom.zoom_y *= ec->transform_core.parent.zoom.zoom_y;
5311 zoom.cx += ec->transform_core.parent.zoom.cx;
5312 zoom.cy += ec->transform_core.parent.zoom.cy;
5315 // 4. apply matrix to vertices
5316 ec->transform_core.result.matrix = matrix;
5317 ec->transform_core.result.inv_matrix = e_util_transform_matrix_inverse_get(&matrix);
5318 ec->transform_core.result.vertices = e_util_transform_rect_to_vertices(&source_rect);
5319 ec->transform_core.result.boundary.vertices = e_util_transform_rect_to_vertices(&source_rect);
5320 ec->transform_core.result.vertices = e_util_transform_matrix_multiply_rect_vertex(&matrix,
5321 &ec->transform_core.result.vertices);
5322 ec->transform_core.result.boundary.vertices = e_util_transform_matrix_multiply_rect_vertex(&boundary_matrix,
5323 &ec->transform_core.result.boundary.vertices);
5324 ec->transform_core.result.transform.zoom = zoom;
5326 // 5. apply vertices
5327 if (ec->transform_core.result.transform.use_zoom)
5329 // TODO: apply zoom values to vertices
5330 e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices,
5331 ec->transform_core.result.transform.zoom);
5332 e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices,
5333 ec->transform_core.result.transform.zoom);
5334 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5335 _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform,
5336 ec->transform_core.result.transform.zoom);
5340 e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices);
5341 e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices);
5342 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5343 _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform);
5346 // 6. subsurface update
5347 _e_client_transform_core_sub_update(ec, &ec->transform_core.result.vertices);
5349 if (!e_object_is_del(E_OBJECT(ec)))
5351 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5352 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5357 if (ec->transform_core.result.enable)
5359 ec->transform_core.result.enable = EINA_FALSE;
5360 _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL);
5361 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5362 ec->transform_core.background = EINA_FALSE;
5363 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5364 _e_client_transform_core_sub_update(ec, NULL);
5366 if (!e_object_is_del(E_OBJECT(ec)))
5368 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5369 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5374 e_comp_visibility_calculation_set(EINA_TRUE);
5378 e_client_transform_core_transform_count_get(E_Client *ec)
5381 if (!ec->transform_core.transform_list) return 0;
5382 return eina_list_count(ec->transform_core.transform_list);
5385 E_API E_Util_Transform*
5386 e_client_transform_core_transform_get(E_Client *ec, int index)
5388 if (!ec) return NULL;
5389 if (!ec->transform_core.transform_list) return NULL;
5390 if (index < 0 || index >= e_client_transform_core_transform_count_get(ec))
5393 return (E_Util_Transform*)eina_list_nth(ec->transform_core.transform_list, index);
5397 e_client_transform_core_input_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5399 E_Util_Transform_Vertex vertex, result_vertex;
5402 if (!e_client_transform_core_enable_get(ec)) return;
5404 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5406 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.inv_matrix, &vertex);
5407 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5411 e_client_transform_core_input_inv_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5413 E_Util_Transform_Vertex vertex, result_vertex;
5416 if (!e_client_transform_core_enable_get(ec)) return;
5418 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5420 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.matrix, &vertex);
5421 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5425 e_client_transform_core_input_inv_rect_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5429 if (!e_client_transform_core_enable_get(ec)) return;
5430 e_client_geometry_get(ec, NULL, NULL, &gw, &gh);
5432 e_util_transform_matrix_inv_rect_coords_get(&ec->transform_core.result.transform,
5433 &ec->transform_core.result.vertices,
5435 x, y, out_x, out_y);
5439 e_client_transform_core_direct_render_set(E_Client *ec, Eina_Bool set)
5441 EINA_SAFETY_ON_NULL_RETURN(ec);
5443 if (ec->transform_core.direct_render == set) return;
5445 ec->transform_core.direct_render = set;
5446 ec->transform_core.changed = EINA_TRUE;
5448 e_client_transform_core_update(ec);
5452 e_client_pixmap_change(E_Client *ec, E_Pixmap *newcp)
5454 E_Pixmap_Type oldtype, newtype;
5457 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
5458 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->pixmap, NULL);
5459 EINA_SAFETY_ON_NULL_RETURN_VAL(newcp, NULL);
5463 oldtype = e_pixmap_type_get(oldcp);
5464 if (oldtype >= E_PIXMAP_TYPE_MAX) return NULL;
5466 newtype = e_pixmap_type_get(newcp);
5467 if (newtype >= E_PIXMAP_TYPE_MAX) return NULL;
5469 if (eina_hash_find(clients_hash[oldtype], &oldcp))
5470 eina_hash_del_by_key(clients_hash[oldtype], &oldcp);
5471 e_pixmap_client_set(oldcp, NULL);
5474 e_pixmap_client_set(newcp, ec);
5476 eina_hash_add(clients_hash[newtype], &newcp, ec);
5482 e_client_window_role_set(E_Client *ec, const char *role)
5484 EINA_SAFETY_ON_NULL_RETURN(ec);
5486 if (eina_stringshare_replace(&ec->icccm.window_role, role))
5488 wl_signal_emit_mutable(&PRI(ec)->events.window_role_change, NULL);
5489 _e_client_hook_call(E_CLIENT_HOOK_WINDOW_ROLE_CHANGE, ec);
5494 e_client_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5498 res = e_comp_wl_key_send(ec, keycode, pressed, dev, time);
5504 e_client_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, unsigned int time)
5508 res = e_comp_wl_key_cancel(ec, keycode, dev, time);
5514 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)
5518 res = e_comp_wl_touch_send(ec, idx, x, y, pressed, dev, radius_x, radius_y, pressure, angle, time);
5524 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)
5528 res = e_comp_wl_touch_update_send(ec, idx, x, y, dev, radius_x, radius_y, pressure, angle, time);
5534 e_client_touch_cancel_send(E_Client *ec)
5538 res = e_comp_wl_touch_cancel_send(ec);
5544 e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5548 res = e_comp_wl_mouse_button_send(ec, buttons, pressed, dev, time);
5554 e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5558 res = e_comp_wl_mouse_move_send(ec, x, y, dev, time);
5564 e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time)
5568 res = e_comp_wl_mouse_wheel_send(ec, direction, z, dev, time);
5574 e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5578 res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
5584 e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
5588 res = e_comp_wl_mouse_out_send(ec, dev, time);
5594 e_client_video_client_has(E_Client *ec)
5596 return e_comp_wl_video_subsurface_has(ec);
5600 e_client_normal_client_has(E_Client *ec)
5602 return e_comp_wl_normal_subsurface_has(ec);
5606 e_client_cursor_hide(E_Client *ec)
5608 return e_comp_wl_cursor_hide(ec);
5612 e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
5616 ELOGF("TZVIS", "VIS_FORCE_OBSCURED :%d", ec, set);
5618 ec->visibility.force_obscured = set;
5619 e_comp_visibility_calculation_set(EINA_TRUE);
5622 EINTERN E_Capture_Save_State
5623 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)
5625 return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
5629 _e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *subc)
5631 E_Client *ec, *parent;
5637 ec->base_output_resolution.use = 0;
5638 ec->base_output_resolution.w = 0;
5639 ec->base_output_resolution.h = 0;
5640 if (ec->base_output_resolution.transform)
5642 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
5643 E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
5644 ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
5647 /* Update transform for toplevel surface.
5648 * The transform of subsurface will be updated by its parent accordingly. */
5649 parent = e_comp_wl_topmost_parent_get(ec);
5652 parent->transform_core.changed = EINA_TRUE;
5653 e_client_transform_core_update(parent);
5656 /* TODO: Do we need to apply it again if subsurface is destroyed? */
5660 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
5663 ec->base_output_resolution.use = 1;
5664 ec->base_output_resolution.w = width;
5665 ec->base_output_resolution.h = height;
5666 ec->base_output_resolution.transform = e_util_transform_new();
5667 e_util_transform_role_set(ec->base_output_resolution.transform, "base_output_resolution");
5668 e_client_transform_core_add(ec, ec->base_output_resolution.transform);
5670 if (!ec->base_output_resolution.hook_subsurf_create)
5672 ec->base_output_resolution.hook_subsurf_create =
5673 e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
5674 _e_client_base_output_resolution_hook_subsurf_create,
5680 e_client_base_output_resolution_transform_adjust(E_Client *ec)
5684 EINA_SAFETY_ON_NULL_RETURN(ec);
5685 if (!ec->base_output_resolution.use) return;
5686 if (!ec->base_output_resolution.transform) return;
5688 desk = e_comp_desk_find_by_ec(ec);
5689 EINA_SAFETY_ON_NULL_RETURN(desk);
5691 ELOGF("POL_APPINFO", "Apply TRANSFORM... desk:(%dx%d), ec:(%dx%d)",
5692 ec, desk->geom.w, desk->geom.h, ec->w, ec->h);
5694 e_util_transform_scale(ec->base_output_resolution.transform,
5695 (double)desk->geom.w /(double)ec->base_output_resolution.w,
5696 (double)desk->geom.h /(double)ec->base_output_resolution.h,
5698 e_client_transform_core_update(ec);
5702 e_client_base_output_resolution_update(E_Client *ec)
5704 E_Appinfo *eai = NULL;
5705 int configured_width, configured_height;
5709 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
5711 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5712 if (ec->base_output_resolution.use) return EINA_TRUE;
5714 /* Check whether it's subsurface or not
5715 * The resolution of subsurface will follow the resolution of its toplevel surface.
5716 * Transform for subsurface will be applied when toplevel surface does by
5717 * implementation of e_client_transform_core.
5719 if (e_comp_wl_subsurface_check(ec))
5722 desk = e_comp_desk_find_by_ec(ec);
5723 EINA_SAFETY_ON_NULL_RETURN_VAL(desk, EINA_FALSE);
5725 configured_width = e_config->configured_output_resolution.w;
5726 configured_height = e_config->configured_output_resolution.h;
5730 ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec,
5731 configured_width, configured_height, ec->netwm.pid);
5732 goto use_configured;
5735 eai = e_appinfo_find_with_pid(ec->netwm.pid);
5738 ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec,
5739 configured_width, configured_height, ec->netwm.pid);
5740 goto use_configured;
5743 if (!e_appinfo_base_output_resolution_available_get(eai))
5745 ELOGF("POL_APPINFO", "NO AVAILABLE BASE SCREEN RESOLUTION... QUERY base_output_resolution", ec);
5746 e_policy_base_output_resolution_info_update(ec->netwm.pid);
5749 if (!e_appinfo_base_output_resolution_get(eai, &width, &height))
5751 ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec,
5752 configured_width, configured_height, ec->netwm.pid);
5753 goto use_configured;
5756 if ((width == 0) && (height == 0))
5758 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution size:(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5762 if ((desk->geom.w == width) && (desk->geom.h == height))
5764 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);
5768 /* set the base_output_resolution of the e_client */
5769 _e_client_base_output_resolution_set(ec, width, height);
5771 ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5777 if ((desk->geom.w == configured_width) && (desk->geom.h == configured_height))
5779 ELOGF("POL_APPINFO", "SKIP use configured_output_resolution (same with desk size:(%d,%d), pid:%d)", ec, configured_width, configured_height, ec->netwm.pid);
5783 /* set the base_output_resolution of the e_client as a default */
5784 _e_client_base_output_resolution_set(ec, configured_width, configured_height);
5791 e_client_base_output_resolution_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5796 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5798 zone = e_comp_zone_find_by_ec(ec);
5799 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5801 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
5808 if (ec->base_output_resolution.use)
5810 if (w) *w = ec->base_output_resolution.w;
5811 if (h) *h = ec->base_output_resolution.h;
5818 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)
5823 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5825 zone = e_comp_zone_find_by_ec(ec);
5826 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5828 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, consider_obstacle_area);
5835 if (ec->base_output_resolution.use)
5837 // TODO: Consider obstacle area
5838 if (w) *w = ec->base_output_resolution.w;
5839 if (h) *h = ec->base_output_resolution.h;
5845 /* change the base_output_resolution of the bind_ec by checking the base_output_resolution of provider_ec's appinfo */
5847 e_client_base_output_resolution_rsm_update(E_Client *bind_ec, E_Client *provider_ec)
5849 E_Appinfo *epai = NULL;
5850 int configured_width, configured_height;
5852 E_Desk *bind_ec_desk;
5854 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec, EINA_FALSE);
5855 EINA_SAFETY_ON_NULL_RETURN_VAL(provider_ec, EINA_FALSE);
5857 bind_ec_desk = e_comp_desk_find_by_ec(bind_ec);
5858 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec_desk, EINA_FALSE);
5860 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5862 configured_width = e_config->configured_output_resolution.w;
5863 configured_height = e_config->configured_output_resolution.h;
5865 if (bind_ec->base_output_resolution.use)
5867 ELOGF("POL_APPINFO", "DELETE EXISTED BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5868 bind_ec->base_output_resolution.w, bind_ec->base_output_resolution.h, bind_ec->netwm.pid);
5870 bind_ec->base_output_resolution.use = 0;
5871 bind_ec->base_output_resolution.w = 0;
5872 bind_ec->base_output_resolution.h = 0;
5873 e_client_transform_core_remove(bind_ec, bind_ec->base_output_resolution.transform);
5874 E_FREE_FUNC(bind_ec->base_output_resolution.transform, e_util_transform_del);
5877 if (!provider_ec->netwm.pid)
5879 ELOGF("POL_APPINFO", "NO PROVIDER PID... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5880 configured_width, configured_height, provider_ec->netwm.pid);
5881 goto use_configured;
5884 epai = e_appinfo_find_with_pid(provider_ec->netwm.pid);
5887 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5888 configured_width, configured_height, provider_ec->netwm.pid);
5889 goto use_configured;
5892 if (!e_appinfo_base_output_resolution_get(epai, &width, &height))
5894 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5895 configured_width, configured_height, provider_ec->netwm.pid);
5896 goto use_configured;
5899 if ((width == 0) && (height == 0))
5901 ELOGF("POL_APPINFO", "NO PROVIDER WIDTH and HEIGHT... SKIP base_output_resolution due to size:(%d,%d) provider_pid:%d", provider_ec,
5902 width, height, provider_ec->netwm.pid);
5906 if ((bind_ec_desk->geom.w == width) && (bind_ec_desk->geom.h == height))
5908 ELOGF("POL_APPINFO", "SKIP SET BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5909 width, height, bind_ec->netwm.pid);
5913 /* set the base_output_resolution of the e_client */
5914 _e_client_base_output_resolution_set(bind_ec, width, height);
5915 e_client_base_output_resolution_transform_adjust(bind_ec);
5917 ELOGF("POL_APPINFO", "USE BINDER base_output_resolution(%d,%d) bind_pid:%d", bind_ec, width, height, bind_ec->netwm.pid);
5923 if ((bind_ec_desk->geom.w == configured_width) && (bind_ec_desk->geom.h == configured_height))
5925 ELOGF("POL_APPINFO", "SKIP BINDER use configured_output_resolution (same with desk size:(%d,%d), bind_pid:%d)", bind_ec,
5926 configured_width, configured_height, bind_ec->netwm.pid);
5930 /* set the base_output_resolution of the e_client as a default */
5931 _e_client_base_output_resolution_set(bind_ec, configured_width, configured_height);
5937 /* tizen_move_resize */
5939 e_client_pending_geometry_has(E_Client *ec)
5941 if (!eina_list_count(ec->surface_sync.pending_geometry))
5944 return ec->surface_sync.wait_commit;
5948 e_client_pending_geometry_flush(E_Client *ec)
5950 E_Client_Pending_Geometry *geo;
5952 if (!eina_list_count(ec->surface_sync.pending_geometry))
5954 EINA_LIST_FREE(ec->surface_sync.pending_geometry, geo)
5958 ec->surface_sync.wait_commit = EINA_FALSE;
5959 ELOGF("POSSIZE", "pending geometry has flushed", ec);
5964 e_client_pending_geometry_last_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5967 E_Client_Pending_Geometry *geo;
5973 EINA_LIST_REVERSE_FOREACH(ec->surface_sync.pending_geometry, l, geo)
5989 e_client_frame_focus_set(E_Client *ec, Eina_Bool focus)
5992 evas_object_focus_set(ec->frame, focus);
5996 e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h)
6000 if (ec->internal || ec->input_only)
6002 evas_object_geometry_set(ec->frame, x, y, w, h);
6006 if ((ec->w != w) || (ec->h != h))
6008 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);
6009 ec->move_after_resize = EINA_TRUE;
6011 e_client_pos_set(ec, x, y);
6012 evas_object_resize(ec->frame, w, h);
6015 evas_object_geometry_set(ec->frame, x, y, w, h);
6020 e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
6024 if (ec->internal || ec->input_only)
6026 e_client_util_move_without_frame(ec, x, y);
6027 e_client_util_resize_without_frame(ec, w, h);
6031 if ((ec->w != w) || (ec->h != h))
6033 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);
6034 ec->move_after_resize = EINA_TRUE;
6036 e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
6037 e_client_pos_set(ec, x, y);
6038 e_client_util_resize_without_frame(ec, w, h);
6042 e_client_util_move_without_frame(ec, x, y);
6043 e_client_util_resize_without_frame(ec, w, h);
6049 e_client_layer_set(E_Client *ec,
6052 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6053 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6054 if (!ec->frame) return EINA_FALSE;
6056 if (e_comp_canvas_client_layer_map(layer) == 9999)
6057 return EINA_FALSE; //invalid layer is not allowed
6059 #ifdef REFACTOR_DESK_AREA
6061 if (ec->desk_area.enable)
6063 if (e_client_layer_set_by_desk_area(ec, layer))
6065 // restack according to desk group rule
6066 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6070 ec->desk_area.layer_backup = layer;
6073 evas_object_layer_set(ec->frame, layer);
6074 if (ec->layer != layer)
6076 /* check exceptional case */
6077 if ((ec->fullscreen) &&
6078 (ec->saved.layer != layer))
6080 ELOGF("LAYER", "(%d) fail to backup at saved.layer for fullscreen", ec, layer);
6083 // if e_comp_object fail to change ec->layer due to ec->layer_pending or block
6084 // leave log and apply ec->layer according to set
6085 // as a result it restores back to given layer when pending or block is free
6086 ELOGF("LAYER", "change layer from %d to %d if in case layer pending(%d) or block(%d)",
6087 ec, ec->layer, layer, ec->layer_pending, ec->layer_block);
6088 if (ec->layer_pending || ec->layer_block)
6095 wl_signal_emit_mutable(&PRI(ec)->events.set_layer, NULL);
6101 e_client_layer_get(E_Client *ec)
6105 E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM);
6106 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM);
6107 if (!ec->frame) return E_LAYER_BOTTOM;
6109 layer = evas_object_layer_get(ec->frame);
6110 if (ec->layer != layer)
6112 /* client could be on temperory layer while pending or block,
6113 * in that case, client restores back to ec->layer after pending/block finish */
6114 if (ec->layer_block || ec->layer_pending)
6117 /* otherwise, client is on unexpected layer */
6118 ELOGF("LAYER", "layer dismatch ec->layer %d | evas obj layer %d ",
6119 ec, ec->layer, layer);
6121 if (e_comp_canvas_client_layer_map(layer) == 9999)
6122 return E_LAYER_BOTTOM; //not on E_LAYER_CLIENT
6128 #ifdef REFACTOR_DESK_AREA
6131 _e_client_desk_area_original_layer_save(E_Client *ec, E_Layer layer)
6134 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6135 ec->desk_area.layer_backup = layer;
6139 e_client_layer_set_by_desk_area(E_Client *ec, E_Layer layer)
6145 if (!ec) return EINA_FALSE;
6146 if (!ec->frame) return EINA_FALSE;
6147 if (!ec->desk_area.enable) return EINA_FALSE;
6148 if (!ec->desk_area.desk_area) return EINA_FALSE;
6150 eda = ec->desk_area.desk_area;
6152 // save original layer
6153 _e_client_desk_area_original_layer_save(ec, layer);
6155 // get desk_area layer
6156 edg_layer = (E_Layer)e_desk_area_layer_get(eda);
6157 org_layer = e_client_desk_area_original_layer_get(ec);
6159 ELOGF("EDG", "layer_set by desk_area... layer:%d, org_layer:%d, new_layer:%d", ec, layer, org_layer, edg_layer);
6160 if (org_layer == edg_layer)
6166 evas_object_layer_set(ec->frame, edg_layer);
6167 if (edg_layer == ec->layer)
6175 e_client_desk_area_original_layer_restore(E_Client *ec)
6179 // Do we need to check ec->desk_area.enable?
6180 // if ec->desk_area.enable is true, then e_client_layer_set calls
6181 // e_desk_area_ec_edg_layer_set(). that's too bad. :(
6182 // so, we MUST make a policy for ordering of the desk group layer restore
6183 // and the desk group enable.
6184 if (ec->desk_area.enable) return;
6185 e_client_layer_set(ec, ec->desk_area.layer_backup);
6189 e_client_desk_area_original_layer_get(E_Client *ec)
6191 if (!ec) return E_LAYER_DESKTOP;
6193 if (ec->desk_area.enable)
6194 return ec->desk_area.layer_backup;
6200 e_client_desk_area_client_layer_set(E_Client *ec, E_Desk_Area_Client_Layer edgc_layer)
6202 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6203 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6204 if ((edgc_layer < E_DESK_AREA_CLIENT_LAYER_DESKTOP) ||
6205 (edgc_layer >= E_DESK_AREA_CLIENT_LAYER_MAX))
6208 ec->desk_area.edgc_layer = edgc_layer;
6212 EINTERN E_Desk_Area_Client_Layer
6213 e_client_desk_area_client_layer_get(E_Client *ec)
6215 E_OBJECT_CHECK_RETURN(ec, E_DESK_AREA_CLIENT_LAYER_DESKTOP);
6217 return ec->desk_area.edgc_layer;
6220 //FIXME: use e_desk_area_ec_reassign(eda, ec) instead of this api
6222 e_client_desk_area_set(E_Client *ec, E_Desk_Area *eda)
6224 E_Desk_Area *old_edg;
6226 if (!ec) return EINA_FALSE;
6228 #if 0 // if this is removed.. then below if (eda != old_edg) is removed also...
6229 if (ec->desk_area.desk_area == eda)
6233 ELOGF("EDG", "Desk Group Set (new:%p, old:%p)", ec, eda, ec->desk_area.desk_area);
6234 old_edg = ec->desk_area.desk_area;
6236 e_desk_area_ec_remove(old_edg, ec);
6238 ec->desk_area.desk_area = eda;
6239 e_desk_area_ec_add(eda, ec);
6241 #if 0 // if this is removed.. then above if (ec->desk_area.desk_area == eda) is removed also...
6245 e_desk_area_ec_update(eda, ec);
6246 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6254 _raise_between_sibling_under_parent(E_Client *ec)
6256 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);
6257 e_client_stack_below(ec, ec->parent);
6261 _raise_between_sibling_on_parent(E_Client *ec)
6263 E_Client *top_child = NULL;
6264 top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
6267 ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
6268 e_client_stack_above(ec, ec->parent);
6272 if (top_child != ec)
6274 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);
6275 e_client_stack_above(ec, top_child);
6278 ELOGF("POL", "RAISE child window between sibling... already on the top. STAY", ec);
6283 _raise_belong_to_parent(E_Client *ec)
6285 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6286 _raise_between_sibling_under_parent(ec);
6288 _raise_between_sibling_on_parent(ec);
6292 e_client_raise(E_Client *ec)
6296 #ifdef REFACTOR_DESK_AREA
6298 if (ec->desk_area.enable)
6301 eda = ec->desk_area.desk_area;
6304 e_desk_area_ec_raise(eda, ec);
6310 if (ec->parent && e_client_is_belong_to_parent(ec))
6311 _raise_belong_to_parent(ec);
6313 evas_object_raise(ec->frame);
6315 wl_signal_emit_mutable(&PRI(ec)->events.raise, NULL);
6319 _e_client_transient_for_below_group_make(E_Client *ec, Eina_List **list)
6321 // list : Head is the bottommost child
6327 EINA_LIST_REVERSE_FOREACH(ec->transients, l, child)
6329 if (!child) continue;
6330 if (e_client_transient_policy_get(child) != E_TRANSIENT_BELOW) continue;
6331 if (!e_client_is_belong_to_parent(child)) continue;
6333 *list = eina_list_prepend(*list, child);
6334 _e_client_transient_for_group_make(child, list);
6339 e_client_transient_child_bottom_get(E_Client *ec)
6341 E_Client *bottom_ec = NULL;
6342 Eina_List *transient_below_list = NULL;
6343 Eina_List *l = NULL;
6345 _e_client_transient_for_below_group_make(ec, &transient_below_list);
6347 if (transient_below_list)
6349 E_Client *temp_ec = NULL;
6350 E_Client *temp_ec2 = NULL;
6352 E_CLIENT_FOREACH(temp_ec)
6354 if (bottom_ec) break;
6362 EINA_LIST_FOREACH(transient_below_list, l, temp_ec2)
6364 if (temp_ec == temp_ec2)
6366 bottom_ec = temp_ec2;
6371 eina_list_free(transient_below_list);
6377 _lower_between_sibling_under_parent(E_Client *ec)
6379 E_Client *bottom_child = NULL;
6380 bottom_child = e_client_transient_child_bottom_get(ec->parent);
6383 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);
6384 e_client_stack_below(ec, ec->parent);
6388 if (bottom_child != ec)
6390 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);
6391 e_client_stack_below(ec, bottom_child);
6394 ELOGF("POL", "LOWER child window between sibling... already under the bottom. STAY", ec);
6399 _lower_between_sibling_on_parent(E_Client *ec)
6401 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);
6402 e_client_stack_above(ec, ec->parent);
6406 _lower_belong_to_parent(E_Client *ec)
6408 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6409 _lower_between_sibling_under_parent(ec);
6411 _lower_between_sibling_on_parent(ec);
6415 e_client_lower(E_Client *ec)
6419 #ifdef REFACTOR_DESK_AREA
6421 if (ec->desk_area.enable)
6424 eda = ec->desk_area.desk_area;
6427 e_desk_area_ec_lower(eda, ec);
6429 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6435 if (ec->parent && e_client_is_belong_to_parent(ec))
6436 _lower_belong_to_parent(ec);
6438 evas_object_lower(ec->frame);
6440 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6444 e_client_stack_above(E_Client *ec, E_Client *above)
6447 if (!ec->frame) return;
6449 if (!above->frame) return;
6451 #ifdef REFACTOR_DESK_AREA
6453 if (ec->desk_area.enable)
6456 eda = ec->desk_area.desk_area;
6459 e_desk_area_ec_stack_above(eda, ec, above);
6465 evas_object_stack_above(ec->frame, above->frame);
6467 wl_signal_emit_mutable(&PRI(ec)->events.stack_above, NULL);
6471 e_client_stack_below(E_Client *ec, E_Client *below)
6474 if (!ec->frame) return;
6476 if (!below->frame) return;
6478 #ifdef REFACTOR_DESK_AREA
6480 if (ec->desk_area.enable)
6483 eda = ec->desk_area.desk_area;
6486 e_desk_area_ec_stack_below(eda, ec, below);
6492 evas_object_stack_below(ec->frame, below->frame);
6494 wl_signal_emit_mutable(&PRI(ec)->events.stack_below, NULL);
6498 e_client_show_pending_set(E_Client *ec)
6502 ec->show_pending.count++;
6503 ELOGF("E_CLIENT", "SET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6504 return ec->show_pending.count;
6508 e_client_show_pending_unset(E_Client *ec)
6511 if (ec->show_pending.count <= 0) return 0;
6513 ec->show_pending.count--;
6514 ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6515 if (ec->show_pending.count == 0 && ec->show_pending.running)
6517 ec->show_pending.running = EINA_FALSE;
6520 ELOGF("E_CLIENT", "evas_object_show by unset show_pending", ec);
6521 evas_object_show(ec->frame);
6522 //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
6527 return ec->show_pending.count;
6531 _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6535 Eina_Bool res = EINA_TRUE;
6536 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6541 EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc)
6543 res = _e_client_surface_tree_foreach_helper(subc, func, data);
6550 res = func(data, ec);
6553 EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc)
6555 res = _e_client_surface_tree_foreach_helper(subc,
6568 e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6570 EINA_SAFETY_ON_NULL_RETURN(ec);
6571 EINA_SAFETY_ON_NULL_RETURN(func);
6573 _e_client_surface_tree_foreach_helper(ec, func, data);
6576 EINTERN E_Comp_Wl_Client_Data *
6577 e_client_cdata_new(E_Client *ec)
6579 E_Comp_Wl_Client_Data *cdata;
6581 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6583 if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1)))
6585 ERR("Could not allocate new E_Comp_Wl_Client_Data structure");
6588 ec->comp_data = cdata;
6594 e_client_cdata_free(E_Client *ec)
6596 EINA_SAFETY_ON_NULL_RETURN(ec);
6597 if (!ec->comp_data) return;
6599 E_FREE(ec->comp_data);
6602 EINTERN E_Comp_Wl_Client_Data *
6603 e_client_cdata_get(E_Client *ec)
6605 if (!ec) return NULL;
6607 return ec->comp_data;
6611 e_client_map_set(E_Client *ec, E_Map *em)
6613 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6615 return e_map_set_to_comp_object(em, ec->frame);
6619 e_client_map_get(const E_Client *ec)
6621 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6623 return e_map_get_from_comp_object(ec->frame);
6627 e_client_map_enable_set(E_Client *ec, Eina_Bool enable)
6629 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6630 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE);
6632 evas_object_map_enable_set(ec->frame, enable);
6638 e_client_belong_to_parent_set(E_Client *ec, Eina_Bool set)
6641 ec->belong_to_parent = set;
6645 e_client_is_belong_to_parent(E_Client *ec)
6647 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6648 return ec->belong_to_parent;
6652 e_client_transient_policy_set(E_Client *ec, E_Transient policy)
6655 ec->transient_policy = policy;
6659 e_client_transient_policy_get(E_Client *ec)
6661 if (!ec) return E_TRANSIENT_ABOVE;
6662 return ec->transient_policy;
6666 e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb)
6668 if (_e_client_resize_object_create_cb && cb)
6669 CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!");
6670 _e_client_resize_object_create_cb = cb;
6674 e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
6678 // FYI, we consider 0 and 1 to be the same value as a default unit size.
6679 ec->manage_resize.unit_size = unit_size;
6683 e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
6686 ec->desk_zoom.enable = enable;
6690 e_client_desk_zoom_enable_get(E_Client *ec)
6692 if (!ec) return EINA_FALSE;
6693 return ec->desk_zoom.enable;
6697 e_client_layout_apply(E_Client *ec, Eina_Bool apply)
6700 ec->apply_layout = apply;
6704 e_client_is_layout_apply(E_Client *ec)
6706 if (!ec) return EINA_FALSE;
6707 return ec->apply_layout;
6711 e_client_from_surface_resource(struct wl_resource *surface_resource)
6713 EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, NULL);
6715 return e_comp_wl_util_client_from_surface_resource(surface_resource);
6719 e_client_fps_update(E_Client *ec)
6724 EINA_SAFETY_ON_NULL_RETURN(ec);
6726 if (!ec->fps.enabled) return;
6728 tim = ecore_time_get();
6730 dt = tim - ec->fps.frametimes[0];
6732 ec->fps.frametimes[0] = tim;
6736 if (ec->fps.lapse == 0.0)
6738 ec->fps.lapse = tim;
6739 ec->fps.flapse = ec->fps.cframes;
6741 else if ((tim - ec->fps.lapse) >= 0.5)
6743 ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
6744 (tim - ec->fps.lapse);
6745 ec->fps.lapse = tim;
6746 ec->fps.flapse = ec->fps.cframes;
6752 e_client_fps_get(E_Client *ec, double *fps)
6754 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6756 if (ec->fps.old_fps == ec->fps.fps)
6759 if (ec->fps.fps > 0.0)
6762 ec->fps.old_fps = ec->fps.fps;
6770 e_client_fps_enable(E_Client *ec, Eina_Bool enable)
6772 EINA_SAFETY_ON_NULL_RETURN(ec);
6774 ec->fps.enabled = enable;
6778 e_client_explicit_sync_get(E_Client *ec)
6780 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6782 return ec->explicit_sync;
6786 e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable)
6788 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6790 ec->explicit_sync = enable;
6796 e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec)
6798 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, -1);
6800 return ec->acquire_fence_fd;
6804 e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd)
6806 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6808 ec->acquire_fence_fd = fd;
6814 e_client_intercept_hook_auto_placement_call(E_Client *ec)
6816 // no need to call the intercept hook if ec is NULL.
6817 if (!ec) return EINA_FALSE;
6819 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
6821 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT Intercepted.", ec);
6829 e_client_iconify_event_send(E_Client *ec)
6831 EINA_SAFETY_ON_NULL_RETURN(ec);
6833 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
6837 e_client_uniconify_event_send(E_Client *ec)
6839 EINA_SAFETY_ON_NULL_RETURN(ec);
6841 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
6845 e_client_stack_transient_for_done_notify(E_Client *ec)
6847 EINA_SAFETY_ON_NULL_RETURN(ec);
6849 wl_signal_emit_mutable(&PRI(ec)->events.stack_transient_for_done, NULL);
6852 #ifdef REFACTOR_DESK_AREA
6854 e_client_subsurface_stack_update(E_Client *ec)
6856 EINA_SAFETY_ON_NULL_RETURN(ec);
6858 wl_signal_emit_mutable(&PRI(ec)->events.subsurface_stack_update, ec);
6863 e_client_eval_pre_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6866 wl_signal_add(&priv->events.eval_pre_fetch, listener);
6870 e_client_eval_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6873 wl_signal_add(&priv->events.eval_fetch, listener);
6877 e_client_eval_pre_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6880 wl_signal_add(&priv->events.eval_pre_post_fetch, listener);
6884 e_client_eval_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6887 wl_signal_add(&priv->events.eval_post_fetch, listener);
6891 e_client_eval_pre_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6894 wl_signal_add(&priv->events.eval_pre_frame_assign, listener);
6898 e_client_eval_post_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6901 wl_signal_add(&priv->events.eval_post_frame_assign, listener);
6905 e_client_eval_pre_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6908 wl_signal_add(&priv->events.eval_pre_new_client, listener);
6912 e_client_eval_post_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6915 wl_signal_add(&priv->events.eval_post_new_client, listener);
6919 e_client_eval_visibility_listener_add(E_Client *ec, struct wl_listener *listener)
6922 wl_signal_add(&priv->events.eval_visibility, listener);
6926 e_client_eval_visibility_end_listener_add(E_Client *ec, struct wl_listener *listener)
6929 wl_signal_add(&priv->events.eval_visibility_end, listener);
6933 e_client_eval_end_listener_add(E_Client *ec, struct wl_listener *listener)
6936 wl_signal_add(&priv->events.eval_end, listener);
6940 e_client_move_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6943 wl_signal_add(&priv->events.move_begin, listener);
6947 e_client_move_update_listener_add(E_Client *ec, struct wl_listener *listener)
6950 wl_signal_add(&priv->events.move_update, listener);
6954 e_client_move_end_listener_add(E_Client *ec, struct wl_listener *listener)
6957 wl_signal_add(&priv->events.move_end, listener);
6961 e_client_move_resize_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6964 wl_signal_add(&priv->events.move_resize_begin, listener);
6968 e_client_move_resize_update_listener_add(E_Client *ec, struct wl_listener *listener)
6971 wl_signal_add(&priv->events.move_resize_update, listener);
6975 e_client_move_resize_end_listener_add(E_Client *ec, struct wl_listener *listener)
6978 wl_signal_add(&priv->events.move_resize_end, listener);
6982 e_client_destroy_listener_add(E_Client *ec, struct wl_listener *listener)
6985 wl_signal_add(&priv->events.destroy, listener);
6989 e_client_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6992 wl_signal_add(&priv->events.new_client, listener);
6996 e_client_new_client_post_listener_add(E_Client *ec, struct wl_listener *listener)
6999 wl_signal_add(&priv->events.new_client_post, listener);
7003 e_client_unredirect_listener_add(E_Client *ec, struct wl_listener *listener)
7006 wl_signal_add(&priv->events.unredirect, listener);
7010 e_client_redirect_listener_add(E_Client *ec, struct wl_listener *listener)
7013 wl_signal_add(&priv->events.redirect, listener);
7017 e_client_aux_hint_change_listener_add(E_Client *ec, struct wl_listener *listener)
7020 wl_signal_add(&priv->events.aux_hint_change, listener);
7024 e_client_window_role_change_listener_add(E_Client *ec, struct wl_listener *listener)
7027 wl_signal_add(&priv->events.window_role_change, listener);
7031 e_client_transform_change_listener_add(E_Client *ec, struct wl_listener *listener)
7034 wl_signal_add(&priv->events.transform_change, listener);
7038 e_client_activate_done_listener_add(E_Client *ec, struct wl_listener *listener)
7041 wl_signal_add(&priv->events.activate_done, listener);
7045 e_client_mouse_in_listener_add(E_Client *ec, struct wl_listener *listener)
7048 wl_signal_add(&priv->events.mouse_in, listener);
7052 e_client_mouse_out_listener_add(E_Client *ec, struct wl_listener *listener)
7055 wl_signal_add(&priv->events.mouse_out, listener);
7059 e_client_mouse_down_listener_add(E_Client *ec, struct wl_listener *listener)
7062 wl_signal_add(&priv->events.mouse_down, listener);
7066 e_client_focus_set_listener_add(E_Client *ec, struct wl_listener *listener)
7069 wl_signal_add(&priv->events.focus_set, listener);
7073 e_client_focus_unset_listener_add(E_Client *ec, struct wl_listener *listener)
7076 wl_signal_add(&priv->events.focus_unset, listener);
7080 e_client_focus_defer_set_listener_add(E_Client *ec, struct wl_listener *listener)
7083 wl_signal_add(&priv->events.focus_defer_set, listener);
7087 e_client_focus_latest_set_listener_add(E_Client *ec, struct wl_listener *listener)
7090 wl_signal_add(&priv->events.focus_latest_set, listener);
7094 e_client_iconify_listener_add(E_Client *ec, struct wl_listener *listener)
7097 wl_signal_add(&priv->events.iconify, listener);
7101 e_client_uniconify_listener_add(E_Client *ec, struct wl_listener *listener)
7104 wl_signal_add(&priv->events.uniconify, listener);
7108 e_client_maximize_listener_add(E_Client *ec, struct wl_listener *listener)
7111 wl_signal_add(&priv->events.maximize, listener);
7115 e_client_unmaximize_listener_add(E_Client *ec, struct wl_listener *listener)
7118 wl_signal_add(&priv->events.unmaximize, listener);
7122 e_client_fullscreen_pre_listener_add(E_Client *ec, struct wl_listener *listener)
7125 wl_signal_add(&priv->events.fullscreen_pre, listener);
7129 e_client_fullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7132 wl_signal_add(&priv->events.fullscreen, listener);
7136 e_client_unfullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7139 wl_signal_add(&priv->events.unfullscreen, listener);
7143 e_client_move_listener_add(E_Client *ec, struct wl_listener *listener)
7146 wl_signal_add(&priv->events.move, listener);
7150 e_client_raise_listener_add(E_Client *ec, struct wl_listener *listener)
7153 wl_signal_add(&priv->events.raise, listener);
7157 e_client_lower_listener_add(E_Client *ec, struct wl_listener *listener)
7160 wl_signal_add(&priv->events.lower, listener);
7164 e_client_stack_below_listener_add(E_Client *ec, struct wl_listener *listener)
7167 wl_signal_add(&priv->events.stack_below, listener);
7171 e_client_stack_above_listener_add(E_Client *ec, struct wl_listener *listener)
7174 wl_signal_add(&priv->events.stack_above, listener);
7178 e_client_set_layer_listener_add(E_Client *ec, struct wl_listener *listener)
7181 wl_signal_add(&priv->events.set_layer, listener);
7185 e_client_stack_transient_for_done_listener_add(E_Client *ec, struct wl_listener *listener)
7188 wl_signal_add(&priv->events.stack_transient_for_done, listener);
7192 e_client_stick_listener_add(E_Client *ec, struct wl_listener *listener)
7195 wl_signal_add(&priv->events.stick, listener);
7199 e_client_unstick_listener_add(E_Client *ec, struct wl_listener *listener)
7202 wl_signal_add(&priv->events.unstick, listener);
7205 EINTERN struct wl_listener *
7206 e_client_destroy_listener_get(E_Client *ec, wl_notify_func_t notify)
7208 API_ENTRY_VAL(NULL);
7209 return wl_signal_get(&priv->events.destroy, notify);
7212 #ifdef REFACTOR_DESK_AREA
7214 e_client_get_above_listener_add(E_Client *ec, struct wl_listener *listener)
7217 wl_signal_add(&priv->events.get_above, listener);
7221 e_client_get_below_listener_add(E_Client *ec, struct wl_listener *listener)
7224 wl_signal_add(&priv->events.get_below, listener);
7228 e_client_get_visible_above_listener_add(E_Client *ec, struct wl_listener *listener)
7231 wl_signal_add(&priv->events.get_visible_above, listener);
7235 e_client_get_visible_below_listener_add(E_Client *ec, struct wl_listener *listener)
7238 wl_signal_add(&priv->events.get_visible_below, listener);
7242 e_client_subsurface_stack_update_listener_add(E_Client *ec, struct wl_listener *listener)
7245 wl_signal_add(&priv->events.subsurface_stack_update, listener);
7250 e_client_shell_configure_send(E_Client *ec, uint32_t edges, int32_t width, int32_t height)
7252 EINA_SAFETY_ON_NULL_RETURN(ec);
7253 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7255 if ((!ec->comp_data->shell.surface) ||
7256 (!ec->comp_data->shell.configure_send))
7259 ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, edges, width, height);
7263 e_client_shell_configure(E_Client *ec, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
7265 EINA_SAFETY_ON_NULL_RETURN(ec);
7266 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7268 if ((!ec->comp_data->shell.surface) ||
7269 (!ec->comp_data->shell.configure))
7272 ec->comp_data->shell.configure(ec->comp_data->shell.surface, x, y, width, height);
7276 e_client_shell_ping(E_Client *ec)
7278 EINA_SAFETY_ON_NULL_RETURN(ec);
7279 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7281 if ((!ec->comp_data->shell.surface) ||
7282 (!ec->comp_data->shell.ping))
7285 ec->comp_data->shell.ping(ec->comp_data->shell.surface);
7289 _e_client_shell_map(E_Client *ec)
7291 EINA_SAFETY_ON_NULL_RETURN(ec);
7292 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7294 if ((!ec->comp_data->shell.surface) ||
7295 (!ec->comp_data->shell.map))
7298 ec->comp_data->shell.map(ec->comp_data->shell.surface);
7302 e_client_shell_unmap(E_Client *ec)
7304 EINA_SAFETY_ON_NULL_RETURN(ec);
7305 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7307 if ((!ec->comp_data->shell.surface) ||
7308 (!ec->comp_data->shell.unmap))
7311 ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
7315 e_client_show(E_Client *ec)
7317 EINA_SAFETY_ON_NULL_RETURN(ec);
7318 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7320 if (ec->comp_data->mapped)
7323 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.map) &&
7326 ELOGF("E_CLIENT", "Map.", ec);
7327 _e_client_shell_map(ec);
7329 else if (ec->internal || e_comp_wl_subsurface_can_show(ec) ||
7330 (ec == e_comp_wl->drag_client))
7332 ELOGF("E_CLIENT", "Map. internal:%d, drag:%d",
7333 ec, ec->internal, (ec == e_comp_wl->drag_client));
7334 ec->visible = EINA_TRUE;
7336 evas_object_show(ec->frame);
7337 ec->comp_data->mapped = 1;
7342 e_client_hide(E_Client *ec)
7346 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7348 if (!ec->comp_data->mapped)
7351 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap))
7353 ELOGF("E_CLIENT", "Unmap", ec);
7355 if (priv->hide_by_request)
7356 ELOGF("COMP", "Currenlty hide_by_request state.", ec);
7358 if (ec->show_pending.count > 0)
7360 ELOGF("E_CLIENT", "Reset show_pending!!! (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
7361 ec->show_pending.count = 0;
7362 if (ec->show_pending.running)
7364 // need to send visibility false;
7365 ec->visibility.obscured = E_VISIBILITY_UNOBSCURED;
7366 ELOGF("POL_VIS", "CLIENT VIS ON (fake). argb:%d, opaque:%2d", ec, ec->argb, ec->visibility.opaque);
7369 ec->show_pending.running = EINA_FALSE;
7371 e_client_shell_unmap(ec);
7373 else if ((ec->internal) || (e_comp_wl_subsurface_check(ec)) ||
7374 (ec == e_comp_wl->drag_client))
7376 ELOGF("E_CLIENT", "Unmap. internal:%d, sub:%p, drag:%d",
7377 ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client));
7378 ec->visible = EINA_FALSE;
7379 evas_object_hide(ec->frame);
7380 ec->comp_data->mapped = 0;