2 #include "e_client_intern.h"
4 #define PRI(ec) ((E_Client_Private *)e_object_data_get(E_OBJECT(ec)))
7 EINA_SAFETY_ON_NULL_RETURN(ec); \
8 E_Client_Private *priv = PRI(ec)
10 #define API_ENTRY_VAL(ret) \
11 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ret); \
12 E_Client_Private *priv = PRI(ec)
14 typedef struct _E_Client_Private E_Client_Private;
16 struct _E_Client_Private
20 struct wl_signal eval_pre_fetch;
21 struct wl_signal eval_fetch;
22 struct wl_signal eval_pre_post_fetch;
23 struct wl_signal eval_post_fetch;
24 struct wl_signal eval_pre_frame_assign;
25 struct wl_signal eval_post_frame_assign;
26 struct wl_signal eval_pre_new_client;
27 struct wl_signal eval_post_new_client;
28 struct wl_signal eval_visibility;
29 struct wl_signal eval_visibility_end;
30 struct wl_signal eval_end;
32 struct wl_signal move_begin;
33 struct wl_signal move_update;
34 struct wl_signal move_end;
35 struct wl_signal move_resize_begin;
36 struct wl_signal move_resize_update;
37 struct wl_signal move_resize_end;
39 struct wl_signal destroy;
40 struct wl_signal new_client;
41 struct wl_signal new_client_post;
43 struct wl_signal unredirect;
44 struct wl_signal redirect;
46 struct wl_signal aux_hint_change;
47 struct wl_signal window_role_change;
48 struct wl_signal transform_change;
49 struct wl_signal activate_done;
51 struct wl_signal mouse_in;
52 struct wl_signal mouse_out;
53 struct wl_signal mouse_down;
55 struct wl_signal focus_set;
56 struct wl_signal focus_unset;
57 struct wl_signal focus_defer_set;
58 struct wl_signal focus_latest_set;
60 struct wl_signal iconify;
61 struct wl_signal uniconify;
62 struct wl_signal maximize;
63 struct wl_signal unmaximize;
64 struct wl_signal fullscreen_pre;
65 struct wl_signal fullscreen;
66 struct wl_signal unfullscreen;
68 struct wl_signal move;
70 struct wl_signal set_layer;
71 struct wl_signal raise;
72 struct wl_signal lower;
73 struct wl_signal stack_below;
74 struct wl_signal stack_above;
75 struct wl_signal stack_transient_for_done;
77 struct wl_signal stick;
78 struct wl_signal unstick;
80 #ifdef REFACTOR_DESK_AREA
81 struct wl_signal get_above;
82 struct wl_signal get_below;
83 struct wl_signal get_visible_below;
84 struct wl_signal subsurface_stack_update;
88 Eina_Bool hide_by_request;
91 static int _e_client_hooks_delete = 0;
92 static int _e_client_hooks_walking = 0;
94 static int _e_client_intercept_hooks_delete = 0;
95 static int _e_client_intercept_hooks_walking = 0;
97 E_API int E_EVENT_CLIENT_ADD = -1;
98 E_API int E_EVENT_CLIENT_REMOVE = -1;
99 E_API int E_EVENT_CLIENT_ZONE_SET = -1;
100 E_API int E_EVENT_CLIENT_DESK_SET = -1;
101 E_API int E_EVENT_CLIENT_RESIZE = -1;
102 E_API int E_EVENT_CLIENT_MOVE = -1;
103 E_API int E_EVENT_CLIENT_SHOW = -1;
104 E_API int E_EVENT_CLIENT_HIDE = -1;
105 E_API int E_EVENT_CLIENT_ICONIFY = -1;
106 E_API int E_EVENT_CLIENT_UNICONIFY = -1;
107 E_API int E_EVENT_CLIENT_STACK = -1;
108 E_API int E_EVENT_CLIENT_FOCUS_IN = -1;
109 E_API int E_EVENT_CLIENT_FOCUS_OUT = -1;
110 E_API int E_EVENT_CLIENT_PROPERTY = -1;
111 E_API int E_EVENT_CLIENT_FULLSCREEN = -1;
112 E_API int E_EVENT_CLIENT_UNFULLSCREEN = -1;
113 #ifdef _F_ZONE_WINDOW_ROTATION_
114 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = -1;
115 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = -1;
116 E_API int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1;
117 E_API int E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = -1;
119 E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1;
120 E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1;
121 E_API int E_EVENT_CLIENT_FOCUS_SKIP_SET = -1;
122 E_API int E_EVENT_CLIENT_FOCUS_SKIP_UNSET = -1;
124 static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client
126 static E_Client *ecmove = NULL;
127 static E_Client *ecresize = NULL;
128 static E_Client *action_client = NULL;
130 static Eina_Bool comp_grabbed = EINA_FALSE;
132 static Eina_List *handlers = NULL;
133 static Eina_List *hooks = NULL;
135 static Ecore_Event_Handler *action_handler_mouse = NULL;
136 static Ecore_Timer *action_timer = NULL;
137 static Eina_Rectangle action_orig = {0, 0, 0, 0};
139 static E_Client_Resize_Object_Create_Cb _e_client_resize_object_create_cb = NULL;
141 EINTERN void e_client_focused_set(E_Client *ec);
142 static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list);
143 static Evas_Object *_e_client_resize_object_create(E_Client *ec);
144 static void _e_client_resize_object_del(E_Client *ec);
145 static void _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y);
146 static void _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y);
148 static Eina_Inlist *_e_client_hooks[] =
150 [E_CLIENT_HOOK_EVAL_PRE_FETCH] = NULL,
151 [E_CLIENT_HOOK_EVAL_FETCH] = NULL,
152 [E_CLIENT_HOOK_EVAL_PRE_POST_FETCH] = NULL,
153 [E_CLIENT_HOOK_EVAL_POST_FETCH] = NULL,
154 [E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN] = NULL,
155 [E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN] = NULL,
156 [E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT] = NULL,
157 [E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT] = NULL,
158 [E_CLIENT_HOOK_EVAL_END] = NULL,
159 [E_CLIENT_HOOK_FOCUS_SET] = NULL,
160 [E_CLIENT_HOOK_FOCUS_UNSET] = NULL,
161 [E_CLIENT_HOOK_NEW_CLIENT] = NULL,
162 [E_CLIENT_HOOK_MOVE_BEGIN] = NULL,
163 [E_CLIENT_HOOK_MOVE_UPDATE] = NULL,
164 [E_CLIENT_HOOK_MOVE_END] = NULL,
165 [E_CLIENT_HOOK_RESIZE_BEGIN] = NULL,
166 [E_CLIENT_HOOK_RESIZE_UPDATE] = NULL,
167 [E_CLIENT_HOOK_RESIZE_END] = NULL,
168 [E_CLIENT_HOOK_FULLSCREEN_PRE] = NULL,
169 [E_CLIENT_HOOK_DEL] = NULL,
170 [E_CLIENT_HOOK_UNREDIRECT] = NULL,
171 [E_CLIENT_HOOK_REDIRECT] = NULL,
172 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
173 [E_CLIENT_HOOK_NEW_CLIENT_POST] = NULL,
175 [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL,
176 [E_CLIENT_HOOK_ICONIFY] = NULL,
177 [E_CLIENT_HOOK_UNICONIFY] = NULL,
178 [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL,
179 [E_CLIENT_HOOK_WINDOW_ROLE_CHANGE] = NULL,
180 [E_CLIENT_HOOK_TRANSFORM_CHANGE] = NULL,
181 [E_CLIENT_HOOK_ACTIVATE_DONE] = NULL,
182 [E_CLIENT_HOOK_EVAL_VISIBILITY_END] = NULL,
185 static Eina_Inlist *_e_client_intercept_hooks[] =
187 [E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT] = NULL,
188 [E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT] = NULL,
191 ///////////////////////////////////////////
194 _e_client_hooks_clean(void)
200 for (x = 0; x < E_CLIENT_HOOK_LAST; x++)
201 EINA_INLIST_FOREACH_SAFE(_e_client_hooks[x], l, ch)
203 if (!ch->delete_me) continue;
204 _e_client_hooks[x] = eina_inlist_remove(_e_client_hooks[x], EINA_INLIST_GET(ch));
210 _e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
214 e_object_ref(E_OBJECT(ec));
215 _e_client_hooks_walking++;
216 EINA_INLIST_FOREACH(_e_client_hooks[hookpoint], ch)
218 if (ch->delete_me) continue;
219 ch->func(ch->data, ec);
220 if ((hookpoint != E_CLIENT_HOOK_DEL) &&
221 (hookpoint != E_CLIENT_HOOK_MOVE_END) &&
222 (hookpoint != E_CLIENT_HOOK_RESIZE_END) &&
223 (hookpoint != E_CLIENT_HOOK_FOCUS_UNSET) &&
224 e_object_is_del(E_OBJECT(ec)))
227 _e_client_hooks_walking--;
228 if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
229 _e_client_hooks_clean();
230 return !!e_object_unref(E_OBJECT(ec));
233 ///////////////////////////////////////////
236 _e_client_intercept_hooks_clean(void)
239 E_Client_Intercept_Hook *ch;
242 for (x = 0; x < E_CLIENT_INTERCEPT_HOOK_LAST; x++)
243 EINA_INLIST_FOREACH_SAFE(_e_client_intercept_hooks[x], l, ch)
245 if (!ch->delete_me) continue;
246 _e_client_intercept_hooks[x] =
247 eina_inlist_remove(_e_client_intercept_hooks[x], EINA_INLIST_GET(ch));
253 _e_client_intercept_hook_call(E_Client_Intercept_Hook_Point hookpoint, E_Client *ec)
255 E_Client_Intercept_Hook *ch;
256 Eina_Bool ret = EINA_TRUE;
258 if (e_object_is_del(E_OBJECT(ec)))
260 if (hookpoint != E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT)
266 e_object_ref(E_OBJECT(ec));
267 _e_client_intercept_hooks_walking++;
268 EINA_INLIST_FOREACH(_e_client_intercept_hooks[hookpoint], ch)
270 if (ch->delete_me) continue;
271 if (!(ch->func(ch->data, ec)))
277 _e_client_intercept_hooks_walking--;
278 if ((_e_client_intercept_hooks_walking == 0) &&
279 (_e_client_intercept_hooks_delete > 0))
280 _e_client_intercept_hooks_clean();
282 e_object_unref(E_OBJECT(ec));
287 _e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
290 e_object_unref(E_OBJECT(ev->ec));
295 _e_client_event_simple(E_Client *ec, int type)
299 ev = E_NEW(E_Event_Client, 1);
303 e_object_ref(E_OBJECT(ec));
304 ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
308 _e_client_event_add(E_Client *ec)
313 ec->reg_ev.add = EINA_TRUE;
314 ELOGF("COMP", "SEND E_EVENT_CLIENT_ADD event", ec);
315 _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
319 _e_client_event_remove(E_Client *ec)
324 ec->reg_ev.add = EINA_FALSE;
325 ELOGF("COMP", "SEND E_EVENT_CLIENT_REMOVE event", ec);
326 _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
330 _e_client_event_show(E_Client *ec)
335 ec->reg_ev.show = EINA_TRUE;
336 _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
340 _e_client_event_hide(E_Client *ec)
342 if (!ec->reg_ev.show)
345 ec->reg_ev.show = EINA_FALSE;
346 _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
350 _e_client_event_property(E_Client *ec, int prop)
352 E_Event_Client_Property *ev;
354 ev = E_NEW(E_Event_Client_Property, 1);
359 e_object_ref(E_OBJECT(ec));
360 ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
363 ////////////////////////////////////////////////
366 _e_client_action_input_win_del(void)
368 if (!comp_grabbed) return 0;
370 e_comp_ungrab_input(1, 1);
376 _e_client_action_finish(void)
379 _e_client_action_input_win_del();
381 E_FREE_FUNC(action_timer, ecore_timer_del);
382 E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
385 action_client->keyboard_resizing = 0;
387 action_client = NULL;
391 _e_client_transform_point_transform(int cx, int cy, double angle, int x, int y, int *tx, int *ty)
393 double s = sin(angle * M_PI / 180);
394 double c = cos(angle * M_PI / 180);
401 ry = - x * s + y * c;
411 _e_client_transform_geometry_save(E_Client *ec, E_Map *map)
417 for (i = 0; i < 4; i ++)
419 e_map_point_precise_coord_get(map, i,
420 &ec->transform.saved[i].x,
421 &ec->transform.saved[i].y,
422 &ec->transform.saved[i].z);
427 _e_client_transform_resize(E_Client *ec)
431 double dx = 0, dy = 0;
436 if (!ec->transformed) return;
438 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
444 cx = ec->client.x + pw / 2;
445 cy = ec->client.y + ph / 2;
447 /* step 1: Rotate resized object and get map points */
448 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
449 e_map_util_points_populate_from_geometry(map,
450 ec->client.x, ec->client.y,
453 e_map_util_rotate(map, ec->transform.angle, cx, cy);
454 e_map_util_zoom(map, ec->transform.zoom, ec->transform.zoom, cx, cy);
456 for (i = 0; i < 4; i++)
457 e_map_point_precise_coord_get(map, i, &px[i], &py[i], NULL);
461 /* step 2: get adjusted values to keep up fixed position according
463 switch (ec->resize_mode)
465 case E_POINTER_RESIZE_R:
466 case E_POINTER_RESIZE_BR:
467 dx = ec->transform.saved[0].x - px[0];
468 dy = ec->transform.saved[0].y - py[0];
470 case E_POINTER_RESIZE_BL:
471 case E_POINTER_RESIZE_B:
472 dx = ec->transform.saved[1].x - px[1];
473 dy = ec->transform.saved[1].y - py[1];
475 case E_POINTER_RESIZE_TL:
476 case E_POINTER_RESIZE_L:
477 dx = ec->transform.saved[2].x - px[2];
478 dy = ec->transform.saved[2].y - py[2];
480 case E_POINTER_RESIZE_T:
481 case E_POINTER_RESIZE_TR:
482 dx = ec->transform.saved[3].x - px[3];
483 dy = ec->transform.saved[3].y - py[3];
489 ec->transform.adjusted.x = dx;
490 ec->transform.adjusted.y = dy;
492 /* step 3: set each points of the quadrangle */
493 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
494 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
496 for (i = 0; i < 4; i++)
497 e_map_point_precise_coord_set(map, i, px[i] + dx, py[i] + dy, 0);
499 e_client_map_set(ec, map);
500 e_client_map_enable_set(ec, EINA_TRUE);
505 _e_client_transform_resize_handle(E_Client *ec)
508 int new_x, new_y, new_w, new_h;
512 Evas_Point current, moveinfo;
515 if (e_object_is_del(E_OBJECT(ec))) return;
516 if (e_client_util_ignored_get(ec)) return;
517 if (!ec->transformed) return;
519 zone = e_comp_zone_find_by_ec(ec);
522 button_id = ec->moveinfo.down.button;
524 org_w = ec->mouse.last_down[button_id - 1].w;
525 org_h = ec->mouse.last_down[button_id - 1].h;
527 new_w = ec->client.w;
528 new_h = ec->client.h;
529 new_x = ec->client.x;
530 new_y = ec->client.y;
532 /* step 1: get center coordinate its' based on original object geometry*/
533 cx = ec->client.x + org_w / 2;
534 cy = ec->client.y + org_h / 2;
536 /* step 2: transform coordinates of mouse position
537 * subtract adjusted value from mouse position is needed */
538 current.x = ec->mouse.current.mx - ec->transform.adjusted.x;
539 current.y = ec->mouse.current.my - ec->transform.adjusted.y;
540 moveinfo.x = ec->moveinfo.down.mx - ec->transform.adjusted.x;
541 moveinfo.y = ec->moveinfo.down.my - ec->transform.adjusted.y;
543 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
544 current.x, current.y,
545 ¤t.x, ¤t.y);
546 _e_client_transform_point_transform(cx, cy, ec->transform.angle,
547 moveinfo.x, moveinfo.y,
548 &moveinfo.x, &moveinfo.y);
550 /* step 3: calculate new size */
551 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
552 (ec->resize_mode == E_POINTER_RESIZE_R) ||
553 (ec->resize_mode == E_POINTER_RESIZE_BR))
555 if ((button_id >= 1) && (button_id <= 3))
556 new_w = org_w + (current.x - moveinfo.x);
558 new_w = ec->moveinfo.down.w + (current.x - moveinfo.x);
560 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
561 (ec->resize_mode == E_POINTER_RESIZE_L) ||
562 (ec->resize_mode == E_POINTER_RESIZE_BL))
564 if ((button_id >= 1) && (button_id <= 3))
565 new_w = org_w - (current.x - moveinfo.x);
567 new_w = ec->moveinfo.down.w - (current.x - moveinfo.x);
570 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
571 (ec->resize_mode == E_POINTER_RESIZE_T) ||
572 (ec->resize_mode == E_POINTER_RESIZE_TR))
574 if ((button_id >= 1) && (button_id <= 3))
575 new_h = org_h - (current.y - moveinfo.y);
577 new_h = ec->moveinfo.down.h - (current.y - moveinfo.y);
579 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
580 (ec->resize_mode == E_POINTER_RESIZE_B) ||
581 (ec->resize_mode == E_POINTER_RESIZE_BR))
583 if ((button_id >= 1) && (button_id <= 3))
584 new_h = org_h + (current.y - moveinfo.y);
586 new_h = ec->moveinfo.down.h + (current.y - moveinfo.y);
589 new_w = MIN(new_w, zone->w);
590 new_h = MIN(new_h, zone->h);
592 /* step 4: move to new position */
593 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
594 (ec->resize_mode == E_POINTER_RESIZE_L) ||
595 (ec->resize_mode == E_POINTER_RESIZE_BL))
596 new_x += (new_w - org_w);
597 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
598 (ec->resize_mode == E_POINTER_RESIZE_T) ||
599 (ec->resize_mode == E_POINTER_RESIZE_TR))
600 new_y += (new_h - org_h);
602 /* step 5: set geometry to new value */
603 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
607 _e_client_transform_resize_begin(E_Client *ec)
610 if (!ec->transformed) return;
612 map = e_client_map_get(ec);
613 _e_client_transform_geometry_save(ec, map);
618 _e_client_transform_resize_end(E_Client *ec)
621 int new_x = 0, new_y = 0;
624 if (!ec->transformed) return;
626 map = e_client_map_get(ec);
629 if (!e_pixmap_size_get(ec->pixmap, &pw, &ph))
635 cx = ec->client.x + pw / 2 + ec->transform.adjusted.x;
636 cy = ec->client.y + ph / 2 + ec->transform.adjusted.y;
638 if (ec->transform.zoom != 1.0)
642 tmp_map = e_map_dup(map);
643 e_map_util_zoom(tmp_map,
644 1 / ec->transform.zoom,
645 1 / ec->transform.zoom,
648 _e_client_transform_geometry_save(ec, tmp_map);
653 _e_client_transform_geometry_save(ec, map);
656 /* move original object to adjusted position after resizing */
657 _e_client_transform_point_transform(cx, cy,
659 ec->transform.saved[0].x,
660 ec->transform.saved[0].y,
662 e_client_util_move_without_frame(ec, new_x, new_y);
663 e_map_util_object_move_sync_set(map, EINA_TRUE);
668 _e_client_transform_move_end(E_Client *ec)
672 double dx, dy, px, py;
675 if (!ec->transformed) return;
677 map = e_client_map_get(ec);
680 if (ec->transform.zoom != 1.0)
682 e_map_point_precise_coord_get(map, 0, &px, &py, NULL);
684 dx = px - ec->transform.saved[0].x;
685 dy = py - ec->transform.saved[0].y;
687 for (i = 0; i < 4; i++)
689 ec->transform.saved[i].x += dx;
690 ec->transform.saved[i].y += dy;
694 _e_client_transform_geometry_save(ec, map);
699 e_client_intercept_hook_focus_revert_call(E_Client *ec)
701 // no need to call the intercept hook if ec is NULL.
702 if (!ec) return EINA_FALSE;
704 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
706 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT Intercepted.", ec);
714 e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
716 E_Client *above = NULL;
718 int x = 0, y = 0, w = 0, h = 0;
719 int ax = 0, ay = 0, aw = 0, ah = 0;
721 if (!ec) return NULL;
723 e_client_geometry_get(ec, &x, &y, &w, &h);
725 zone = e_comp_zone_find_by_ec(ec);
727 E_RECTS_CLIP_TO_RECT(x, y, w, h, zone->x, zone->y, zone->w, zone->h);
729 above = e_client_above_get(ec);
733 (above->layer <= ec->layer))
735 above = e_client_above_get(above);
739 if ((!e_object_is_del(E_OBJECT(above))) &&
740 (!e_client_util_ignored_get(above)) &&
742 (!above->iconic || e_policy_visibility_client_is_uniconic(above)) &&
743 (!above->bg_state) &&
745 (!above->visibility.force_obscured) &&
748 e_client_geometry_get(above, &ax, &ay, &aw, &ah);
749 if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h))
752 above = e_client_above_get(above);
759 e_client_check_obscured_by_children_group(E_Client *ec)
761 E_Client *cec = NULL;
762 Eina_List *transients = NULL, *l = NULL;
764 _e_client_transient_for_group_make(ec, &transients);
765 if (!transients) return NULL;
767 EINA_LIST_FOREACH(transients, l, cec)
769 if (E_CONTAINS(cec->x, cec->y, cec->w, cec->h, ec->x, ec->y, ec->w, ec->h))
771 if (!cec->argb) break;
772 if (cec->visibility.opaque > 0) break;
776 eina_list_free(transients);
782 e_client_check_really_iconified(E_Client *ec)
784 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
786 if (!ec->iconic) return EINA_FALSE;
788 return ((!e_policy_visibility_client_is_uniconic(ec) &&
789 !e_policy_visibility_client_is_uniconify_render_running(ec)) ||
790 (e_client_is_iconified_by_client(ec)));
794 _e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client)
796 E_Event_Client_Focus_Skip_Set *ev;
798 ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1);
802 ev->by_client = by_client;
803 e_object_ref(E_OBJECT(ec));
805 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
809 _e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client)
811 E_Event_Client_Focus_Skip_Unset *ev;
813 ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1);
817 ev->by_client = by_client;
818 e_object_ref(E_OBJECT(ec));
820 ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
824 e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client)
830 if (ec->icccm.accepts_focus)
832 ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client);
833 ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
834 ec->changes.accepts_focus = 1;
837 _e_client_event_focus_skip_set(ec, by_client);
842 if (!ec->icccm.accepts_focus)
844 ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client);
845 ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
846 ec->changes.accepts_focus = 1;
849 _e_client_event_focus_skip_unset(ec, by_client);
855 e_client_check_above_focused(E_Client *ec)
857 E_Client *focus = NULL;
858 E_Client *above = NULL;
860 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
862 focus = e_client_focused_get();
863 if (!focus) return EINA_FALSE;
865 above = e_client_above_get(ec);
871 above = e_client_above_get(above);
878 _e_client_private_init(E_Client *ec)
880 E_Client_Private *priv;
882 priv = E_NEW(E_Client_Private, 1);
886 wl_signal_init(&priv->events.eval_pre_fetch);
887 wl_signal_init(&priv->events.eval_fetch);
888 wl_signal_init(&priv->events.eval_pre_post_fetch);
889 wl_signal_init(&priv->events.eval_post_fetch);
890 wl_signal_init(&priv->events.eval_pre_frame_assign);
891 wl_signal_init(&priv->events.eval_post_frame_assign);
892 wl_signal_init(&priv->events.eval_pre_new_client);
893 wl_signal_init(&priv->events.eval_post_new_client);
894 wl_signal_init(&priv->events.eval_visibility);
895 wl_signal_init(&priv->events.eval_visibility_end);
896 wl_signal_init(&priv->events.eval_end);
897 wl_signal_init(&priv->events.move_begin);
898 wl_signal_init(&priv->events.move_update);
899 wl_signal_init(&priv->events.move_end);
900 wl_signal_init(&priv->events.move_resize_begin);
901 wl_signal_init(&priv->events.move_resize_update);
902 wl_signal_init(&priv->events.move_resize_end);
903 wl_signal_init(&priv->events.destroy);
904 wl_signal_init(&priv->events.new_client);
905 wl_signal_init(&priv->events.new_client_post);
906 wl_signal_init(&priv->events.unredirect);
907 wl_signal_init(&priv->events.redirect);
908 wl_signal_init(&priv->events.aux_hint_change);
909 wl_signal_init(&priv->events.window_role_change);
910 wl_signal_init(&priv->events.transform_change);
911 wl_signal_init(&priv->events.activate_done);
912 wl_signal_init(&priv->events.mouse_in);
913 wl_signal_init(&priv->events.mouse_out);
914 wl_signal_init(&priv->events.mouse_down);
915 wl_signal_init(&priv->events.focus_set);
916 wl_signal_init(&priv->events.focus_unset);
917 wl_signal_init(&priv->events.focus_defer_set);
918 wl_signal_init(&priv->events.focus_latest_set);
919 wl_signal_init(&priv->events.iconify);
920 wl_signal_init(&priv->events.uniconify);
921 wl_signal_init(&priv->events.maximize);
922 wl_signal_init(&priv->events.unmaximize);
923 wl_signal_init(&priv->events.fullscreen_pre);
924 wl_signal_init(&priv->events.fullscreen);
925 wl_signal_init(&priv->events.unfullscreen);
926 wl_signal_init(&priv->events.move);
927 wl_signal_init(&priv->events.set_layer);
928 wl_signal_init(&priv->events.raise);
929 wl_signal_init(&priv->events.lower);
930 wl_signal_init(&priv->events.stack_below);
931 wl_signal_init(&priv->events.stack_above);
932 wl_signal_init(&priv->events.stack_transient_for_done);
933 wl_signal_init(&priv->events.stick);
934 wl_signal_init(&priv->events.unstick);
935 #ifdef REFACTOR_DESK_AREA
936 wl_signal_init(&priv->events.get_above);
937 wl_signal_init(&priv->events.get_below);
938 wl_signal_init(&priv->events.get_visible_below);
939 wl_signal_init(&priv->events.subsurface_stack_update);
942 e_object_data_set(E_OBJECT(ec), priv);
948 _e_client_private_finish(E_Client *ec)
950 E_Client_Private *priv;
953 e_object_data_set(E_OBJECT(ec), NULL);
959 _e_client_free(E_Client *ec)
961 g_rec_mutex_lock(&e_comp->ec_list_mutex);
963 e_comp_object_redirected_set(ec->frame, 0);
964 e_comp_object_render_update_del(ec->frame);
966 E_OBJECT(ec)->references++;
969 e_comp->new_clients--;
971 if (ec->e.state.video_parent && ec->e.state.video_parent_client)
973 ec->e.state.video_parent_client->e.state.video_child =
974 eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
976 if (ec->e.state.video_child)
980 EINA_LIST_FREE(ec->e.state.video_child, tmp)
981 tmp->e.state.video_parent_client = NULL;
983 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
985 E_FREE_FUNC(ec->map_timer, ecore_timer_del);
987 ec->transients = eina_list_free(ec->transients);
988 eina_stringshare_replace(&ec->border.name, NULL);
989 eina_stringshare_replace(&ec->bordername, NULL);
990 eina_stringshare_replace(&ec->icccm.name, NULL);
991 #if defined(__cplusplus) || defined(c_plusplus)
992 eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
994 eina_stringshare_replace(&ec->icccm.class, NULL);
996 eina_stringshare_replace(&ec->icccm.title, NULL);
997 eina_stringshare_replace(&ec->icccm.window_role, NULL);
998 eina_stringshare_replace(&ec->netwm.name, NULL);
1000 E_FREE_FUNC(ec->frame, evas_object_del);
1002 E_OBJECT(ec)->references--;
1003 ELOGF("COMP", "CLIENT FREE", ec);
1005 e_uuid_store_entry_del(ec->uuid);
1007 _e_client_private_finish(ec);
1010 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1014 _e_client_del(E_Client *ec)
1019 g_rec_mutex_lock(&e_comp->ec_list_mutex);
1023 if (ec == e_comp_object_dim_client_get())
1025 INF("[DIM] client deleted\n");
1026 e_comp_object_dim_client_set(NULL);
1029 if (ec->cur_mouse_action)
1031 if (ec->cur_mouse_action->func.end)
1032 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1034 if (action_client == ec) _e_client_action_finish();
1038 e_client_comp_hidden_set(ec, 1);
1039 evas_object_pass_events_set(ec->frame, 1);
1042 E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
1044 wl_signal_emit_mutable(&PRI(ec)->events.destroy, NULL);
1046 /* must be called before parent/child clear */
1047 _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
1049 _e_client_event_remove(ec);
1051 ELOGF("COMP", "CLIENT DEL", ec);
1055 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
1058 EINA_LIST_FREE(ec->transients, child)
1059 child->parent = NULL;
1061 type = e_pixmap_type_get(ec->pixmap);
1062 if (type < E_PIXMAP_TYPE_MAX)
1063 eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
1064 e_comp->clients = eina_list_remove(e_comp->clients, ec);
1065 e_comp_object_render_update_del(ec->frame);
1066 e_comp_post_update_purge(ec);
1067 if (e_pixmap_free(ec->pixmap))
1068 e_pixmap_client_set(ec->pixmap, NULL);
1071 // base_output_resolution
1072 e_util_transform_del(ec->base_output_resolution.transform);
1073 ec->base_output_resolution.transform = NULL;
1074 E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
1076 if (ec->transform_core.transform_list)
1078 E_Util_Transform *transform;
1080 EINA_LIST_FREE(ec->transform_core.transform_list, transform)
1082 e_util_transform_unref(transform);
1086 ec->transform_core.result.enable = EINA_FALSE;
1088 _e_client_resize_object_del(ec);
1090 e_comp_visibility_calculation_set(EINA_TRUE);
1092 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
1095 ///////////////////////////////////////////
1098 _e_client_cb_kill_timer(void *data)
1100 E_Client *ec = data;
1102 // dont wait until it's hung -
1105 if (ec->netwm.pid > 1)
1106 kill(ec->netwm.pid, SIGKILL);
1108 ec->kill_timer = NULL;
1109 return ECORE_CALLBACK_CANCEL;
1113 _e_client_cb_ping_poller(void *data)
1118 if (e_object_is_del(E_OBJECT(ec)))
1120 ec->ping_poller = NULL;
1121 return ECORE_CALLBACK_CANCEL;
1129 evas_object_smart_callback_call(ec->frame, "unhung", NULL);
1130 E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
1135 /* if time between last ping and now is greater
1136 * than half the ping interval... */
1137 if ((ecore_loop_time_get() - ec->ping) >
1138 ((e_config->ping_clients_interval *
1139 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
1144 evas_object_smart_callback_call(ec->frame, "hung", NULL);
1145 /* FIXME: if below dialog is up - hide it now */
1147 if (ec->delete_requested)
1149 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
1150 e_client_act_kill_begin(ec);
1154 ec->ping_poller = NULL;
1156 return ECORE_CALLBACK_CANCEL;
1159 ///////////////////////////////////////////
1162 _e_client_action_input_win_new(void)
1166 CRI("DOUBLE COMP GRAB! ACK!!!!");
1169 comp_grabbed = e_comp_grab_input(1, 1);
1170 if (!comp_grabbed) _e_client_action_input_win_del();
1171 return comp_grabbed;
1175 _e_client_action_init(E_Client *ec)
1177 action_orig.x = ec->x;
1178 action_orig.y = ec->y;
1179 action_orig.w = ec->w;
1180 action_orig.h = ec->h;
1184 action_client->keyboard_resizing = 0;
1190 _e_client_move_begin(E_Client *ec)
1192 if ((ec->fullscreen) || (ec->lock_user_location))
1195 if (!_e_client_action_input_win_new()) return 0;
1199 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
1200 _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
1203 if (ecmove == ec) ecmove = NULL;
1204 _e_client_action_input_win_del();
1207 if (!ec->lock_user_stacking)
1209 if (e_config->border_raise_on_mouse_action)
1214 e_comp_client_override_add(ec);
1220 _e_client_move_end(E_Client *ec)
1223 _e_client_action_input_win_del();
1225 wl_signal_emit_mutable(&PRI(ec)->events.move_end, NULL);
1226 _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
1228 if (ec->transformed)
1229 _e_client_transform_move_end(ec);
1232 e_comp_client_override_del(ec);
1239 _e_client_action_move_timeout(void *data EINA_UNUSED)
1241 _e_client_move_end(action_client);
1242 _e_client_action_finish();
1243 return ECORE_CALLBACK_CANCEL;
1247 _e_client_action_move_timeout_add(void)
1249 E_FREE_FUNC(action_timer, ecore_timer_del);
1250 if (e_config->border_keyboard.timeout)
1251 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
1255 _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1257 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1260 ERR("no action_client!");
1262 if (action_client) _e_client_move_end(action_client);
1263 _e_client_action_finish();
1264 return ECORE_CALLBACK_DONE;
1268 _e_client_moveinfo_gather(E_Client *ec, const char *source)
1270 if (e_util_glob_match(source, "mouse,*,1"))
1271 ec->moveinfo.down.button = 1;
1272 else if (e_util_glob_match(source, "mouse,*,2"))
1273 ec->moveinfo.down.button = 2;
1274 else if (e_util_glob_match(source, "mouse,*,3"))
1275 ec->moveinfo.down.button = 3;
1277 ec->moveinfo.down.button = 0;
1278 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1280 ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
1281 ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
1285 ec->moveinfo.down.mx = ec->mouse.current.mx;
1286 ec->moveinfo.down.my = ec->mouse.current.my;
1291 _e_client_move_handle(E_Client *ec)
1295 if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
1297 x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
1298 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1299 y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
1300 (ec->mouse.current.my - ec->moveinfo.down.my);
1304 x = ec->moveinfo.down.x +
1305 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1306 y = ec->moveinfo.down.y +
1307 (ec->mouse.current.my - ec->moveinfo.down.my);
1310 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1311 _e_client_stay_within_canvas(ec, x, y, &x, &y);
1314 _e_client_stay_within_canvas_margin(ec, x, y, &x, &y);
1316 evas_object_move(ec->frame, x, y);
1318 if (e_client_transform_core_enable_get(ec))
1320 e_client_transform_core_update(ec);
1324 static Evas_Object *
1325 _e_client_resize_object_rectangle_get(E_Client *ec)
1327 Evas_Object *resize_obj = NULL;
1329 resize_obj = evas_object_rectangle_add(evas_object_evas_get(ec->frame));
1330 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1332 if (e_config->resize_object.customize)
1334 evas_object_color_set(resize_obj,
1335 e_config->resize_object.r,
1336 e_config->resize_object.g,
1337 e_config->resize_object.b,
1338 e_config->resize_object.a);
1341 evas_object_color_set(resize_obj, 128, 128, 128, 100);
1346 static Evas_Object *
1347 _e_client_resize_object_image_get(E_Client *ec)
1350 Evas_Object *resize_obj = NULL;
1352 if (!e_config->resize_object.image_path)
1354 ELOGF("COMP", "NO resize_object image! Make default resize_object", ec);
1358 resize_obj = evas_object_image_add(evas_object_evas_get(ec->frame));
1359 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1361 evas_object_image_file_set(resize_obj, e_config->resize_object.image_path, NULL);
1362 err = evas_object_image_load_error_get(resize_obj);
1363 if (err != EVAS_LOAD_ERROR_NONE)
1365 ELOGF("COMP", "Image load error. path:%s, errno:%d. Make default resize_object",
1366 ec, e_config->resize_object.image_path, err);
1367 evas_object_del(resize_obj);
1372 evas_object_image_fill_set(resize_obj, 0, 0, ec->w, ec->h);
1373 evas_object_image_filled_set(resize_obj, EINA_TRUE);
1375 evas_object_image_border_set(resize_obj,
1376 e_config->resize_object.border_width.l,
1377 e_config->resize_object.border_width.r,
1378 e_config->resize_object.border_width.t,
1379 e_config->resize_object.border_width.b);
1384 return _e_client_resize_object_rectangle_get(ec);
1387 static Evas_Object *
1388 _e_client_resize_object_create(E_Client *ec)
1390 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, NULL);
1392 Evas_Object *resize_obj = NULL;
1394 if (_e_client_resize_object_create_cb)
1395 resize_obj = _e_client_resize_object_create_cb(ec);
1398 if (e_config->resize_object.type == 1) // image object
1400 resize_obj = _e_client_resize_object_image_get(ec);
1404 resize_obj = _e_client_resize_object_rectangle_get(ec);
1407 EINA_SAFETY_ON_NULL_RETURN_VAL(resize_obj, NULL);
1409 evas_object_pass_events_set(resize_obj, EINA_TRUE);
1410 evas_object_layer_set(resize_obj, evas_object_layer_get(ec->frame));
1411 evas_object_stack_above(resize_obj, ec->frame);
1412 evas_object_name_set(resize_obj, "resize_object");
1418 _e_client_resize_object_del(E_Client *ec)
1420 if (ec == NULL) return;
1421 if (ec->manage_resize.resize_obj == NULL) return;
1423 evas_object_hide(ec->manage_resize.resize_obj);
1424 evas_object_del(ec->manage_resize.resize_obj);
1425 ec->manage_resize.resize_obj = NULL;
1429 _e_client_resize_handle(E_Client *ec)
1432 int new_x, new_y, new_w, new_h;
1434 int trans_x = 0, trans_y = 0;
1435 int trans_w = 0, trans_h = 0;
1437 if (ec->transformed)
1439 _e_client_transform_resize_handle(ec);
1448 if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
1449 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1450 (ec->resize_mode == E_POINTER_RESIZE_BR))
1452 if ((ec->moveinfo.down.button >= 1) &&
1453 (ec->moveinfo.down.button <= 3))
1454 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
1455 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1457 w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
1459 else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1460 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1461 (ec->resize_mode == E_POINTER_RESIZE_BL))
1463 if ((ec->moveinfo.down.button >= 1) &&
1464 (ec->moveinfo.down.button <= 3))
1465 w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
1466 (ec->mouse.current.mx - ec->moveinfo.down.mx);
1468 w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
1471 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1472 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1473 (ec->resize_mode == E_POINTER_RESIZE_TR))
1475 if ((ec->moveinfo.down.button >= 1) &&
1476 (ec->moveinfo.down.button <= 3))
1477 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
1478 (ec->mouse.current.my - ec->moveinfo.down.my);
1480 h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
1482 else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
1483 (ec->resize_mode == E_POINTER_RESIZE_B) ||
1484 (ec->resize_mode == E_POINTER_RESIZE_BR))
1486 if ((ec->moveinfo.down.button >= 1) &&
1487 (ec->moveinfo.down.button <= 3))
1488 h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
1489 (ec->mouse.current.my - ec->moveinfo.down.my);
1491 h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
1496 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1497 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1498 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1499 (ec->resize_mode == E_POINTER_RESIZE_BL))
1501 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1502 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1503 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1504 (ec->resize_mode == E_POINTER_RESIZE_TR))
1511 if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
1514 zone = e_comp_zone_find_by_ec(ec);
1517 w = MIN(w, zone->w);
1518 h = MIN(h, zone->h);
1521 e_client_resize_limit(ec, &new_w, &new_h);
1523 if (ec->manage_resize.enable_aspect_ratio)
1525 if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
1526 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1527 (ec->resize_mode == E_POINTER_RESIZE_BL) ||
1528 (ec->resize_mode == E_POINTER_RESIZE_TR) ||
1529 (ec->resize_mode == E_POINTER_RESIZE_R) ||
1530 (ec->resize_mode == E_POINTER_RESIZE_BR))
1532 new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w;
1534 else if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1535 (ec->resize_mode == E_POINTER_RESIZE_B))
1537 new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h;
1539 new_h += ec->manage_resize.header_h;
1540 new_h += ec->manage_resize.footer_h;
1543 if ((ec->resize_mode == E_POINTER_RESIZE_T) ||
1544 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1545 (ec->resize_mode == E_POINTER_RESIZE_L) ||
1546 (ec->resize_mode == E_POINTER_RESIZE_BL))
1547 new_x += (w - new_w);
1548 if ((ec->resize_mode == E_POINTER_RESIZE_L) ||
1549 (ec->resize_mode == E_POINTER_RESIZE_TL) ||
1550 (ec->resize_mode == E_POINTER_RESIZE_T) ||
1551 (ec->resize_mode == E_POINTER_RESIZE_TR))
1552 new_y += (h - new_h);
1554 if (e_config->interactive_resize)
1556 evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
1560 if (ec->manage_resize.resize_obj == NULL)
1562 ec->manage_resize.resize_obj = _e_client_resize_object_create(ec);
1563 EINA_SAFETY_ON_NULL_RETURN(ec->manage_resize.resize_obj);
1566 if (e_client_transform_core_enable_get(ec))
1568 e_client_transform_core_input_inv_transform(ec, new_x, new_y, &trans_x, &trans_y);
1569 e_client_transform_core_input_inv_transform(ec, new_w, new_h, &trans_w, &trans_h);
1570 evas_object_geometry_set(ec->manage_resize.resize_obj, trans_x, trans_y, trans_w, trans_h);
1573 evas_object_geometry_set(ec->manage_resize.resize_obj, new_x, new_y, new_w, new_h);
1574 evas_object_show(ec->manage_resize.resize_obj);
1576 ec->manage_resize.x = new_x;
1577 ec->manage_resize.y = new_y;
1578 ec->manage_resize.w = new_w;
1579 ec->manage_resize.h = new_h;
1584 _e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
1586 if (ppu <= 1) return size;
1588 unsigned int remainder = size % ppu;
1589 if (remainder == 0) return size;
1591 int gap = size - start_size;
1592 int new_size = size;
1594 new_size = size + (ppu - remainder);
1596 new_size = size - remainder;
1602 _e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
1606 if (prev_pos == pos)
1609 new_pos = (prev_pos + prev_size) - size;
1615 _e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
1617 if (ec->manage_resize.unit_size <= 1) return;
1619 ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
1620 ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
1622 ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
1623 ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
1627 _e_client_resize_end(E_Client *ec)
1629 ec->resize_mode = E_POINTER_RESIZE_NONE;
1630 _e_client_action_input_win_del();
1632 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_end, NULL);
1633 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
1635 if (ec->transformed)
1636 _e_client_transform_resize_end(ec);
1639 e_comp_client_override_del(ec);
1643 if (!e_config->interactive_resize)
1645 if (ec->manage_resize.resize_obj)
1647 if (ec->manage_resize.unit_size > 1)
1648 _e_client_adjust_geometry_by_resize_ppu(ec);
1650 e_client_frame_geometry_set(ec,
1651 ec->manage_resize.x,
1652 ec->manage_resize.y,
1653 ec->manage_resize.w,
1654 ec->manage_resize.h);
1655 _e_client_resize_object_del(ec);
1663 _e_client_action_resize_timeout(void *data EINA_UNUSED)
1665 _e_client_resize_end(action_client);
1666 _e_client_action_finish();
1667 return ECORE_CALLBACK_CANCEL;
1671 _e_client_action_resize_timeout_add(void)
1673 E_FREE_FUNC(action_timer, ecore_timer_del);
1674 if (e_config->border_keyboard.timeout)
1675 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
1679 _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1681 if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
1684 ERR("no action_client!");
1686 if (action_client) _e_client_resize_end(action_client);
1687 _e_client_action_finish();
1688 return ECORE_CALLBACK_DONE;
1691 ////////////////////////////////////////////////
1694 _e_client_position_inside_input_rect(E_Client *ec, int tx, int ty)
1697 Eina_Bool res = EINA_FALSE;
1698 Eina_List *list = NULL, *l;
1699 Eina_Rectangle *data;
1701 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
1703 e_client_geometry_get(ec, &x, &y, &w, &h);
1704 e_comp_object_input_rect_get(ec->frame, &list);
1707 EINA_LIST_FOREACH(list, l, data)
1709 if ((tx >= x + data->x) && (tx <= x + data->x + data->w) &&
1710 (ty >= y + data->y) && (ty <= y + data->y + data->h))
1716 list = eina_list_free(list);
1720 if ((tx >= x) && (tx <= x + w) &&
1721 (ty >= y) && (ty <= y + h))
1731 _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *client)
1733 /* If a border was specified which should be excluded from the list
1734 * (because it will be closed shortly for example), skip */
1735 if (e_client_util_ignored_get(client) || (!e_desk_has_ec(desk, client))) return EINA_TRUE;
1736 if (!evas_object_visible_get(client->frame)) return EINA_TRUE;
1737 if (e_policy_client_is_cursor(client)) return EINA_TRUE;
1738 if (e_comp_wl->drag_client == client) return EINA_TRUE;
1744 _e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
1746 E_Client *ec = NULL, *cec;
1748 E_CLIENT_REVERSE_FOREACH(cec)
1750 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1751 if ((exclude) && (cec == exclude)) continue;
1752 if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1754 /* If the layer is higher, the position of the window is higher
1755 * (always on top vs always below) */
1756 if (!ec || (cec->layer > ec->layer))
1763 _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
1765 E_Client *ec = NULL, *cec;
1767 E_CLIENT_REVERSE_FOREACH(cec)
1769 if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
1771 Eina_List *list = NULL;
1772 Eina_Rectangle *rect;
1773 Eina_Bool inside = EINA_FALSE;
1774 e_comp_object_input_rect_get(cec->frame, &list);
1777 EINA_LIST_FREE(list, rect)
1779 if (E_INSIDE(x, y, rect->x, rect->y, rect->w, rect->h))
1783 else if (E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
1788 if (!inside) continue;
1789 /* If the layer is higher, the position of the window is higher
1790 * (always on top vs always below) */
1791 if (!ec || (cec->layer > ec->layer))
1798 ////////////////////////////////////////////////
1801 _e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
1804 E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
1807 zone = e_comp_zone_find_by_ec(ec);
1814 if (eina_list_count(e_comp->zones) == 1)
1823 zone_left = e_comp_zone_xy_get((x - w + 5), y);
1824 zone_right = e_comp_zone_xy_get((x + w + 5), y);
1825 zone_above = e_comp_zone_xy_get(x, (y - h + 5));
1826 zone_below = e_comp_zone_xy_get(x, (y + h + 5));
1828 if (!(zone_above) && (y))
1829 zone_above = e_comp_zone_xy_get(x, (h - 5));
1831 if (!(zone_left) && (x))
1832 zone_left = e_comp_zone_xy_get((x - 5), y);
1835 w = zone_right->x + zone_right->w;
1838 w = zone->x + zone->w;
1841 h = zone_below->y + zone_below->h;
1844 h = zone->y + zone->h;
1846 if ((zone_left) && (zone_right))
1847 w = zone->w + zone_right->x;
1849 if ((zone_above) && (zone_below))
1850 h = zone->h + zone_below->y;
1852 if (x) x -= zone->w;
1853 if (y) y -= zone->h;
1855 if (zx) *zx = x > 0 ? x : 0;
1856 if (zy) *zy = y > 0 ? y : 0;
1862 _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
1864 int new_x_max, new_y_max;
1869 zone = e_comp_zone_find_by_ec(ec);
1872 if (new_x) *new_x = x;
1873 if (new_y) *new_y = y;
1877 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1879 new_x_max = zw - ec->w;
1880 new_y_max = zh - ec->h;
1881 lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
1882 lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
1916 _e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
1918 int new_x_max, new_y_max, new_x_min, new_y_min;
1919 int margin_w, margin_h;
1924 zone = e_comp_zone_find_by_ec(ec);
1927 if (new_x) *new_x = x;
1928 if (new_y) *new_y = y;
1935 _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
1940 new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
1941 new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
1942 new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
1943 new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
1947 else if (x <= new_x_min)
1952 else if (y <= new_y_min)
1957 ////////////////////////////////////////////////
1960 _e_client_transform_core_activate_set(E_Client *ec, Eina_Bool set)
1962 if (ec->transform_core.activate == set) return;
1964 ec->transform_core.activate = set;
1968 if (ec->transform_core.result.enable)
1969 e_client_map_enable_set(ec, EINA_TRUE);
1973 e_client_map_enable_set(ec, EINA_FALSE);
1978 _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1980 E_Client *ec = data;
1982 if (stopping) return; //ignore all of this if we're shutting down!
1983 if (e_object_is_del(data)) return; //client is about to die
1984 if (ec->cur_mouse_action)
1986 if (ec->cur_mouse_action->func.end_mouse)
1987 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
1988 else if (ec->cur_mouse_action->func.end)
1989 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
1990 E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
1992 if (action_client == ec) _e_client_action_finish();
1994 ec->want_focus = ec->take_focus = 0;
1996 _e_client_transform_core_activate_set(ec, EINA_FALSE);
1998 if (ec->new_client) return;
1999 _e_client_event_hide(ec);
2005 _e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2007 E_Client *ec = data;
2011 if (e_object_is_del(data)) return;
2013 ec->pre_res_change.valid = 0;
2015 _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
2017 evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL);
2018 if ((e_config->transient.move) && (ec->transients))
2020 Eina_List *list = eina_list_clone(ec->transients);
2023 EINA_LIST_FREE(list, child)
2025 if (child->vkbd.vkbd) continue;
2027 evas_object_move(child->frame,
2028 child->x + x - ec->pre_cb.x,
2029 child->y + y - ec->pre_cb.y);
2032 if (ec->moving || (ecmove == ec))
2034 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2035 _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
2038 if ((!ec->moving) && (ec->transformed))
2040 map = e_client_map_get(ec);
2041 _e_client_transform_geometry_save(ec, map);
2045 ec->pre_cb.x = x; ec->pre_cb.y = y;
2047 wl_signal_emit_mutable(&PRI(ec)->events.move, NULL);
2049 e_comp_visibility_calculation_set(EINA_TRUE);
2053 _e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2055 E_Client *ec = data;
2056 Evas_Coord x, y, w, h;
2058 if (e_object_is_del(data)) return;
2060 ec->pre_res_change.valid = 0;
2062 _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
2064 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
2065 if ((e_config->transient.resize) && (ec->transients))
2067 Eina_List *list = eina_list_clone(ec->transients);
2070 EINA_LIST_FREE(list, child)
2072 Evas_Coord nx, ny, nw, nh;
2074 if ((ec->pre_cb.w > 0) && (ec->pre_cb.h > 0))
2076 nx = x + (((child->x - x) * w) / ec->pre_cb.w);
2077 ny = y + (((child->y - y) * h) / ec->pre_cb.h);
2078 nw = (child->w * w) / ec->pre_cb.w;
2079 nh = (child->h * h) / ec->pre_cb.h;
2080 nx += ((nw - child->w) / 2);
2081 ny += ((nh - child->h) / 2);
2082 evas_object_move(child->frame, nx, ny);
2087 if (e_client_util_resizing_get(ec) || (ecresize == ec))
2089 wl_signal_emit_mutable(&PRI(ec)->events.move_resize_update, NULL);
2090 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
2092 ec->pre_cb.w = w; ec->pre_cb.h = h;
2094 e_client_transform_core_update(ec);
2095 e_comp_visibility_calculation_set(EINA_TRUE);
2099 _e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2101 E_Client *ec = data;
2103 if (e_object_is_del(data)) return;
2105 _e_client_transform_core_activate_set(ec, EINA_TRUE);
2107 _e_client_event_show(ec);
2112 _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2114 E_Client *ec = data;
2115 E_Comp_Wl_Client_Data *child_cdata = NULL;
2117 if (e_object_is_del(data)) return;
2118 if (ec->layer_block) return;
2119 if (ec->layer_pending) return;
2120 if (e_config->transient.raise && ec->transients)
2122 Eina_List *list = eina_list_clone(ec->transients);
2123 E_Client *child, *below = NULL, *above = NULL;
2124 E_Transient transient_policy;
2126 E_LIST_REVERSE_FREE(list, child)
2128 child_cdata = e_client_cdata_get(child);
2129 if (child_cdata && !child_cdata->mapped)
2131 ELOGF("COMP", "STACK CHANGE CHILD. BUT not mapped. skip. child(ec:%p, win:0x%08zx)", ec, child, e_client_util_win_get(child));
2135 /* Don't stack iconic transients. If the user wants these shown,
2136 * that's another option.
2138 if (child->iconic && e_client_is_iconified_by_client(child)) continue;
2140 transient_policy = e_client_transient_policy_get(child);
2141 if (transient_policy == E_TRANSIENT_ABOVE)
2144 e_client_stack_below(child, below);
2146 e_client_stack_above(child, ec);
2149 else if (transient_policy == E_TRANSIENT_BELOW)
2152 e_client_stack_below(child, above);
2154 e_client_stack_below(child, ec);
2160 _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
2162 e_comp_visibility_calculation_set(EINA_TRUE);
2165 ////////////////////////////////////////////////
2167 _e_client_aux_hint_eval(E_Client *ec)
2171 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2173 E_Comp_Wl_Aux_Hint *hint;
2175 if (cdata && cdata->aux_hint.changed)
2177 wl_signal_emit_mutable(&PRI(ec)->events.aux_hint_change, NULL);
2178 _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
2180 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
2182 hint->changed = EINA_FALSE;
2185 ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec, hint->id, hint->hint, hint->val);
2186 if (hint->hint) eina_stringshare_del(hint->hint);
2187 if (hint->val) eina_stringshare_del(hint->val);
2188 cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
2192 cdata->aux_hint.changed = 0;
2197 _e_client_eval(E_Client *ec)
2200 unsigned int prop = 0;
2203 if (e_object_is_del(E_OBJECT(ec)))
2205 CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
2210 TRACE_DS_BEGIN(CLIENT:EVAL);
2212 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_new_client, NULL);
2213 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec))
2219 if ((ec->new_client) && (!e_client_util_ignored_get(ec)))
2221 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_new_client, NULL);
2222 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec))
2229 if (ec->changes.size)
2231 ec->changes.size = 0;
2232 evas_object_resize(ec->frame, ec->w, ec->h);
2234 prop |= E_CLIENT_PROPERTY_SIZE;
2236 if (ec->changes.pos)
2238 ec->changes.tz_position = 0;
2239 ec->changes.pos = 0;
2240 evas_object_move(ec->frame, ec->x, ec->y);
2241 prop |= E_CLIENT_PROPERTY_POS;
2244 if (ec->changes.reset_gravity)
2246 ec->changes.reset_gravity = 0;
2247 prop |= E_CLIENT_PROPERTY_GRAVITY;
2250 if (ec->changes.title)
2252 ec->changes.title = 0;
2253 prop |= E_CLIENT_PROPERTY_TITLE;
2256 if ((ec->changes.visible) && (ec->visible) && (ec->new_client) && (!ec->iconic))
2260 e_input_device_pointer_xy_get(NULL, &x, &y);
2261 if ((!ec->placed) && (!ec->re_manage) &&
2262 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
2263 (!((ec->icccm.transient_for != 0) ||
2265 (!ecmove) && (!ecresize))
2267 /* Set this window into moving state */
2269 ec->cur_mouse_action = e_action_find("window_move");
2270 if (ec->cur_mouse_action)
2272 if ((!ec->cur_mouse_action->func.end_mouse) &&
2273 (!ec->cur_mouse_action->func.end))
2274 ec->cur_mouse_action = NULL;
2275 if (ec->cur_mouse_action)
2278 tx = x - (ec->w >> 1);
2279 e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
2281 e_client_pos_set(ec, tx, ty);
2283 ec->changes.pos = 1;
2288 evas_object_show(ec->frame);
2289 if (evas_object_visible_get(ec->frame))
2291 ec->changes.visible = 0;
2292 _e_client_event_show(ec);
2295 else if ((ec->changes.visible) && (ec->new_client))
2297 ec->changes.visible = 0;
2299 _e_client_event_hide(ec);
2302 if (ec->changes.icon)
2304 ec->changes.icon = 0;
2308 e_comp->new_clients--;
2310 ec->changed = ec->changes.pos || ec->changes.size ||
2311 ec->changes.stack || ec->changes.prop || ec->changes.border ||
2312 ec->changes.reset_gravity ||
2313 ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
2314 ec->changes.internal_state ||
2315 ec->changes.need_maximize || ec->changes.need_unmaximize;
2316 ec->changes.stack = 0;
2318 if (ec->changes.need_maximize)
2320 E_Maximize max = ec->maximized;
2321 ec->maximized = E_MAXIMIZE_NONE;
2322 e_client_maximize(ec, max);
2323 ec->changes.need_maximize = 0;
2325 else if (ec->changes.need_unmaximize)
2327 e_client_unmaximize(ec, ec->maximized);
2328 ec->changes.need_unmaximize = 0;
2331 if (ec->need_fullscreen)
2333 e_client_fullscreen(ec, e_config->fullscreen_policy);
2334 ec->need_fullscreen = 0;
2337 if (ec->changes.accepts_focus)
2339 if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus))
2342 ec->changes.accepts_focus = 0;
2346 if (send_event && prop)
2348 _e_client_event_property(ec, prop);
2351 _e_client_aux_hint_eval(ec);
2353 e_client_transform_core_update(ec);
2355 wl_signal_emit_mutable(&PRI(ec)->events.eval_end, NULL);
2356 _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
2362 e_client_frame_update(E_Client *ec)
2364 const char *bordername;
2366 EINA_SAFETY_ON_NULL_RETURN(ec);
2367 if (e_object_is_del(E_OBJECT(ec))) return;
2369 ec->border.changed = 0;
2370 if (!e_comp_object_frame_allowed(ec->frame)) return;
2371 if (ec->fullscreen || ec->borderless)
2372 bordername = "borderless";
2373 else if (ec->bordername)
2374 bordername = ec->bordername;
2375 else if (((ec->icccm.transient_for != 0) || (ec->dialog)) &&
2376 (ec->icccm.min_w == ec->icccm.max_w) &&
2377 (ec->icccm.min_h == ec->icccm.max_h))
2378 bordername = "noresize_dialog";
2379 else if ((ec->icccm.min_w == ec->icccm.max_w) &&
2380 (ec->icccm.min_h == ec->icccm.max_h))
2381 bordername = "noresize";
2382 else if (ec->shaped)
2383 bordername = "shaped";
2384 else if ((ec->netwm.state.skip_taskbar) ||
2385 (ec->netwm.state.skip_pager))
2386 bordername = "skipped";
2388 else if ((ec->internal) && (ec->icccm.class) &&
2389 (!strncmp(ec->icccm.class, "e_fwin", 6)))
2390 bordername = "internal_fileman";
2393 bordername = e_config->theme_default_border_style;
2394 if (!bordername) bordername = "default";
2396 e_client_border_set(ec, bordername);
2400 _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
2402 if (!ec || !m) return EINA_FALSE;
2403 if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
2405 if ((int)ec->netwm.type != m->window_type)
2408 #if defined(__cplusplus) || defined(c_plusplus)
2411 if (!ec->icccm.cpp_class)
2414 if (!e_util_glob_match(ec->icccm.cpp_class, m->clas))
2420 if (!ec->icccm.class)
2423 if (!e_util_glob_match(ec->icccm.class, m->clas))
2430 if (ec->icccm.name && e_util_glob_match(ec->icccm.name, m->name))
2433 if (ec->icccm.title && e_util_glob_match(ec->icccm.title, m->name))
2436 if (ec->netwm.name && e_util_glob_match(ec->netwm.name, m->name))
2444 e_client_type_update(E_Client *ec)
2446 E_Config_Client_Type *m;
2450 if (!e_config->client_types) return 0;
2452 EINA_LIST_FOREACH(e_config->client_types, l, m)
2454 if (!_e_client_type_match(ec, m)) continue;
2457 type = m->client_type;
2462 if (ec->client_type != type)
2464 ec->client_type = type;
2465 _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
2468 return ec->client_type;
2472 _e_client_transform_sub_apply(E_Client *ec, E_Client *epc, double zoom)
2474 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2478 int ox = 0, oy = 0, ow, oh;
2482 EINA_SAFETY_ON_FALSE_RETURN(e_comp_wl_subsurface_check(ec));
2484 e_comp_wl_subsurface_position_get(ec, &ox, &oy);
2485 ow = cdata->width_from_viewport;
2486 oh = cdata->height_from_viewport;
2488 map = e_client_map_get(epc);
2489 e_map_point_coord_get(map, 0, &px, &py, 0);
2492 mx = ox * zoom + px;
2493 my = oy * zoom + py;
2497 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
2498 e_map_util_points_populate_from_geometry(map, mx, my, mw, mh, 0);
2499 e_map_util_object_move_sync_set(map, EINA_TRUE);
2500 e_client_map_set(ec, map);
2501 e_client_map_enable_set(ec, EINA_TRUE);
2503 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2504 _e_client_transform_sub_apply(subc, ec, zoom);
2505 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
2506 _e_client_transform_sub_apply(subc, ec, zoom);
2512 _e_client_transient_for_group_make(E_Client *ec, Eina_List **list)
2518 if (!e_config->transient.raise) return;
2520 EINA_LIST_FOREACH(ec->transients, l, child)
2522 if (!child) continue;
2523 if (child->iconic) continue;
2524 if (e_client_transient_policy_get(child) == E_TRANSIENT_ABOVE)
2526 *list = eina_list_prepend(*list, child);
2527 _e_client_transient_for_group_make(child, list);
2533 e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus)
2535 E_Client *top_ec = NULL;
2536 Eina_List *transient_list = NULL;
2538 _e_client_transient_for_group_make(ec, &transient_list);
2542 Eina_List *l = NULL;
2543 E_Client *temp_ec = NULL;
2544 E_Client *temp_ec2 = NULL;
2546 E_CLIENT_REVERSE_FOREACH(temp_ec)
2555 EINA_LIST_FOREACH(transient_list, l, temp_ec2)
2557 if (temp_ec == temp_ec2)
2561 if ((temp_ec2->icccm.accepts_focus) ||
2562 (temp_ec2->icccm.take_focus))
2575 eina_list_free(transient_list);
2580 #ifdef EC_IS_NOT_VISIBLE
2581 # undef EC_IS_NOT_VISIBLE
2583 #define EC_IS_NOT_VISIBLE if (ec->visibility.obscured != E_VISIBILITY_UNOBSCURED)
2586 e_client_visibility_touched_check(E_Client *ec)
2590 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
2592 tx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x);
2593 ty = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y);
2595 return _e_client_position_inside_input_rect(ec, tx, ty);
2599 e_client_visibility_change_notify(E_Client *ec)
2601 EINA_SAFETY_ON_NULL_RETURN(ec);
2603 if (ec->visibility.changed)
2604 _e_client_event_simple(ec, E_EVENT_CLIENT_VISIBILITY_CHANGE);
2606 wl_signal_emit_mutable(&PRI(ec)->events.eval_visibility, NULL);
2607 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY, ec);
2611 e_client_visibility_end_notify(void)
2613 // FIXME: This hook means that the visiblitiy calculation of a zone is done
2614 // at this idle handler.This is a hook for a zone, not for a client.
2615 // Therefore, this hook may be defined as a zone hook,
2616 // ex) E_ZONE_HOOK_EVAL_VISIBILITY_END or E_ZONE_HOOK_EVAL_VISIBILITY_DONE.
2617 _e_client_hook_call(E_CLIENT_HOOK_EVAL_VISIBILITY_END, NULL);
2621 _e_client_transform_core_check_change(E_Client *ec)
2625 Eina_Bool check = EINA_FALSE;
2626 if (!ec) return EINA_FALSE;
2629 evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
2631 // check client position or size change
2632 if (ec->x != ec->transform_core.backup.client_x ||
2633 ec->y != ec->transform_core.backup.client_y ||
2634 ec->w != ec->transform_core.backup.client_w ||
2635 ec->h != ec->transform_core.backup.client_h ||
2636 w != ec->transform_core.backup.frame_w ||
2637 h != ec->transform_core.backup.frame_h ||
2638 ec->argb != ec->transform_core.backup.argb)
2641 ec->transform_core.backup.client_x = ec->x;
2642 ec->transform_core.backup.client_y = ec->y;
2643 ec->transform_core.backup.client_w = ec->w;
2644 ec->transform_core.backup.client_h = ec->h;
2645 ec->transform_core.backup.frame_w = w;
2646 ec->transform_core.backup.frame_h = h;
2647 ec->transform_core.backup.argb = ec->argb;
2650 // check new transform or del transform
2651 if (ec->transform_core.changed)
2654 ec->transform_core.changed = EINA_FALSE;
2657 // check each transform change
2658 if (ec->transform_core.transform_list)
2662 E_Util_Transform *transform;
2664 EINA_LIST_FOREACH_SAFE(ec->transform_core.transform_list, l, l_next, transform)
2666 // del transform check
2667 if (e_util_transform_ref_count_get(transform) <= 1)
2669 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
2670 e_util_transform_unref(transform);
2675 // transform change test
2676 if (e_util_transform_change_get(transform))
2679 e_util_transform_change_unset(transform);
2684 if (e_comp_wl_subsurface_check(ec))
2686 // check parent matrix change
2687 E_Client *parent = e_comp_wl_subsurface_parent_get(ec);
2688 if (parent && parent->transform_core.result.enable)
2690 ec->transform_core.parent.enable = EINA_TRUE;
2692 if (!e_util_transform_matrix_equal_check(&ec->transform_core.parent.matrix,
2693 &parent->transform_core.result.matrix))
2696 ec->transform_core.parent.matrix = parent->transform_core.result.matrix;
2698 if (memcmp(&ec->transform_core.parent.zoom, &parent->transform_core.result.transform.zoom, sizeof(E_Util_Transform_Zoom)) != 0)
2701 ec->transform_core.parent.zoom = parent->transform_core.result.transform.zoom;
2704 else if (ec->transform_core.parent.enable)
2706 ec->transform_core.parent.enable = EINA_FALSE;
2707 e_util_transform_matrix_load_identity(&ec->transform_core.parent.matrix);
2708 ec->transform_core.parent.zoom.zoom_x = 1.0;
2709 ec->transform_core.parent.zoom.zoom_y = 1.0;
2710 ec->transform_core.parent.zoom.cx = 0;
2711 ec->transform_core.parent.zoom.cy = 0;
2720 _e_client_transform_core_boundary_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2722 int minx = 99999, miny = 99999;
2723 int maxx = -99999, maxy = -99999;
2728 if (!ec->frame) return;
2729 if (!ec->transform_core.result.enable) return;
2730 if (!vertices) return;
2732 for (i = 0; i < 4; ++i)
2737 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2739 if (x < minx) minx = x;
2740 if (y < miny) miny = y;
2741 if (x > maxx) maxx = x;
2742 if (y > maxy) maxy = y;
2745 ec->transform_core.result.boundary.x = minx;
2746 ec->transform_core.result.boundary.y = miny;
2747 ec->transform_core.result.boundary.w = maxx - minx;
2748 ec->transform_core.result.boundary.h = maxy - miny;
2750 ELOGF("COMP", "[Transform][boundary][%d %d %d %d]",
2752 ec->transform_core.result.boundary.x,
2753 ec->transform_core.result.boundary.y,
2754 ec->transform_core.result.boundary.w,
2755 ec->transform_core.result.boundary.h);
2759 _e_client_transform_core_map_new(Evas_Object *obj,
2760 E_Util_Transform_Rect_Vertex *vertices,
2761 E_Util_Transform *transform,
2762 Eina_Bool direct_render)
2769 map = e_map_new_with_direct_render(direct_render);
2770 EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL);
2772 e_map_util_points_populate_from_object_full(map, obj, 0);
2773 e_map_util_points_color_set(map, 255, 255, 255, 255);
2775 for (i = 0 ; i < 4 ; ++i)
2780 e_util_transform_vertices_pos_round_get(vertices, i, &x, &y, 0, 0);
2781 e_map_point_coord_set(map, i, x, y, 1.0);
2783 if (transform && e_util_transform_texcoord_flag_get(transform))
2788 e_util_transform_texcoord_get(transform, i, &u, &v);
2789 e_map_point_image_uv_set(map, i, u, v);
2797 _e_client_transform_core_vertices_apply_with_zoom(E_Client *ec,
2799 E_Util_Transform_Rect_Vertex *vertices,
2800 E_Util_Transform *transform,
2801 E_Util_Transform_Zoom zoom)
2809 map = _e_client_transform_core_map_new(obj, vertices, transform,
2810 ec->transform_core.direct_render);
2811 EINA_SAFETY_ON_NULL_RETURN(map);
2813 e_map_util_zoom(map, zoom.zoom_x, zoom.zoom_y, zoom.cx, zoom.cy);
2815 e_comp_object_map_set(obj, map);
2817 if (ec->transform_core.activate)
2818 e_comp_object_map_enable_set(obj, EINA_TRUE);
2820 e_comp_object_map_enable_set(obj, EINA_FALSE);
2825 evas_object_map_enable_set(obj, EINA_FALSE);
2829 _e_client_transform_core_vertices_apply(E_Client *ec,
2831 E_Util_Transform_Rect_Vertex *vertices,
2832 E_Util_Transform *transform)
2840 map = _e_client_transform_core_map_new(obj, vertices, transform,
2841 ec->transform_core.direct_render);
2842 EINA_SAFETY_ON_NULL_RETURN(map);
2844 e_comp_object_map_set(obj, map);
2846 if (ec->transform_core.activate)
2847 e_comp_object_map_enable_set(obj, EINA_TRUE);
2849 e_comp_object_map_enable_set(obj, EINA_FALSE);
2854 evas_object_map_enable_set(obj, EINA_FALSE);
2858 _e_client_transform_core_sub_update(E_Client *ec, E_Util_Transform_Rect_Vertex *vertices)
2862 E_Comp_Wl_Client_Data *cdata;
2866 cdata = e_client_cdata_get(ec);
2869 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
2870 e_client_transform_core_update(subc);
2872 EINA_LIST_FOREACH(cdata->sub.below_list, l, subc)
2873 e_client_transform_core_update(subc);
2877 _e_client_cb_hook_shell_surface_ready(void *data EINA_UNUSED, E_Client *ec)
2879 if (EINA_UNLIKELY(!ec))
2882 _e_client_aux_hint_eval(ec);
2885 // FIXME: This function has to be deleted and it remains for the backward compatibility.
2886 // Please find and fix to use e_comp_visibility_calculation_set(EINA_TRUE)
2887 // instead of e_client_visibility_calculate() call at e20 modules.
2889 e_client_visibility_calculate(void)
2891 e_comp_visibility_calculation_set(EINA_TRUE);
2895 e_client_visibility_skip_set(E_Client *ec, Eina_Bool skip)
2899 ELOGF("POL_VIS", "visibility skip set to %d", ec, skip);
2900 ec->visibility.skip = skip;
2904 e_client_post_raise_lower_set(E_Client *ec, Eina_Bool raise_set, Eina_Bool lower_set)
2908 ec->post_raise = raise_set;
2909 ec->post_lower = lower_set;
2913 e_client_first_mapped_get(E_Client *ec)
2915 if (!ec) return EINA_FALSE;
2917 return ec->first_mapped;
2920 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec)
2922 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2923 EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, EINA_FALSE);
2925 return cdata->mapped;
2929 e_client_mapped_set(E_Client *ec, Eina_Bool set)
2931 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
2932 EINA_SAFETY_ON_NULL_RETURN(cdata);
2934 cdata->mapped = set;
2938 ////////////////////////////////////////////////
2940 e_client_clients_hash_exist()
2944 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
2946 if (eina_hash_population(clients_hash[pix_id]))
2954 e_client_idler_before(Eina_Bool *check_focus)
2959 *check_focus = EINA_FALSE;
2961 if (!e_client_clients_hash_exist()) return;
2963 TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
2965 EINA_LIST_FOREACH(e_comp->clients, l, ec)
2967 // pass 1 - eval0. fetch properties on new or on change and
2968 // call hooks to decide what to do - maybe move/resize
2969 if (ec->ignored || (!ec->changed)) continue;
2971 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_fetch, NULL);
2972 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
2975 /* FETCH is hooked by the compositor to get client hints */
2976 wl_signal_emit_mutable(&PRI(ec)->events.eval_fetch, NULL);
2977 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
2981 e_client_type_update(ec);
2984 /* PRE_POST_FETCH calls e_remember apply for new client */
2985 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_post_fetch, NULL);
2986 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
2987 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_fetch, NULL);
2988 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
2989 wl_signal_emit_mutable(&PRI(ec)->events.eval_pre_frame_assign, NULL);
2990 if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
2992 wl_signal_emit_mutable(&PRI(ec)->events.eval_post_frame_assign, NULL);
2993 _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
2995 // pass 2 - show and hide windows needing hide and eval (main eval)
2996 E_CLIENT_FOREACH(ec)
2998 if (e_object_is_del(E_OBJECT(ec))) continue;
3001 // ignored client but needing eval (aux hint) such as remote surfaces
3004 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
3005 if (cdata && cdata->first_commit)
3006 _e_client_aux_hint_eval(ec);
3011 if (ec->changes.visible)
3015 if ((!ec->new_client) &&
3016 (!ec->changes.pos) &&
3017 (!ec->changes.size))
3019 evas_object_show(ec->frame);
3020 ec->changes.visible = !evas_object_visible_get(ec->frame);
3025 evas_object_hide(ec->frame);
3026 ec->changes.visible = 0;
3033 e_comp_visibility_calculation_set(EINA_TRUE);
3034 if (ec->changes.accepts_focus)
3035 *check_focus = EINA_TRUE;
3036 ec->changes.accepts_focus = 0;
3039 if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
3041 evas_object_show(ec->frame);
3042 ec->changes.visible = !evas_object_visible_get(ec->frame);
3043 ec->changed = ec->changes.visible;
3044 e_comp_visibility_calculation_set(EINA_TRUE);
3056 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3057 clients_hash[pix_id] = eina_hash_pointer_new(NULL);
3059 E_COMP_WL_HOOK_APPEND(hooks, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _e_client_cb_hook_shell_surface_ready, NULL);
3061 E_EVENT_CLIENT_ADD = ecore_event_type_new();
3062 E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
3063 E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
3064 E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
3065 E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
3066 E_EVENT_CLIENT_MOVE = ecore_event_type_new();
3067 E_EVENT_CLIENT_SHOW = ecore_event_type_new();
3068 E_EVENT_CLIENT_HIDE = ecore_event_type_new();
3069 E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
3070 E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
3071 E_EVENT_CLIENT_STACK = ecore_event_type_new();
3072 E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
3073 E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
3074 E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
3075 E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
3076 E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
3077 #ifdef _F_ZONE_WINDOW_ROTATION_
3078 E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
3079 E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
3080 E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new();
3081 E_EVENT_CLIENT_ROTATION_GEOMETRY_SET = ecore_event_type_new();
3083 E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new();
3084 E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new();
3085 E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();;
3086 E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();;
3088 return (!!clients_hash[1]);
3092 e_client_shutdown(void)
3095 for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
3096 E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
3098 E_FREE_LIST(hooks, e_comp_wl_hook_del);
3099 E_FREE_LIST(handlers, ecore_event_handler_del);
3104 e_client_unignore(E_Client *ec)
3107 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3108 if (!ec->ignored) return;
3111 _e_client_event_add(ec);
3115 _e_client_convert_fullscreen_layer(int layer)
3117 if (layer <= E_LAYER_CLIENT_NORMAL)
3118 return E_LAYER_CLIENT_NORMAL;
3119 else if (layer <= E_LAYER_CLIENT_ABOVE)
3120 return E_LAYER_CLIENT_ABOVE;
3121 else if (layer <= E_LAYER_CLIENT_EDGE)
3122 return E_LAYER_CLIENT_EDGE;
3124 return E_LAYER_CLIENT_FULLSCREEN;
3128 e_client_new(E_Pixmap *cp, int first_map, int internal)
3133 type = e_pixmap_type_get(cp);
3134 if (type >= E_PIXMAP_TYPE_MAX) return NULL;
3135 if (eina_hash_find(clients_hash[type], &cp)) return NULL;
3137 ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
3138 if (!ec) return NULL;
3139 e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
3141 if (!_e_client_private_init(ec))
3143 e_object_del(E_OBJECT(ec));
3147 uuid_generate(ec->uuid);
3149 ec->focus_policy_override = E_FOCUS_LAST;
3150 e_client_size_set(ec, 1, 1);
3151 ec->internal = internal;
3154 e_pixmap_client_set(cp, ec);
3155 ec->resize_mode = E_POINTER_RESIZE_NONE;
3156 ec->layer = E_LAYER_CLIENT_NORMAL;
3157 ec->first_mapped = EINA_FALSE;
3158 ec->post_raise = EINA_TRUE;
3159 ec->post_lower = EINA_FALSE;
3160 ec->animatable = EINA_TRUE;
3161 ec->maximize_type = e_config->maximize_policy & E_MAXIMIZE_TYPE;
3162 ec->fullscreen_layer = _e_client_convert_fullscreen_layer(e_config->fullscreen_layer);
3164 /* FIXME: if first_map is 1 then we should ignore the first hide event
3165 * or ensure the window is already hidden and events flushed before we
3166 * create a border for it */
3169 ec->changes.pos = 1;
3173 e_comp->new_clients++;
3175 ec->exp_iconify.by_client = 0;
3176 ec->exp_iconify.not_raise = 0;
3177 ec->exp_iconify.skip_iconify = 0;
3178 ec->exp_iconify.skip_by_remote = 0;
3179 if (e_config->deiconify_approve)
3180 ec->exp_iconify.deiconify_update= 1;
3182 ec->exp_iconify.deiconify_update= 0;
3183 if (e_config->use_buffer_flush)
3184 ec->exp_iconify.buffer_flush = 1;
3186 ec->exp_iconify.buffer_flush = 0;
3188 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
3190 wl_signal_emit_mutable(&PRI(ec)->events.new_client, NULL);
3191 if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec))
3193 /* delete the above allocated object */
3194 //e_object_del(E_OBJECT(ec));
3198 _e_client_aux_hint_eval(ec);
3200 ec->icccm.title = NULL;
3201 ec->icccm.name = NULL;
3202 #if defined(__cplusplus) || defined(c_plusplus)
3203 ec->icccm.cpp_class = NULL;
3205 ec->icccm.class = NULL;
3207 ec->icccm.min_w = 1;
3208 ec->icccm.min_h = 1;
3209 ec->icccm.max_w = 32767;
3210 ec->icccm.max_h = 32767;
3213 ec->netwm.name = NULL;
3214 ec->netwm.state.skip_taskbar = 0;
3215 ec->netwm.state.skip_pager = 0;
3216 ec->netwm.opacity = 255;
3218 ec->visibility.obscured = E_VISIBILITY_UNKNOWN;
3219 ec->visibility.opaque = -1;
3220 ec->visibility.changed = 0;
3221 ec->visibility.skip = 0;
3222 ec->visibility.last_sent_type = E_VISIBILITY_UNKNOWN;
3224 ec->transform.zoom = 1.0;
3225 ec->transform.angle = 0.0;
3226 ec->transform_core.direct_render = EINA_TRUE;
3227 ec->transform_core.activate = EINA_TRUE;
3229 ec->pointer_enter_sent = EINA_FALSE;
3231 ec->acquire_fence_fd = -1;
3235 e_comp->clients = eina_list_append(e_comp->clients, ec);
3236 eina_hash_add(clients_hash[type], &ec->pixmap, ec);
3238 ELOGF("COMP", "CLIENT ADD. cp:%p, argb:%d, internal:%d, ignored:%d", ec, cp, ec->argb, internal, ec->ignored);
3240 _e_client_event_add(ec);
3241 e_comp_object_client_add(ec);
3244 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
3245 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
3246 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
3247 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
3248 evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
3251 wl_signal_emit_mutable(&PRI(ec)->events.new_client_post, NULL);
3253 #ifdef _F_E_CLIENT_NEW_CLIENT_POST_HOOK_
3254 _e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT_POST, ec);
3257 ec->manage_resize.resize_obj = NULL;
3258 ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0;
3259 ec->manage_resize.enable_aspect_ratio = EINA_FALSE;
3260 ec->manage_resize.aw = ec->manage_resize.ah = 0;
3261 ec->manage_resize.header_h = 0;
3262 ec->manage_resize.footer_h = 0;
3264 ec->visibility.ignore_geometry = e_config->calc_vis_ignore_geometry;
3269 E_API Eina_Bool e_client_is_internal(E_Client *ec)
3271 E_OBJECT_CHECK_RETURN(ec, EINA_TRUE);
3272 return ec->internal;
3276 e_client_desk_iconify_skip_set(E_Client *ec, Eina_Bool skip)
3279 ec->user_skip_winlist = skip;
3283 e_client_desk_iconify_skip_get(E_Client *ec)
3285 if (!ec) return EINA_FALSE;
3286 return ec->user_skip_winlist;
3290 e_client_comp_grabbed_get(void)
3292 return comp_grabbed;
3296 e_client_action_get(void)
3298 return action_client;
3302 //////////////////////////////////////////////////////////
3305 e_client_mouse_in(E_Client *ec, int x, int y)
3309 if (comp_grabbed) return;
3310 if (e_object_is_del(E_OBJECT(ec))) return;
3311 desk = e_comp_desk_find_by_ec(ec);
3312 if (desk && desk->animate_count) return;
3313 ec->mouse.current.mx = x;
3314 ec->mouse.current.my = y;
3317 wl_signal_emit_mutable(&PRI(ec)->events.mouse_in, NULL);
3321 e_client_mouse_out(E_Client *ec, int x, int y)
3325 if (comp_grabbed) return;
3326 if (ec->fullscreen) return;
3327 if (e_object_is_del(E_OBJECT(ec))) return;
3328 desk = e_comp_desk_find_by_ec(ec);
3329 if (desk && desk->animate_count) return;
3331 ec->mouse.current.mx = x;
3332 ec->mouse.current.my = y;
3335 wl_signal_emit_mutable(&PRI(ec)->events.mouse_out, NULL);
3339 e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
3341 EINA_SAFETY_ON_NULL_RETURN(ec);
3342 if (action_client) return;
3343 ec->mouse.current.mx = output->x;
3344 ec->mouse.current.my = output->y;
3348 e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
3350 EINA_SAFETY_ON_NULL_RETURN(ec);
3352 if (action_client || ec->iconic || e_client_util_ignored_get(ec)) return;
3353 if ((button >= 1) && (button <= 3))
3355 ec->mouse.last_down[button - 1].mx = output->x;
3356 ec->mouse.last_down[button - 1].my = output->y;
3357 ec->mouse.last_down[button - 1].x = ec->x;
3358 ec->mouse.last_down[button - 1].y = ec->y;
3359 ec->mouse.last_down[button - 1].w = ec->w;
3360 ec->mouse.last_down[button - 1].h = ec->h;
3364 ec->moveinfo.down.x = ec->x;
3365 ec->moveinfo.down.y = ec->y;
3366 ec->moveinfo.down.w = ec->w;
3367 ec->moveinfo.down.h = ec->h;
3369 ec->mouse.current.mx = output->x;
3370 ec->mouse.current.my = output->y;
3371 if ((button >= 1) && (button <= 3))
3373 ec->mouse.last_down[button - 1].mx = output->x;
3374 ec->mouse.last_down[button - 1].my = output->y;
3375 ec->mouse.last_down[button - 1].x = ec->x;
3376 ec->mouse.last_down[button - 1].y = ec->y;
3377 ec->mouse.last_down[button - 1].w = ec->w;
3378 ec->mouse.last_down[button - 1].h = ec->h;
3382 ec->moveinfo.down.x = ec->x;
3383 ec->moveinfo.down.y = ec->y;
3384 ec->moveinfo.down.w = ec->w;
3385 ec->moveinfo.down.h = ec->h;
3387 ec->mouse.current.mx = output->x;
3388 ec->mouse.current.my = output->y;
3390 wl_signal_emit_mutable(&PRI(ec)->events.mouse_down, NULL);
3394 e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
3396 EINA_SAFETY_ON_NULL_RETURN(ec);
3397 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3398 if ((button >= 1) && (button <= 3))
3400 ec->mouse.last_up[button - 1].mx = output->x;
3401 ec->mouse.last_up[button - 1].my = output->y;
3402 ec->mouse.last_up[button - 1].x = ec->x;
3403 ec->mouse.last_up[button - 1].y = ec->y;
3405 ec->mouse.current.mx = output->x;
3406 ec->mouse.current.my = output->y;
3407 /* also we don't pass the same params that went in - then again that */
3408 /* should be ok as we are just ending the action if it has an end */
3409 if (ec->cur_mouse_action)
3411 if (ec->cur_mouse_action->func.end_mouse)
3412 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
3413 else if (ec->cur_mouse_action->func.end)
3414 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
3415 e_object_unref(E_OBJECT(ec->cur_mouse_action));
3416 ec->cur_mouse_action = NULL;
3419 if ((button >= 1) && (button <= 3))
3421 ec->mouse.last_up[button - 1].mx = output->x;
3422 ec->mouse.last_up[button - 1].my = output->y;
3423 ec->mouse.last_up[button - 1].x = ec->x;
3424 ec->mouse.last_up[button - 1].y = ec->y;
3429 e_client_stay_within_canvas_margin(E_Client *ec)
3436 _e_client_stay_within_canvas_margin(ec, ec->x, ec->y, &new_x, &new_y);
3438 if ((ec->x != new_x) || (ec->y != new_y))
3439 evas_object_move(ec->frame, new_x, new_y);
3444 e_client_mouse_move(E_Client *ec, Evas_Point *output)
3446 EINA_SAFETY_ON_NULL_RETURN(ec);
3447 if (ec->iconic || e_client_util_ignored_get(ec)) return;
3448 ec->mouse.current.mx = output->x;
3449 ec->mouse.current.my = output->y;
3450 if (e_client_util_moving_get(ec))
3452 _e_client_move_handle(ec);
3454 else if (e_client_util_resizing_get(ec))
3456 _e_client_resize_handle(ec);
3459 ///////////////////////////////////////////////////////
3462 e_client_res_change_geometry_save(E_Client *ec)
3465 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3467 if (ec->pre_res_change.valid) return;
3468 ec->pre_res_change.valid = 1;
3469 ec->pre_res_change.x = ec->x;
3470 ec->pre_res_change.y = ec->y;
3471 ec->pre_res_change.w = ec->w;
3472 ec->pre_res_change.h = ec->h;
3473 ec->pre_res_change.saved.x = ec->saved.x;
3474 ec->pre_res_change.saved.y = ec->saved.y;
3475 ec->pre_res_change.saved.w = ec->saved.w;
3476 ec->pre_res_change.saved.h = ec->saved.h;
3480 e_client_res_change_geometry_restore(E_Client *ec)
3486 unsigned char valid : 1;
3495 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3496 if (!ec->pre_res_change.valid) return;
3497 if (ec->new_client) return;
3499 zone = e_comp_zone_find_by_ec(ec);
3502 memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
3506 e_client_unfullscreen(ec);
3507 e_client_fullscreen(ec, e_config->fullscreen_policy);
3509 else if (ec->maximized != E_MAXIMIZE_NONE)
3513 max = ec->maximized;
3514 e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
3515 e_client_maximize(ec, max);
3519 int x, y, w, h, zx, zy, zw, zh;
3521 ec->saved.x = ec->pre_res_change.saved.x;
3522 ec->saved.y = ec->pre_res_change.saved.y;
3523 ec->saved.w = ec->pre_res_change.saved.w;
3524 ec->saved.h = ec->pre_res_change.saved.h;
3526 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
3528 if (ec->saved.w > zw)
3530 if ((ec->saved.x + ec->saved.w) > (zx + zw))
3531 ec->saved.x = zx + zw - ec->saved.w;
3533 if (ec->saved.h > zh)
3535 if ((ec->saved.y + ec->saved.h) > (zy + zh))
3536 ec->saved.y = zy + zh - ec->saved.h;
3538 x = ec->pre_res_change.x;
3539 y = ec->pre_res_change.y;
3540 w = ec->pre_res_change.w;
3541 h = ec->pre_res_change.h;
3546 if ((x + w) > (zx + zw))
3548 if ((y + h) > (zy + zh))
3550 evas_object_geometry_set(ec->frame, x, y, w, h);
3552 memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
3556 e_client_pos_set(E_Client *ec, int x, int y)
3564 e_client_pos_get(E_Client *ec, int *x, int *y)
3580 e_client_size_set(E_Client *ec, int w, int h)
3588 e_client_size_get(E_Client *ec, int *w, int *h)
3604 e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
3612 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
3614 if (e_client_transform_core_enable_get(ec))
3616 gx = ec->transform_core.result.boundary.x;
3617 gy = ec->transform_core.result.boundary.y;
3618 gw = ec->transform_core.result.boundary.w;
3619 gh = ec->transform_core.result.boundary.h;
3625 evas_object_geometry_get(ec->frame, &gx, &gy, &gw, &gh);
3626 if (gw == 0 && gh == 0)
3628 /* In this case, there is no image buffer in e_comp_object, thus it
3629 * should return geometry value of ec itself. It usually happens if
3630 * new ec is not mapped yet.
3654 e_client_above_get(const E_Client *ec)
3656 #ifdef REFACTOR_DESK_AREA
3657 E_Client_Data_Get_Above data;
3659 E_OBJECT_CHECK_RETURN(ec, NULL);
3660 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3662 data.above_ec = NULL;
3664 wl_signal_emit_mutable(&PRI(ec)->events.get_above, &data);
3666 return data.above_ec;
3671 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3672 if (EINA_INLIST_GET(ec)->next) //check current layer
3674 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3678 ELOGF("FATAL", "CHECK the ec inlist next", ec);
3681 if (!e_object_is_del(E_OBJECT(ec2)))
3685 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3686 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3688 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3689 /* go up the layers until we find one */
3690 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3692 if (!e_comp->layers[x].clients) continue;
3693 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3697 ELOGF("FATAL", "EC exist above layer. ec layer_map:%d, cur layer_map:%d",
3698 ec, e_comp_canvas_layer_map(ec->layer), x);
3701 if (!e_object_is_del(E_OBJECT(ec2)))
3703 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3708 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3715 e_client_below_get(const E_Client *ec)
3717 #ifdef REFACTOR_DESK_AREA
3718 E_Client_Data_Get_Below data;
3720 E_OBJECT_CHECK_RETURN(ec, NULL);
3721 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3723 data.below_ec = NULL;
3725 wl_signal_emit_mutable(&PRI(ec)->events.get_below, &data);
3727 return data.below_ec;
3732 E_Layer ec_layer, ec_layer_cw;
3735 E_OBJECT_CHECK_RETURN(ec, NULL);
3736 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3738 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3739 if (EINA_INLIST_GET(ec)->prev) //check current layer
3741 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3743 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3746 ELOGF("FATAL", "CHECK the ec inlist prev", ec);
3749 if (!e_object_is_del(E_OBJECT(ec2)))
3754 // check layer validation
3755 ec_layer = ec->layer;
3756 if (ec->layer_block || ec->layer_pending)
3758 cw_layer = e_comp_object_layer_get(ec->frame);
3761 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3762 if (ec_layer != ec_layer_cw)
3764 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);
3765 ec_layer = ec_layer_cw;
3770 if (ec_layer == E_LAYER_CLIENT_DESKTOP) return NULL;
3771 if (e_comp_canvas_client_layer_map(ec_layer) == 9999) return NULL;
3773 /* go down the layers until we find one */
3774 x = e_comp_canvas_layer_map(ec_layer);
3777 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3778 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3780 if (!e_comp->layers[x].clients) continue;
3781 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3785 ELOGF("FATAL", "EC exist below layer. ec layer_map:%d, cur layer_map:%d",
3786 ec, e_comp_canvas_layer_map(ec_layer), x);
3789 if (!e_object_is_del(E_OBJECT(ec2)))
3791 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3796 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3803 e_client_visible_above_get(E_Client *ec)
3808 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3809 if (EINA_INLIST_GET(ec)->next) //check current layer
3811 EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
3813 if (ec == ec2) continue;
3814 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3815 (!e_client_util_ignored_get(ec2)) &&
3822 if (ec->layer == E_LAYER_CLIENT_CURSOR) return NULL;
3823 if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL;
3825 /* go up the layers until we find one */
3826 for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3828 if (!e_comp->layers[x].clients) continue;
3829 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3831 if (ec == ec2) continue;
3832 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3833 (!e_client_util_ignored_get(ec2)) &&
3844 e_client_visible_below_get(E_Client *ec)
3846 #ifdef REFACTOR_DESK_AREA
3847 E_Client_Data_Get_Visible_Below data;
3849 E_OBJECT_CHECK_RETURN(ec, NULL);
3850 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3852 data.below_ec = NULL;
3854 wl_signal_emit_mutable(&PRI(ec)->events.get_visible_below, &data);
3856 return data.below_ec;
3861 E_Layer ec_layer, ec_layer_cw;
3864 E_OBJECT_CHECK_RETURN(ec, NULL);
3865 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
3867 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
3868 if (EINA_INLIST_GET(ec)->prev) //check current layer
3870 for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
3872 ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
3873 if (ec == ec2) continue;
3874 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3875 (!e_client_util_ignored_get(ec2)) &&
3882 // check layer validation
3883 ec_layer = ec->layer;
3884 if (ec->layer_block || ec->layer_pending)
3886 cw_layer = e_comp_object_layer_get(ec->frame);
3889 ec_layer_cw = e_comp_canvas_layer_map_to(cw_layer);
3890 if (ec_layer != ec_layer_cw)
3892 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);
3893 ec_layer = ec_layer_cw;
3898 /* go down the layers until we find one */
3899 if (e_comp_canvas_layer_map(ec->layer) > e_comp_canvas_layer_map(E_LAYER_MAX)) return NULL;
3900 x = e_comp_canvas_layer_map(ec->layer);
3903 for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3905 if (!e_comp->layers[x].clients) continue;
3906 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3908 if (ec == ec2) continue;
3909 if ((!e_object_is_del(E_OBJECT(ec2))) &&
3910 (!e_client_util_ignored_get(ec2)) &&
3922 e_client_bottom_get(void)
3924 #ifdef REFACTOR_DESK_AREA
3928 // get the bottom ec from current desk at current zone
3929 zone = e_zone_current_get();
3930 desk = e_desk_current_get(zone);
3932 return e_desk_bottom_ec_get(desk);
3935 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3936 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
3940 if (!e_comp->layers[x].clients) continue;
3941 EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2)
3942 if (!e_object_is_del(E_OBJECT(ec2)))
3944 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3948 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3955 e_client_top_get(void)
3957 #ifdef REFACTOR_DESK_AREA
3961 // get the top ec from current desk at current zone
3962 zone = e_zone_current_get();
3963 desk = e_desk_current_get(zone);
3965 return e_desk_top_ec_get(desk);
3968 g_rec_mutex_lock(&e_comp->ec_list_mutex);
3969 for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
3973 if (!e_comp->layers[x].clients) continue;
3974 EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
3975 if (!e_object_is_del(E_OBJECT(ec2)))
3977 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3981 g_rec_mutex_unlock(&e_comp->ec_list_mutex);
3987 EINTERN unsigned int
3988 e_clients_count(void)
3990 return eina_list_count(e_comp->clients);
3995 * Set a callback which will be called just prior to updating the
3996 * move coordinates for a border
3999 e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
4001 ec->move_intercept_cb = cb;
4004 ///////////////////////////////////////
4006 E_API E_Client_Hook *
4007 e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
4011 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_HOOK_LAST, NULL);
4012 ch = E_NEW(E_Client_Hook, 1);
4013 if (!ch) return NULL;
4014 ch->hookpoint = hookpoint;
4016 ch->data = (void*)data;
4017 _e_client_hooks[hookpoint] = eina_inlist_append(_e_client_hooks[hookpoint], EINA_INLIST_GET(ch));
4022 e_client_hook_del(E_Client_Hook *ch)
4025 if (_e_client_hooks_walking == 0)
4027 _e_client_hooks[ch->hookpoint] = eina_inlist_remove(_e_client_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4031 _e_client_hooks_delete++;
4034 ///////////////////////////////////////
4036 E_API E_Client_Intercept_Hook *
4037 e_client_intercept_hook_add(E_Client_Intercept_Hook_Point hookpoint, E_Client_Intercept_Hook_Cb func, const void *data)
4039 E_Client_Intercept_Hook *ch;
4041 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_CLIENT_INTERCEPT_HOOK_LAST, NULL);
4042 ch = E_NEW(E_Client_Intercept_Hook, 1);
4043 if (!ch) return NULL;
4044 ch->hookpoint = hookpoint;
4046 ch->data = (void*)data;
4047 _e_client_intercept_hooks[hookpoint] = eina_inlist_append(_e_client_intercept_hooks[hookpoint], EINA_INLIST_GET(ch));
4052 e_client_intercept_hook_del(E_Client_Intercept_Hook *ch)
4057 if (_e_client_intercept_hooks_walking == 0)
4059 _e_client_intercept_hooks[ch->hookpoint] =
4060 eina_inlist_remove(_e_client_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
4064 _e_client_intercept_hooks_delete++;
4068 e_client_focus_latest_set(E_Client *ec)
4070 EINA_SAFETY_ON_NULL_RETURN(ec);
4072 wl_signal_emit_mutable(&PRI(ec)->events.focus_latest_set, NULL);
4076 e_client_focus_defer_set(E_Client *ec)
4078 EINA_SAFETY_ON_NULL_RETURN(ec);
4080 wl_signal_emit_mutable(&PRI(ec)->events.focus_defer_set, NULL);
4084 e_client_focused_set(E_Client *ec)
4086 E_Client *focused_ec;
4090 ELOGF("FOCUS", "CLIENT FOCUSED_SET : SET", ec);
4092 ELOGF("FOCUS", "CLIENT FOCUSED_SET : UNSET", NULL);
4094 focused_ec = e_comp_focused_ec_get();
4095 if (ec == focused_ec) return;
4097 TRACE_DS_BEGIN(CLIENT:FOCUSED SET);
4099 // unset the current focused_ec if focused_ec is not being deleted
4102 if (!e_object_is_del(E_OBJECT(focused_ec)))
4104 // FIXME: Remove focus_unset event of client.
4105 // Instead, make zone focus_unset event and use it.
4106 wl_signal_emit_mutable(&PRI(focused_ec)->events.focus_unset, NULL);
4107 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, focused_ec);
4109 if (e_object_ref_get(E_OBJECT(focused_ec)) > 0)
4111 _e_client_event_simple(focused_ec, E_EVENT_CLIENT_FOCUS_OUT);
4116 // clear the current focused_ec when ec is NULL
4119 zone = e_comp_zone_find_by_ec(focused_ec);
4120 e_zone_focus_clear(zone);
4125 // FIXME: Remove focus_set event of client.
4126 // Instead, make zone focus_set event and use it.
4127 // set the new current focused_ec
4128 wl_signal_emit_mutable(&PRI(ec)->events.focus_set, NULL);
4129 _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
4131 // send the client_focuse_in event
4132 _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
4138 e_client_activate(E_Client *ec)
4141 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4143 TRACE_DS_BEGIN(CLIENT:ACTIVATE);
4145 ELOGF("COMP", "Set launching flag..", ec);
4146 ec->launching = EINA_TRUE;
4148 ec->exp_iconify.not_raise = 0;
4152 if (!ec->lock_user_iconify)
4153 e_client_uniconify(ec);
4155 ELOGF("COMP", "Un-Set ICONIFY BY CLIENT", ec);
4156 ec->exp_iconify.by_client = 0;
4157 e_client_iconified_type_set(ec, E_ICONIFIED_TYPE_NONE);
4159 wl_signal_emit_mutable(&PRI(ec)->events.activate_done, NULL);
4160 _e_client_hook_call(E_CLIENT_HOOK_ACTIVATE_DONE, ec);
4166 e_client_focused_get(void)
4168 return e_comp_focused_ec_get();
4172 e_client_lost_windows_get(E_Zone *zone)
4174 Eina_List *list = NULL;
4177 int loss_overlap = 5;
4179 E_OBJECT_CHECK_RETURN(zone, NULL);
4180 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
4181 EINA_LIST_FOREACH(e_comp->clients, l, ec)
4183 if (!e_zone_has_ec(zone, ec)) continue;
4184 if (e_client_util_ignored_get(ec)) continue;
4186 if (!E_INTERSECTS(zone->x + loss_overlap,
4187 zone->y + loss_overlap,
4188 zone->w - (2 * loss_overlap),
4189 zone->h - (2 * loss_overlap),
4190 ec->x, ec->y, ec->w, ec->h))
4192 list = eina_list_append(list, ec);
4198 ///////////////////////////////////////
4201 e_client_maximized_geometry_set(E_Client *ec, int x, int y, int w, int h)
4205 ec->maximized_info.x = x;
4206 ec->maximized_info.y = y;
4207 ec->maximized_info.w = w;
4208 ec->maximized_info.h = h;
4210 e_client_frame_geometry_set(ec, x, y, w, h);
4214 e_client_maximized_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
4218 if (x) *x = ec->maximized_info.x;
4219 if (y) *y = ec->maximized_info.y;
4220 if (w) *w = ec->maximized_info.w;
4221 if (h) *h = ec->maximized_info.h;
4225 e_client_maximize_update(E_Client *ec)
4230 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4234 max = ec->maximized;
4236 e_client_maximize(ec, max);
4241 e_client_maximize(E_Client *ec, E_Maximize max)
4244 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4246 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
4248 if ((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION))
4250 if ((ec->maximized & E_MAXIMIZE_TYPE) == (max & E_MAXIMIZE_TYPE))
4256 ec->changes.need_maximize = 1;
4257 ec->maximized &= ~E_MAXIMIZE_TYPE;
4258 ec->maximized |= max;
4263 if (!ec->fullscreen)
4265 // call the maximize hook of a client
4266 wl_signal_emit_mutable(&PRI(ec)->events.maximize, &max);
4268 // store the E_Maximize value
4269 ec->maximized = max;
4270 ec->changes.need_unmaximize = 0;
4272 evas_object_smart_callback_call(ec->frame, "maximize_done", NULL);
4276 // store the E_Maximize value
4277 ec->maximized = max;
4278 ec->changes.need_unmaximize = 0;
4283 e_client_unmaximize(E_Client *ec, E_Maximize max)
4286 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4288 if (!(max & E_MAXIMIZE_DIRECTION))
4290 CRI("BUG: Unmaximize call without direction!");
4295 ec->changes.need_unmaximize = 1;
4300 /* Remove directions not used */
4301 max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
4302 /* Can only remove existing maximization directions */
4305 if (!ec->fullscreen)
4307 evas_object_smart_callback_call(ec->frame, "unmaximize_pre", NULL);
4309 // call the unmaximize hook of a client
4310 wl_signal_emit_mutable(&PRI(ec)->events.unmaximize, &max);
4312 evas_object_smart_callback_call(ec->frame, "unmaximize_done", NULL);
4315 ec->maximized = E_MAXIMIZE_NONE;
4316 ec->changes.need_unmaximize = 0;
4320 e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
4323 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4325 if (ec->fullscreen) return;
4327 // call the fullscreen_pre hook of a client
4328 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen_pre, NULL);
4329 _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec);
4331 if (ec->skip_fullscreen) return;
4334 ec->need_fullscreen = 1;
4338 ec->saved.layer = ec->layer;
4339 e_client_layer_set(ec, ec->fullscreen_layer);
4343 // call the fullscreen hook of a client
4344 wl_signal_emit_mutable(&PRI(ec)->events.fullscreen, &policy);
4346 ec->fullscreen_policy = policy;
4348 _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
4352 e_client_unfullscreen(E_Client *ec)
4355 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4357 ec->need_fullscreen = 0;
4359 if (!ec->fullscreen) return;
4363 E_Fullscreen policy = ec->fullscreen_policy;
4365 // call the unfullscreen hook of a client
4366 wl_signal_emit_mutable(&PRI(ec)->events.unfullscreen, &policy);
4368 e_client_layer_set(ec, ec->saved.layer);
4370 ec->fullscreen_policy = E_FULLSCREEN_RESIZE;
4372 _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
4375 ///////////////////////////////////////
4377 e_client_is_parent_iconify_by_client(E_Client *ec)
4379 E_Client *parent = ec->parent;
4380 if (!parent) return EINA_FALSE;
4382 if ((parent->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT) ||
4383 (parent->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT))
4390 e_client_iconify(E_Client *ec)
4393 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4395 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
4396 Eina_Bool iconified_by_client = e_client_is_iconified_by_client(ec);
4398 ELOGF("TZVIS", "ICONIFY |iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d",
4399 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4400 ec->exp_iconify.by_client, ec->exp_iconify.type);
4402 if (ec->iconic) return;
4403 if (ec->exp_iconify.skip_iconify && !iconified_by_client) return;
4404 if (ec->exp_iconify.skip_by_remote) return;
4405 if (!cdata || !cdata->mapped)
4407 if (!iconified_by_client)
4409 ELOGF("TZVIS", "Not mapped.. So, don't iconify", ec);
4414 ELOGF("TZVIS", "Not mapped.. But, iconify by user request", ec);
4418 TRACE_DS_BEGIN(CLIENT:ICONIFY);
4420 wl_signal_emit_mutable(&PRI(ec)->events.iconify, NULL);
4421 _e_client_hook_call(E_CLIENT_HOOK_ICONIFY, ec);
4427 e_client_uniconify(E_Client *ec)
4429 E_Comp_Wl_Client_Data *cdata;
4432 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4434 cdata = e_client_cdata_get(ec);
4436 ELOGF("TZVIS", "UNICONIFY|iconic:%d |argb:%d |not_raise:%d |by_client:%d, type:%d |mapped:%d",
4437 ec, ec->iconic, ec->argb, (unsigned int)ec->exp_iconify.not_raise,
4438 ec->exp_iconify.by_client, ec->exp_iconify.type,
4439 cdata ? cdata->mapped : 0);
4441 if (!ec->iconic) return;
4443 TRACE_DS_BEGIN(CLIENT:UNICONIFY);
4445 // call the uniconify hook of a client
4446 wl_signal_emit_mutable(&PRI(ec)->events.uniconify, NULL);
4447 _e_client_hook_call(E_CLIENT_HOOK_UNICONIFY, ec);
4453 e_client_iconified_type_set(E_Client *ec, E_Iconified_Type type)
4456 ec->exp_iconify.type = type;
4459 EINTERN E_Iconified_Type
4460 e_client_iconified_type_get(E_Client *ec)
4462 if (!ec) return E_ICONIFIED_TYPE_NONE;
4463 return ec->exp_iconify.type;
4466 E_API Eina_Bool e_client_is_iconified_by_client(E_Client *ec)
4468 if (!ec) return EINA_FALSE;
4470 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_ICONIFY_BY_CLIENT)
4473 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_DESK_ICONIFY_BY_CLIENT)
4476 if (ec->exp_iconify.type == E_ICONIFIED_TYPE_PARENT_ICONIFY_BY_CLIENT)
4479 if (ec->exp_iconify.by_client)
4481 ELOGF("POL", "CHECK. mismatch value. by_client:%d, type:%d", ec, ec->exp_iconify.by_client, ec->exp_iconify.type);
4488 ///////////////////////////////////////
4490 EINTERN void e_client_hide_by_request_set(E_Client *ec, Eina_Bool set)
4493 priv->hide_by_request = set;
4496 EINTERN Eina_Bool e_client_hide_by_request_get(E_Client *ec)
4498 API_ENTRY_VAL(EINA_FALSE);
4499 return priv->hide_by_request;
4502 ///////////////////////////////////////
4505 e_client_stick(E_Client *ec)
4508 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4509 if (ec->sticky) return;
4511 // call the stick hook of a client
4512 wl_signal_emit_mutable(&PRI(ec)->events.stick, NULL);
4514 // send the sticky property event of a client
4515 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4519 e_client_unstick(E_Client *ec)
4522 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4524 if (!ec->sticky) return;
4526 // call the unstick hook of a client
4527 wl_signal_emit_mutable(&PRI(ec)->events.unstick, NULL);
4529 // send the sticky property event of a client
4530 _e_client_event_property(ec, E_CLIENT_PROPERTY_STICKY);
4534 e_client_pinned_set(E_Client *ec, Eina_Bool set)
4538 EINA_SAFETY_ON_NULL_RETURN(ec);
4540 layer = E_LAYER_CLIENT_ABOVE;
4542 layer = E_LAYER_CLIENT_NORMAL;
4544 e_client_layer_set(ec, layer);
4549 ///////////////////////////////////////
4552 e_client_border_set(E_Client *ec, const char *name)
4554 Eina_Stringshare *pborder;
4556 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
4557 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
4558 if (!e_comp_object_frame_allowed(ec->frame)) return EINA_FALSE;
4559 if (ec->border.changed)
4560 CRI("CALLING WHEN border.changed SET!");
4562 if (!e_util_strcmp(ec->border.name, name)) return EINA_TRUE;
4563 pborder = ec->border.name;
4564 ec->border.name = eina_stringshare_add(name);
4565 if (e_comp_object_frame_theme_set(ec->frame, name))
4567 eina_stringshare_del(pborder);
4570 eina_stringshare_del(ec->border.name);
4571 ec->border.name = pborder;
4575 ///////////////////////////////////////
4578 e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
4581 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4584 if (ec->comp_hidden == hidden) return;
4585 ec->comp_hidden = hidden;
4586 evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
4589 ///////////////////////////////////////
4592 e_client_act_move_keyboard(E_Client *ec)
4594 EINA_SAFETY_ON_NULL_RETURN(ec);
4596 if (!_e_client_move_begin(ec))
4599 _e_client_action_init(ec);
4600 _e_client_action_move_timeout_add();
4602 wl_signal_emit_mutable(&PRI(ec)->events.move_update, NULL);
4603 if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
4604 evas_object_freeze_events_set(ec->frame, 1);
4606 if (!action_handler_mouse)
4607 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
4611 e_client_act_resize_keyboard(E_Client *ec)
4613 EINA_SAFETY_ON_NULL_RETURN(ec);
4615 ec->resize_mode = E_POINTER_RESIZE_TL;
4616 ec->keyboard_resizing = 1;
4617 if (!e_client_resize_begin(ec))
4619 ec->keyboard_resizing = 0;
4623 _e_client_action_init(ec);
4624 _e_client_action_resize_timeout_add();
4625 evas_object_freeze_events_set(ec->frame, 1);
4627 if (!action_handler_mouse)
4628 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
4632 e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
4635 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4636 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4641 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4642 _e_client_moveinfo_gather(ec, source);
4644 if (!_e_client_move_begin(ec))
4647 _e_client_action_init(ec);
4651 e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4654 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4655 if (!ec->moving) return;
4656 _e_client_move_end(ec);
4657 _e_client_action_finish();
4661 e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, E_Pointer_Mode resize_mode)
4664 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4665 if (ec->lock_user_size) return;
4666 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4670 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
4671 _e_client_moveinfo_gather(ec, source);
4673 if (resize_mode != E_POINTER_RESIZE_NONE)
4675 ec->resize_mode = resize_mode;
4679 /* Use canvas.x, canvas.y of event.
4680 * Transformed coordinates has to be considered for accurate resize_mode
4681 * rather than absolute coordinates. */
4682 if ((ev->canvas.x > (ec->x + ec->w / 5)) &&
4683 (ev->canvas.x < (ec->x + ec->w * 4 / 5)))
4685 if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_T;
4686 else ec->resize_mode = E_POINTER_RESIZE_B;
4688 else if (ev->canvas.x < (ec->x + ec->w / 2))
4690 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;
4691 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TL;
4692 else ec->resize_mode = E_POINTER_RESIZE_BL;
4696 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;
4697 else if (ev->canvas.y < (ec->y + ec->h / 2)) ec->resize_mode = E_POINTER_RESIZE_TR;
4698 else ec->resize_mode = E_POINTER_RESIZE_BR;
4702 if (!e_client_resize_begin(ec))
4704 _e_client_action_init(ec);
4708 e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
4711 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4712 if (e_client_util_resizing_get(ec))
4714 _e_client_resize_end(ec);
4715 ec->changes.reset_gravity = 1;
4716 if (!e_object_is_del(E_OBJECT(ec)))
4719 _e_client_action_finish();
4723 e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
4726 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4730 e_client_act_close_begin(E_Client *ec)
4733 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4734 if (ec->lock_close) return;
4735 if (ec->icccm.delete_request)
4737 ec->delete_requested = 1;
4738 evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
4740 else if (e_config->kill_if_close_not_possible)
4742 e_client_act_kill_begin(ec);
4747 e_client_act_kill_begin(E_Client *ec)
4750 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4751 if (ec->internal) return;
4752 if (ec->lock_close) return;
4753 if ((ec->netwm.pid > 1) && (e_config->kill_process))
4755 kill(ec->netwm.pid, SIGINT);
4756 ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
4757 _e_client_cb_kill_timer, ec);
4760 evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
4763 ////////////////////////////////////////////
4766 e_client_ping(E_Client *ec)
4769 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4771 if (!e_config->ping_clients) return;
4773 EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
4776 evas_object_smart_callback_call(ec->frame, "ping", NULL);
4777 ec->ping = ecore_loop_time_get();
4778 if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
4779 ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
4780 e_config->ping_clients_interval,
4781 _e_client_cb_ping_poller, ec);
4784 ////////////////////////////////////////////
4786 e_client_cursor_map_apply(E_Client *ec, int rotation, int x, int y)
4788 // TODO: remove(deprecate) this e_client_cursor_map_apply.
4792 e_client_move_cancel(void)
4794 if (!ecmove) return;
4795 if (ecmove->cur_mouse_action)
4800 e_object_ref(E_OBJECT(ec));
4801 if (ec->cur_mouse_action->func.end_mouse)
4802 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4803 else if (ec->cur_mouse_action->func.end)
4804 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4805 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4806 ec->cur_mouse_action = NULL;
4807 e_object_unref(E_OBJECT(ec));
4810 _e_client_move_end(ecmove);
4814 e_client_resize_cancel(void)
4816 if (!ecresize) return;
4817 if (ecresize->cur_mouse_action)
4822 e_object_ref(E_OBJECT(ec));
4823 if (ec->cur_mouse_action->func.end_mouse)
4824 ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
4825 else if (ec->cur_mouse_action->func.end)
4826 ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
4827 e_object_unref(E_OBJECT(ec->cur_mouse_action));
4828 ec->cur_mouse_action = NULL;
4829 e_object_unref(E_OBJECT(ec));
4832 _e_client_resize_end(ecresize);
4836 e_client_resize_begin(E_Client *ec)
4838 if ((ec->fullscreen) || (ec->lock_user_size))
4840 if (!_e_client_action_input_win_new()) goto error;
4842 if (ec->manage_resize.enable_aspect_ratio)
4844 ELOGF("RESIZE", "Set resize aspect ratio.. ratio(%dx%d)", ec, ec->w, ec->h);
4845 ec->manage_resize.aw = ec->w;
4846 ec->manage_resize.ah = ec->h - ec->manage_resize.header_h - ec->manage_resize.footer_h;
4849 wl_signal_emit_mutable(&PRI(ec)->events.move_begin, NULL);
4850 _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
4851 if (ec->transformed)
4852 _e_client_transform_resize_begin(ec);
4853 if (!e_client_util_resizing_get(ec))
4855 if (ecresize == ec) ecresize = NULL;
4856 _e_client_action_input_win_del();
4859 if (!ec->lock_user_stacking)
4861 if (e_config->border_raise_on_mouse_action)
4866 e_comp_client_override_add(ec);
4870 ec->resize_mode = E_POINTER_RESIZE_NONE;
4875 ////////////////////////////////////////////
4878 e_client_frame_recalc(E_Client *ec)
4880 EINA_SAFETY_ON_NULL_RETURN(ec);
4881 if (!ec->frame) return;
4882 evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
4885 ////////////////////////////////////////////
4888 e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
4891 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4893 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4894 _e_client_moveinfo_gather(ec, sig);
4895 if (!_e_client_move_begin(ec)) return;
4899 e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4902 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4903 if (!ec->moving) return;
4904 _e_client_move_end(ec);
4908 e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
4910 int resize_mode = E_POINTER_RESIZE_BR;
4913 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4915 if (e_client_util_resizing_get(ec) || (ec->moving)) return;
4916 if (!strcmp(dir, "tl"))
4918 resize_mode = E_POINTER_RESIZE_TL;
4920 else if (!strcmp(dir, "t"))
4922 resize_mode = E_POINTER_RESIZE_T;
4924 else if (!strcmp(dir, "tr"))
4926 resize_mode = E_POINTER_RESIZE_TR;
4928 else if (!strcmp(dir, "r"))
4930 resize_mode = E_POINTER_RESIZE_R;
4932 else if (!strcmp(dir, "br"))
4934 resize_mode = E_POINTER_RESIZE_BR;
4936 else if (!strcmp(dir, "b"))
4938 resize_mode = E_POINTER_RESIZE_B;
4940 else if (!strcmp(dir, "bl"))
4942 resize_mode = E_POINTER_RESIZE_BL;
4944 else if (!strcmp(dir, "l"))
4946 resize_mode = E_POINTER_RESIZE_L;
4948 ec->resize_mode = resize_mode;
4949 _e_client_moveinfo_gather(ec, sig);
4950 if (!e_client_resize_begin(ec))
4955 e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
4958 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4959 if (!e_client_util_resizing_get(ec)) return;
4960 _e_client_resize_handle(ec);
4961 _e_client_resize_end(ec);
4962 ec->changes.reset_gravity = 1;
4966 ////////////////////////////////////////////
4969 e_client_resize_limit(E_Client *ec, int *w, int *h)
4972 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
4975 e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
4979 if ((ec->icccm.max_w > 0) && (*w > ec->icccm.max_w)) *w = ec->icccm.max_w;
4980 else if (*w < ec->icccm.min_w)
4981 *w = ec->icccm.min_w;
4982 if ((ec->icccm.max_h > 0) && (*h > ec->icccm.max_h)) *h = ec->icccm.max_h;
4983 else if (*h < ec->icccm.min_h)
4984 *h = ec->icccm.min_h;
4987 e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
4990 ////////////////////////////////////////////
4995 e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
4999 /* We need to ensure that we can get the comp window for the
5000 * zone of either the given desk or the desk of the excluded
5001 * window, so return if neither is given */
5003 e_input_device_pointer_xy_get(NULL, &x, &y);
5005 e_input_device_pointer_xy_get(NULL, &x, &y);
5011 desk = exclude->desk;
5015 desk = e_desk_current_get(exclude->zone);
5017 desk = e_desk_current_get(e_zone_current_get());
5021 return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
5024 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
5026 if (!desk) return NULL;
5028 return _e_client_under_pointer_helper(desk, exclude, x, y);
5031 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
5033 if (!desk) return NULL;
5035 return _e_client_under_pointer_input_helper(desk, x, y);
5038 ////////////////////////////////////////////
5040 ////////////////////////////////////////////
5043 e_client_redirected_set(E_Client *ec, Eina_Bool set)
5045 EINA_SAFETY_ON_NULL_RETURN(ec);
5046 if (ec->input_only) return;
5048 if (ec->redirected == set) return;
5051 e_client_frame_recalc(ec);
5053 wl_signal_emit_mutable(&PRI(ec)->events.redirect, NULL);
5054 if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
5058 wl_signal_emit_mutable(&PRI(ec)->events.unredirect, NULL);
5059 if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
5061 e_comp_object_redirected_set(ec->frame, set);
5062 ec->redirected = !!set;
5065 ////////////////////////////////////////////
5068 e_client_transform_update(E_Client *ec)
5070 if (e_client_util_resizing_get(ec))
5071 _e_client_transform_resize(ec);
5074 ////////////////////////////////////////////
5077 e_client_transform_apply(E_Client *ec, double angle, double zoom, int cx, int cy)
5080 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5084 if (e_comp_wl_subsurface_check(ec))
5087 /* check if it's different with current state */
5088 if ((ec->transform.angle == angle) &&
5089 (ec->transform.zoom == zoom) &&
5090 (ec->transform.center.x == cx) &&
5091 (ec->transform.center.y == cy))
5094 /* use previous value if any required value is invalid */
5096 angle = ec->transform.angle;
5098 zoom = ec->transform.zoom;
5099 if (!E_INSIDE(cx, cy,
5100 ec->client.x, ec->client.y,
5101 ec->client.w, ec->client.h))
5103 cx = ec->transform.center.x;
5104 cy = ec->transform.center.y;
5107 if ((angle == 0) && (zoom == 1.0))
5109 e_client_transform_clear(ec);
5113 map = e_map_new_with_direct_render(ec->transform_core.direct_render);
5114 e_map_util_points_populate_from_object_full(map, ec->frame, 0);
5116 e_map_util_rotate(map, angle, cx, cy);
5117 _e_client_transform_geometry_save(ec, map);
5119 e_map_util_zoom(map, zoom, zoom, cx, cy);
5121 e_map_util_object_move_sync_set(map, EINA_TRUE);
5122 e_client_map_set(ec, map);
5123 e_client_map_enable_set(ec, EINA_TRUE);
5125 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5126 _e_client_transform_sub_apply(subc, ec, zoom);
5127 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5128 _e_client_transform_sub_apply(subc, ec, zoom);
5132 ec->transform.zoom = zoom;
5133 ec->transform.angle = angle;
5134 ec->transform.center.x = cx;
5135 ec->transform.center.y = cy;
5136 ec->transformed = EINA_TRUE;
5139 ////////////////////////////////////////////
5142 e_client_transform_clear(E_Client *ec)
5144 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
5148 e_client_map_enable_set(ec, EINA_FALSE);
5149 e_client_map_set(ec, NULL);
5151 EINA_LIST_FOREACH(cdata->sub.list, l, subc)
5152 _e_client_transform_sub_apply(subc, ec, 1.0);
5153 EINA_LIST_REVERSE_FOREACH(cdata->sub.below_list, l, subc)
5154 _e_client_transform_sub_apply(subc, ec, 1.0);
5156 ec->transform.zoom = 1.0;
5157 ec->transform.angle = 0.0;
5158 ec->transformed = EINA_FALSE;
5162 e_client_transform_core_enable_get(E_Client *ec)
5164 if (!ec) return EINA_FALSE;
5165 return ec->transform_core.result.enable;
5169 e_client_transform_core_add(E_Client *ec, E_Util_Transform *transform)
5172 if (!transform) return;
5174 // duplication check
5175 if (ec->transform_core.transform_list &&
5176 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5181 ec->transform_core.transform_list = eina_list_append(ec->transform_core.transform_list, transform);
5182 ec->transform_core.changed = EINA_TRUE;
5183 e_util_transform_ref(transform);
5184 // e_client_transform_core_update(ec);
5188 e_client_transform_core_remove(E_Client *ec, E_Util_Transform *transform)
5191 if (!transform) return;
5193 if (ec->transform_core.transform_list &&
5194 eina_list_data_find(ec->transform_core.transform_list, transform) == transform)
5196 ec->transform_core.transform_list = eina_list_remove(ec->transform_core.transform_list, transform);
5197 e_util_transform_unref(transform);
5198 ec->transform_core.changed = EINA_TRUE;
5201 e_client_transform_core_update(ec);
5205 e_client_transform_core_update(E_Client *ec)
5208 if (ec->new_client) return;
5209 if (!_e_client_transform_core_check_change(ec)) return;
5211 if (ec->transform_core.transform_list || ec->transform_core.parent.enable)
5213 E_Util_Transform_Rect source_rect;
5214 E_Util_Transform_Matrix matrix, boundary_matrix;
5215 E_Util_Transform_Zoom zoom;
5217 Eina_Bool background;
5218 E_Util_Transform *temp_trans;
5221 ec->transform_core.result.enable = EINA_TRUE;
5222 e_util_transform_rect_client_rect_get(&source_rect, ec);
5223 e_util_transform_init(&ec->transform_core.result.transform);
5225 // 2. merge transform
5226 EINA_LIST_FOREACH(ec->transform_core.transform_list, l, temp_trans)
5228 e_util_transform_merge(&ec->transform_core.result.transform, temp_trans);
5230 zoom = ec->transform_core.result.transform.zoom;
5232 // 2.5 check viewport
5233 if (e_util_transform_viewport_flag_get(&ec->transform_core.result.transform))
5235 int vx = 0, vy = 0, vw = 0, vh = 0;
5236 e_util_transform_viewport_get(&ec->transform_core.result.transform, &vx, &vy, &vw, &vh);
5237 e_util_transform_rect_init(&source_rect, vx, vy, vw, vh);
5240 // 3. apply background transform
5241 matrix = e_util_transform_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5243 if (e_util_transform_bg_transform_flag_get(&ec->transform_core.result.transform))
5245 boundary_matrix = e_util_transform_bg_convert_to_matrix(&ec->transform_core.result.transform, &source_rect);
5246 background = EINA_TRUE;
5250 background = EINA_FALSE;
5251 boundary_matrix = matrix;
5254 if (background != ec->transform_core.background)
5258 e_comp_object_transform_bg_set(ec->frame, EINA_TRUE);
5262 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5265 ec->transform_core.background = background;
5268 // 3.1 if 24bit window then set transp rect
5273 e_util_transform_rotation_round_get(&ec->transform_core.result.transform, 0, 0, &angle);
5276 if (angle == 0) // when transform angle is 0, 90, 180, 270, 360. then set transp rect
5277 e_comp_object_transform_transp_set(ec->frame, EINA_TRUE);
5279 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5282 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5284 // 3.5 parent matrix multiply
5285 if (ec->transform_core.parent.enable)
5287 matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5289 boundary_matrix = e_util_transform_matrix_multiply(&ec->transform_core.parent.matrix,
5292 ec->transform_core.result.transform.use_zoom = EINA_TRUE;
5293 zoom.zoom_x *= ec->transform_core.parent.zoom.zoom_x;
5294 zoom.zoom_y *= ec->transform_core.parent.zoom.zoom_y;
5295 zoom.cx += ec->transform_core.parent.zoom.cx;
5296 zoom.cy += ec->transform_core.parent.zoom.cy;
5299 // 4. apply matrix to vertices
5300 ec->transform_core.result.matrix = matrix;
5301 ec->transform_core.result.inv_matrix = e_util_transform_matrix_inverse_get(&matrix);
5302 ec->transform_core.result.vertices = e_util_transform_rect_to_vertices(&source_rect);
5303 ec->transform_core.result.boundary.vertices = e_util_transform_rect_to_vertices(&source_rect);
5304 ec->transform_core.result.vertices = e_util_transform_matrix_multiply_rect_vertex(&matrix,
5305 &ec->transform_core.result.vertices);
5306 ec->transform_core.result.boundary.vertices = e_util_transform_matrix_multiply_rect_vertex(&boundary_matrix,
5307 &ec->transform_core.result.boundary.vertices);
5308 ec->transform_core.result.transform.zoom = zoom;
5310 // 5. apply vertices
5311 if (ec->transform_core.result.transform.use_zoom)
5313 // TODO: apply zoom values to vertices
5314 e_comp_object_transform_transp_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.vertices,
5315 ec->transform_core.result.transform.zoom);
5316 e_comp_object_transform_bg_vertices_set_with_zoom(ec->frame, &ec->transform_core.result.boundary.vertices,
5317 ec->transform_core.result.transform.zoom);
5318 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5319 _e_client_transform_core_vertices_apply_with_zoom(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform,
5320 ec->transform_core.result.transform.zoom);
5324 e_comp_object_transform_transp_vertices_set(ec->frame, &ec->transform_core.result.vertices);
5325 e_comp_object_transform_bg_vertices_set(ec->frame, &ec->transform_core.result.boundary.vertices);
5326 _e_client_transform_core_boundary_update(ec, &ec->transform_core.result.boundary.vertices);
5327 _e_client_transform_core_vertices_apply(ec, ec->frame, &ec->transform_core.result.vertices, &ec->transform_core.result.transform);
5330 // 6. subsurface update
5331 _e_client_transform_core_sub_update(ec, &ec->transform_core.result.vertices);
5333 if (!e_object_is_del(E_OBJECT(ec)))
5335 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5336 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5341 if (ec->transform_core.result.enable)
5343 ec->transform_core.result.enable = EINA_FALSE;
5344 _e_client_transform_core_vertices_apply(ec, ec->frame, NULL, NULL);
5345 e_comp_object_transform_bg_set(ec->frame, EINA_FALSE);
5346 ec->transform_core.background = EINA_FALSE;
5347 e_comp_object_transform_transp_set(ec->frame, EINA_FALSE);
5348 _e_client_transform_core_sub_update(ec, NULL);
5350 if (!e_object_is_del(E_OBJECT(ec)))
5352 wl_signal_emit_mutable(&PRI(ec)->events.transform_change, NULL);
5353 _e_client_hook_call(E_CLIENT_HOOK_TRANSFORM_CHANGE, ec);
5358 e_comp_visibility_calculation_set(EINA_TRUE);
5362 e_client_transform_core_transform_count_get(E_Client *ec)
5365 if (!ec->transform_core.transform_list) return 0;
5366 return eina_list_count(ec->transform_core.transform_list);
5369 E_API E_Util_Transform*
5370 e_client_transform_core_transform_get(E_Client *ec, int index)
5372 if (!ec) return NULL;
5373 if (!ec->transform_core.transform_list) return NULL;
5374 if (index < 0 || index >= e_client_transform_core_transform_count_get(ec))
5377 return (E_Util_Transform*)eina_list_nth(ec->transform_core.transform_list, index);
5381 e_client_transform_core_input_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5383 E_Util_Transform_Vertex vertex, result_vertex;
5386 if (!e_client_transform_core_enable_get(ec)) return;
5388 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5390 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.inv_matrix, &vertex);
5391 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5395 e_client_transform_core_input_inv_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5397 E_Util_Transform_Vertex vertex, result_vertex;
5400 if (!e_client_transform_core_enable_get(ec)) return;
5402 e_util_transform_vertex_init(&vertex, x, y, 0.0, 1.0);
5404 result_vertex = e_util_transform_matrix_multiply_vertex(&ec->transform_core.result.matrix, &vertex);
5405 e_util_transform_vertex_pos_round_get(&result_vertex, out_x, out_y, NULL, NULL);
5409 e_client_transform_core_input_inv_rect_transform(E_Client *ec, int x, int y, int *out_x, int *out_y)
5413 if (!e_client_transform_core_enable_get(ec)) return;
5414 e_client_geometry_get(ec, NULL, NULL, &gw, &gh);
5416 e_util_transform_matrix_inv_rect_coords_get(&ec->transform_core.result.transform,
5417 &ec->transform_core.result.vertices,
5419 x, y, out_x, out_y);
5423 e_client_transform_core_direct_render_set(E_Client *ec, Eina_Bool set)
5425 EINA_SAFETY_ON_NULL_RETURN(ec);
5427 if (ec->transform_core.direct_render == set) return;
5429 ec->transform_core.direct_render = set;
5430 ec->transform_core.changed = EINA_TRUE;
5432 e_client_transform_core_update(ec);
5436 e_client_pixmap_change(E_Client *ec, E_Pixmap *newcp)
5438 E_Pixmap_Type oldtype, newtype;
5441 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
5442 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->pixmap, NULL);
5443 EINA_SAFETY_ON_NULL_RETURN_VAL(newcp, NULL);
5447 oldtype = e_pixmap_type_get(oldcp);
5448 if (oldtype >= E_PIXMAP_TYPE_MAX) return NULL;
5450 newtype = e_pixmap_type_get(newcp);
5451 if (newtype >= E_PIXMAP_TYPE_MAX) return NULL;
5453 if (eina_hash_find(clients_hash[oldtype], &oldcp))
5454 eina_hash_del_by_key(clients_hash[oldtype], &oldcp);
5455 e_pixmap_client_set(oldcp, NULL);
5458 e_pixmap_client_set(newcp, ec);
5460 eina_hash_add(clients_hash[newtype], &newcp, ec);
5466 e_client_window_role_set(E_Client *ec, const char *role)
5468 EINA_SAFETY_ON_NULL_RETURN(ec);
5470 if (eina_stringshare_replace(&ec->icccm.window_role, role))
5472 wl_signal_emit_mutable(&PRI(ec)->events.window_role_change, NULL);
5473 _e_client_hook_call(E_CLIENT_HOOK_WINDOW_ROLE_CHANGE, ec);
5478 e_client_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5482 res = e_comp_wl_key_send(ec, keycode, pressed, dev, time);
5488 e_client_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, unsigned int time)
5492 res = e_comp_wl_key_cancel(ec, keycode, dev, time);
5498 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)
5502 res = e_comp_wl_touch_send(ec, idx, x, y, pressed, dev, radius_x, radius_y, pressure, angle, time);
5508 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)
5512 res = e_comp_wl_touch_update_send(ec, idx, x, y, dev, radius_x, radius_y, pressure, angle, time);
5518 e_client_touch_cancel_send(E_Client *ec)
5522 res = e_comp_wl_touch_cancel_send(ec);
5528 e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time)
5532 res = e_comp_wl_mouse_button_send(ec, buttons, pressed, dev, time);
5538 e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5542 res = e_comp_wl_mouse_move_send(ec, x, y, dev, time);
5548 e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time)
5552 res = e_comp_wl_mouse_wheel_send(ec, direction, z, dev, time);
5558 e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
5562 res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
5568 e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
5572 res = e_comp_wl_mouse_out_send(ec, dev, time);
5578 e_client_video_client_has(E_Client *ec)
5580 return e_comp_wl_video_subsurface_has(ec);
5584 e_client_normal_client_has(E_Client *ec)
5586 return e_comp_wl_normal_subsurface_has(ec);
5590 e_client_cursor_hide(E_Client *ec)
5592 return e_comp_wl_cursor_hide(ec);
5596 e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
5600 ELOGF("TZVIS", "VIS_FORCE_OBSCURED :%d", ec, set);
5602 ec->visibility.force_obscured = set;
5603 e_comp_visibility_calculation_set(EINA_TRUE);
5606 EINTERN E_Capture_Save_State
5607 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)
5609 return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
5613 _e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *subc)
5615 E_Client *ec, *parent;
5621 ec->base_output_resolution.use = 0;
5622 ec->base_output_resolution.w = 0;
5623 ec->base_output_resolution.h = 0;
5624 if (ec->base_output_resolution.transform)
5626 e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
5627 E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
5628 ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
5631 /* Update transform for toplevel surface.
5632 * The transform of subsurface will be updated by its parent accordingly. */
5633 parent = e_comp_wl_topmost_parent_get(ec);
5636 parent->transform_core.changed = EINA_TRUE;
5637 e_client_transform_core_update(parent);
5640 /* TODO: Do we need to apply it again if subsurface is destroyed? */
5644 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
5647 ec->base_output_resolution.use = 1;
5648 ec->base_output_resolution.w = width;
5649 ec->base_output_resolution.h = height;
5650 ec->base_output_resolution.transform = e_util_transform_new();
5651 e_util_transform_role_set(ec->base_output_resolution.transform, "base_output_resolution");
5652 e_client_transform_core_add(ec, ec->base_output_resolution.transform);
5654 if (!ec->base_output_resolution.hook_subsurf_create)
5656 ec->base_output_resolution.hook_subsurf_create =
5657 e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
5658 _e_client_base_output_resolution_hook_subsurf_create,
5664 e_client_base_output_resolution_transform_adjust(E_Client *ec)
5668 EINA_SAFETY_ON_NULL_RETURN(ec);
5669 if (!ec->base_output_resolution.use) return;
5670 if (!ec->base_output_resolution.transform) return;
5672 desk = e_comp_desk_find_by_ec(ec);
5673 EINA_SAFETY_ON_NULL_RETURN(desk);
5675 ELOGF("POL_APPINFO", "Apply TRANSFORM... desk:(%dx%d), ec:(%dx%d)",
5676 ec, desk->geom.w, desk->geom.h, ec->w, ec->h);
5678 e_util_transform_scale(ec->base_output_resolution.transform,
5679 (double)desk->geom.w /(double)ec->base_output_resolution.w,
5680 (double)desk->geom.h /(double)ec->base_output_resolution.h,
5682 e_client_transform_core_update(ec);
5686 e_client_base_output_resolution_update(E_Client *ec)
5688 E_Appinfo *eai = NULL;
5689 int configured_width, configured_height;
5693 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
5695 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5696 if (ec->base_output_resolution.use) return EINA_TRUE;
5698 /* Check whether it's subsurface or not
5699 * The resolution of subsurface will follow the resolution of its toplevel surface.
5700 * Transform for subsurface will be applied when toplevel surface does by
5701 * implementation of e_client_transform_core.
5703 if (e_comp_wl_subsurface_check(ec))
5706 desk = e_comp_desk_find_by_ec(ec);
5707 EINA_SAFETY_ON_NULL_RETURN_VAL(desk, EINA_FALSE);
5709 configured_width = e_config->configured_output_resolution.w;
5710 configured_height = e_config->configured_output_resolution.h;
5714 ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec,
5715 configured_width, configured_height, ec->netwm.pid);
5716 goto use_configured;
5719 eai = e_appinfo_find_with_pid(ec->netwm.pid);
5722 ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec,
5723 configured_width, configured_height, ec->netwm.pid);
5724 goto use_configured;
5727 if (!e_appinfo_base_output_resolution_available_get(eai))
5729 ELOGF("POL_APPINFO", "NO AVAILABLE BASE SCREEN RESOLUTION... QUERY base_output_resolution", ec);
5730 e_policy_base_output_resolution_info_update(ec->netwm.pid);
5733 if (!e_appinfo_base_output_resolution_get(eai, &width, &height))
5735 ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec,
5736 configured_width, configured_height, ec->netwm.pid);
5737 goto use_configured;
5740 if ((width == 0) && (height == 0))
5742 ELOGF("POL_APPINFO", "SKIP SET BASE SCREEN RESOLUTION... base_output_resolution size:(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5746 if ((desk->geom.w == width) && (desk->geom.h == height))
5748 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);
5752 /* set the base_output_resolution of the e_client */
5753 _e_client_base_output_resolution_set(ec, width, height);
5755 ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec, width, height, ec->netwm.pid);
5761 if ((desk->geom.w == configured_width) && (desk->geom.h == configured_height))
5763 ELOGF("POL_APPINFO", "SKIP use configured_output_resolution (same with desk size:(%d,%d), pid:%d)", ec, configured_width, configured_height, ec->netwm.pid);
5767 /* set the base_output_resolution of the e_client as a default */
5768 _e_client_base_output_resolution_set(ec, configured_width, configured_height);
5775 e_client_base_output_resolution_useful_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5780 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5782 zone = e_comp_zone_find_by_ec(ec);
5783 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5785 e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
5792 if (ec->base_output_resolution.use)
5794 if (w) *w = ec->base_output_resolution.w;
5795 if (h) *h = ec->base_output_resolution.h;
5802 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)
5807 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
5809 zone = e_comp_zone_find_by_ec(ec);
5810 EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
5812 e_zone_desk_useful_geometry_get(zone, ec->desk, &zx, &zy, &zw, &zh, consider_obstacle_area);
5819 if (ec->base_output_resolution.use)
5821 // TODO: Consider obstacle area
5822 if (w) *w = ec->base_output_resolution.w;
5823 if (h) *h = ec->base_output_resolution.h;
5829 /* change the base_output_resolution of the bind_ec by checking the base_output_resolution of provider_ec's appinfo */
5831 e_client_base_output_resolution_rsm_update(E_Client *bind_ec, E_Client *provider_ec)
5833 E_Appinfo *epai = NULL;
5834 int configured_width, configured_height;
5836 E_Desk *bind_ec_desk;
5838 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec, EINA_FALSE);
5839 EINA_SAFETY_ON_NULL_RETURN_VAL(provider_ec, EINA_FALSE);
5841 bind_ec_desk = e_comp_desk_find_by_ec(bind_ec);
5842 EINA_SAFETY_ON_NULL_RETURN_VAL(bind_ec_desk, EINA_FALSE);
5844 if (!e_config->configured_output_resolution.use) return EINA_TRUE;
5846 configured_width = e_config->configured_output_resolution.w;
5847 configured_height = e_config->configured_output_resolution.h;
5849 if (bind_ec->base_output_resolution.use)
5851 ELOGF("POL_APPINFO", "DELETE EXISTED BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5852 bind_ec->base_output_resolution.w, bind_ec->base_output_resolution.h, bind_ec->netwm.pid);
5854 bind_ec->base_output_resolution.use = 0;
5855 bind_ec->base_output_resolution.w = 0;
5856 bind_ec->base_output_resolution.h = 0;
5857 e_client_transform_core_remove(bind_ec, bind_ec->base_output_resolution.transform);
5858 E_FREE_FUNC(bind_ec->base_output_resolution.transform, e_util_transform_del);
5861 if (!provider_ec->netwm.pid)
5863 ELOGF("POL_APPINFO", "NO PROVIDER PID... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5864 configured_width, configured_height, provider_ec->netwm.pid);
5865 goto use_configured;
5868 epai = e_appinfo_find_with_pid(provider_ec->netwm.pid);
5871 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5872 configured_width, configured_height, provider_ec->netwm.pid);
5873 goto use_configured;
5876 if (!e_appinfo_base_output_resolution_get(epai, &width, &height))
5878 ELOGF("POL_APPINFO", "NO PROVIDER APPINFO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) provider_pid:%d", provider_ec,
5879 configured_width, configured_height, provider_ec->netwm.pid);
5880 goto use_configured;
5883 if ((width == 0) && (height == 0))
5885 ELOGF("POL_APPINFO", "NO PROVIDER WIDTH and HEIGHT... SKIP base_output_resolution due to size:(%d,%d) provider_pid:%d", provider_ec,
5886 width, height, provider_ec->netwm.pid);
5890 if ((bind_ec_desk->geom.w == width) && (bind_ec_desk->geom.h == height))
5892 ELOGF("POL_APPINFO", "SKIP SET BINDER BASE SCREEN RESOLUTION... base_output_resolution is same with desk size:(%d,%d), bind_pid:%d", bind_ec,
5893 width, height, bind_ec->netwm.pid);
5897 /* set the base_output_resolution of the e_client */
5898 _e_client_base_output_resolution_set(bind_ec, width, height);
5899 e_client_base_output_resolution_transform_adjust(bind_ec);
5901 ELOGF("POL_APPINFO", "USE BINDER base_output_resolution(%d,%d) bind_pid:%d", bind_ec, width, height, bind_ec->netwm.pid);
5907 if ((bind_ec_desk->geom.w == configured_width) && (bind_ec_desk->geom.h == configured_height))
5909 ELOGF("POL_APPINFO", "SKIP BINDER use configured_output_resolution (same with desk size:(%d,%d), bind_pid:%d)", bind_ec,
5910 configured_width, configured_height, bind_ec->netwm.pid);
5914 /* set the base_output_resolution of the e_client as a default */
5915 _e_client_base_output_resolution_set(bind_ec, configured_width, configured_height);
5921 /* tizen_move_resize */
5923 e_client_pending_geometry_has(E_Client *ec)
5925 if (!eina_list_count(ec->surface_sync.pending_geometry))
5928 return ec->surface_sync.wait_commit;
5932 e_client_pending_geometry_flush(E_Client *ec)
5934 E_Client_Pending_Geometry *geo;
5936 if (!eina_list_count(ec->surface_sync.pending_geometry))
5938 EINA_LIST_FREE(ec->surface_sync.pending_geometry, geo)
5942 ec->surface_sync.wait_commit = EINA_FALSE;
5943 ELOGF("POSSIZE", "pending geometry has flushed", ec);
5948 e_client_pending_geometry_last_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
5951 E_Client_Pending_Geometry *geo;
5957 EINA_LIST_REVERSE_FOREACH(ec->surface_sync.pending_geometry, l, geo)
5973 e_client_frame_focus_set(E_Client *ec, Eina_Bool focus)
5976 evas_object_focus_set(ec->frame, focus);
5980 e_client_frame_geometry_set(E_Client *ec, int x, int y, int w, int h)
5984 if (ec->internal || ec->input_only)
5986 evas_object_geometry_set(ec->frame, x, y, w, h);
5990 if ((ec->w != w) || (ec->h != h))
5992 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);
5993 ec->move_after_resize = EINA_TRUE;
5995 e_client_pos_set(ec, x, y);
5996 evas_object_resize(ec->frame, w, h);
5999 evas_object_geometry_set(ec->frame, x, y, w, h);
6004 e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
6008 if (ec->internal || ec->input_only)
6010 e_client_util_move_without_frame(ec, x, y);
6011 e_client_util_resize_without_frame(ec, w, h);
6015 if ((ec->w != w) || (ec->h != h))
6017 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);
6018 ec->move_after_resize = EINA_TRUE;
6020 e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
6021 e_client_pos_set(ec, x, y);
6022 e_client_util_resize_without_frame(ec, w, h);
6026 e_client_util_move_without_frame(ec, x, y);
6027 e_client_util_resize_without_frame(ec, w, h);
6033 e_client_layer_set(E_Client *ec,
6036 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6037 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6038 if (!ec->frame) return EINA_FALSE;
6040 if (e_comp_canvas_client_layer_map(layer) == 9999)
6041 return EINA_FALSE; //invalid layer is not allowed
6043 #ifdef REFACTOR_DESK_AREA
6045 if (ec->desk_area.enable)
6047 if (e_client_layer_set_by_desk_area(ec, layer))
6049 // restack according to desk group rule
6050 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6054 ec->desk_area.layer_backup = layer;
6057 evas_object_layer_set(ec->frame, layer);
6058 if (ec->layer != layer)
6060 /* check exceptional case */
6061 if ((ec->fullscreen) &&
6062 (ec->saved.layer != layer))
6064 ELOGF("LAYER", "(%d) fail to backup at saved.layer for fullscreen", ec, layer);
6067 // if e_comp_object fail to change ec->layer due to ec->layer_pending or block
6068 // leave log and apply ec->layer according to set
6069 // as a result it restores back to given layer when pending or block is free
6070 ELOGF("LAYER", "change layer from %d to %d if in case layer pending(%d) or block(%d)",
6071 ec, ec->layer, layer, ec->layer_pending, ec->layer_block);
6072 if (ec->layer_pending || ec->layer_block)
6079 wl_signal_emit_mutable(&PRI(ec)->events.set_layer, NULL);
6085 e_client_layer_get(E_Client *ec)
6089 E_OBJECT_CHECK_RETURN(ec, E_LAYER_BOTTOM);
6090 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, E_LAYER_BOTTOM);
6091 if (!ec->frame) return E_LAYER_BOTTOM;
6093 layer = evas_object_layer_get(ec->frame);
6094 if (ec->layer != layer)
6096 /* client could be on temperory layer while pending or block,
6097 * in that case, client restores back to ec->layer after pending/block finish */
6098 if (ec->layer_block || ec->layer_pending)
6101 /* otherwise, client is on unexpected layer */
6102 ELOGF("LAYER", "layer dismatch ec->layer %d | evas obj layer %d ",
6103 ec, ec->layer, layer);
6105 if (e_comp_canvas_client_layer_map(layer) == 9999)
6106 return E_LAYER_BOTTOM; //not on E_LAYER_CLIENT
6112 #ifdef REFACTOR_DESK_AREA
6115 _e_client_desk_area_original_layer_save(E_Client *ec, E_Layer layer)
6118 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
6119 ec->desk_area.layer_backup = layer;
6123 e_client_layer_set_by_desk_area(E_Client *ec, E_Layer layer)
6129 if (!ec) return EINA_FALSE;
6130 if (!ec->frame) return EINA_FALSE;
6131 if (!ec->desk_area.enable) return EINA_FALSE;
6132 if (!ec->desk_area.desk_area) return EINA_FALSE;
6134 eda = ec->desk_area.desk_area;
6136 // save original layer
6137 _e_client_desk_area_original_layer_save(ec, layer);
6139 // get desk_area layer
6140 edg_layer = (E_Layer)e_desk_area_layer_get(eda);
6141 org_layer = e_client_desk_area_original_layer_get(ec);
6143 ELOGF("EDG", "layer_set by desk_area... layer:%d, org_layer:%d, new_layer:%d", ec, layer, org_layer, edg_layer);
6144 if (org_layer == edg_layer)
6150 evas_object_layer_set(ec->frame, edg_layer);
6151 if (edg_layer == ec->layer)
6159 e_client_desk_area_original_layer_restore(E_Client *ec)
6163 // Do we need to check ec->desk_area.enable?
6164 // if ec->desk_area.enable is true, then e_client_layer_set calls
6165 // e_desk_area_ec_edg_layer_set(). that's too bad. :(
6166 // so, we MUST make a policy for ordering of the desk group layer restore
6167 // and the desk group enable.
6168 if (ec->desk_area.enable) return;
6169 e_client_layer_set(ec, ec->desk_area.layer_backup);
6173 e_client_desk_area_original_layer_get(E_Client *ec)
6175 if (!ec) return E_LAYER_DESKTOP;
6177 if (ec->desk_area.enable)
6178 return ec->desk_area.layer_backup;
6184 e_client_desk_area_client_layer_set(E_Client *ec, E_Desk_Area_Client_Layer edgc_layer)
6186 E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
6187 E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
6188 if ((edgc_layer < E_DESK_AREA_CLIENT_LAYER_DESKTOP) ||
6189 (edgc_layer >= E_DESK_AREA_CLIENT_LAYER_MAX))
6192 ec->desk_area.edgc_layer = edgc_layer;
6196 EINTERN E_Desk_Area_Client_Layer
6197 e_client_desk_area_client_layer_get(E_Client *ec)
6199 E_OBJECT_CHECK_RETURN(ec, E_DESK_AREA_CLIENT_LAYER_DESKTOP);
6201 return ec->desk_area.edgc_layer;
6204 //FIXME: use e_desk_area_ec_reassign(eda, ec) instead of this api
6206 e_client_desk_area_set(E_Client *ec, E_Desk_Area *eda)
6208 E_Desk_Area *old_edg;
6210 if (!ec) return EINA_FALSE;
6212 #if 0 // if this is removed.. then below if (eda != old_edg) is removed also...
6213 if (ec->desk_area.desk_area == eda)
6217 ELOGF("EDG", "Desk Group Set (new:%p, old:%p)", ec, eda, ec->desk_area.desk_area);
6218 old_edg = ec->desk_area.desk_area;
6220 e_desk_area_ec_remove(old_edg, ec);
6222 ec->desk_area.desk_area = eda;
6223 e_desk_area_ec_add(eda, ec);
6225 #if 0 // if this is removed.. then above if (ec->desk_area.desk_area == eda) is removed also...
6229 e_desk_area_ec_update(eda, ec);
6230 e_desk_area_ec_rearrange(ec->desk_area.desk_area, ec);
6238 _raise_between_sibling_under_parent(E_Client *ec)
6240 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);
6241 e_client_stack_below(ec, ec->parent);
6245 _raise_between_sibling_on_parent(E_Client *ec)
6247 E_Client *top_child = NULL;
6248 top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
6251 ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
6252 e_client_stack_above(ec, ec->parent);
6256 if (top_child != ec)
6258 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);
6259 e_client_stack_above(ec, top_child);
6262 ELOGF("POL", "RAISE child window between sibling... already on the top. STAY", ec);
6267 _raise_belong_to_parent(E_Client *ec)
6269 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6270 _raise_between_sibling_under_parent(ec);
6272 _raise_between_sibling_on_parent(ec);
6276 e_client_raise(E_Client *ec)
6280 #ifdef REFACTOR_DESK_AREA
6282 if (ec->desk_area.enable)
6285 eda = ec->desk_area.desk_area;
6288 e_desk_area_ec_raise(eda, ec);
6294 if (ec->parent && e_client_is_belong_to_parent(ec))
6295 _raise_belong_to_parent(ec);
6297 evas_object_raise(ec->frame);
6299 wl_signal_emit_mutable(&PRI(ec)->events.raise, NULL);
6303 _e_client_transient_for_below_group_make(E_Client *ec, Eina_List **list)
6305 // list : Head is the bottommost child
6311 EINA_LIST_REVERSE_FOREACH(ec->transients, l, child)
6313 if (!child) continue;
6314 if (e_client_transient_policy_get(child) != E_TRANSIENT_BELOW) continue;
6315 if (!e_client_is_belong_to_parent(child)) continue;
6317 *list = eina_list_prepend(*list, child);
6318 _e_client_transient_for_group_make(child, list);
6323 e_client_transient_child_bottom_get(E_Client *ec)
6325 E_Client *bottom_ec = NULL;
6326 Eina_List *transient_below_list = NULL;
6327 Eina_List *l = NULL;
6329 _e_client_transient_for_below_group_make(ec, &transient_below_list);
6331 if (transient_below_list)
6333 E_Client *temp_ec = NULL;
6334 E_Client *temp_ec2 = NULL;
6336 E_CLIENT_FOREACH(temp_ec)
6338 if (bottom_ec) break;
6346 EINA_LIST_FOREACH(transient_below_list, l, temp_ec2)
6348 if (temp_ec == temp_ec2)
6350 bottom_ec = temp_ec2;
6355 eina_list_free(transient_below_list);
6361 _lower_between_sibling_under_parent(E_Client *ec)
6363 E_Client *bottom_child = NULL;
6364 bottom_child = e_client_transient_child_bottom_get(ec->parent);
6367 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);
6368 e_client_stack_below(ec, ec->parent);
6372 if (bottom_child != ec)
6374 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);
6375 e_client_stack_below(ec, bottom_child);
6378 ELOGF("POL", "LOWER child window between sibling... already under the bottom. STAY", ec);
6383 _lower_between_sibling_on_parent(E_Client *ec)
6385 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);
6386 e_client_stack_above(ec, ec->parent);
6390 _lower_belong_to_parent(E_Client *ec)
6392 if (e_client_transient_policy_get(ec) == E_TRANSIENT_BELOW)
6393 _lower_between_sibling_under_parent(ec);
6395 _lower_between_sibling_on_parent(ec);
6399 e_client_lower(E_Client *ec)
6403 #ifdef REFACTOR_DESK_AREA
6405 if (ec->desk_area.enable)
6408 eda = ec->desk_area.desk_area;
6411 e_desk_area_ec_lower(eda, ec);
6413 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6419 if (ec->parent && e_client_is_belong_to_parent(ec))
6420 _lower_belong_to_parent(ec);
6422 evas_object_lower(ec->frame);
6424 wl_signal_emit_mutable(&PRI(ec)->events.lower, NULL);
6428 e_client_stack_above(E_Client *ec, E_Client *above)
6431 if (!ec->frame) return;
6433 if (!above->frame) return;
6435 #ifdef REFACTOR_DESK_AREA
6437 if (ec->desk_area.enable)
6440 eda = ec->desk_area.desk_area;
6443 e_desk_area_ec_stack_above(eda, ec, above);
6449 evas_object_stack_above(ec->frame, above->frame);
6451 wl_signal_emit_mutable(&PRI(ec)->events.stack_above, NULL);
6455 e_client_stack_below(E_Client *ec, E_Client *below)
6458 if (!ec->frame) return;
6460 if (!below->frame) return;
6462 #ifdef REFACTOR_DESK_AREA
6464 if (ec->desk_area.enable)
6467 eda = ec->desk_area.desk_area;
6470 e_desk_area_ec_stack_below(eda, ec, below);
6476 evas_object_stack_below(ec->frame, below->frame);
6478 wl_signal_emit_mutable(&PRI(ec)->events.stack_below, NULL);
6482 e_client_show_pending_set(E_Client *ec)
6486 ec->show_pending.count++;
6487 ELOGF("E_CLIENT", "SET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6488 return ec->show_pending.count;
6492 e_client_show_pending_unset(E_Client *ec)
6495 if (ec->show_pending.count <= 0) return 0;
6497 ec->show_pending.count--;
6498 ELOGF("E_CLIENT", "UNSET show_pending. (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
6499 if (ec->show_pending.count == 0 && ec->show_pending.running)
6501 ec->show_pending.running = EINA_FALSE;
6504 ELOGF("E_CLIENT", "evas_object_show by unset show_pending", ec);
6505 evas_object_show(ec->frame);
6506 //e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
6511 return ec->show_pending.count;
6515 _e_client_surface_tree_foreach_helper(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6519 Eina_Bool res = EINA_TRUE;
6520 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
6525 EINA_LIST_FOREACH_SAFE(cdata->sub.below_list, l, ll, subc)
6527 res = _e_client_surface_tree_foreach_helper(subc, func, data);
6534 res = func(data, ec);
6537 EINA_LIST_FOREACH_SAFE(cdata->sub.list, l, ll, subc)
6539 res = _e_client_surface_tree_foreach_helper(subc,
6552 e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data)
6554 EINA_SAFETY_ON_NULL_RETURN(ec);
6555 EINA_SAFETY_ON_NULL_RETURN(func);
6557 _e_client_surface_tree_foreach_helper(ec, func, data);
6560 EINTERN E_Comp_Wl_Client_Data *
6561 e_client_cdata_new(E_Client *ec)
6563 E_Comp_Wl_Client_Data *cdata;
6565 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6567 if (!(cdata = E_NEW(E_Comp_Wl_Client_Data, 1)))
6569 ERR("Could not allocate new E_Comp_Wl_Client_Data structure");
6572 ec->comp_data = cdata;
6578 e_client_cdata_free(E_Client *ec)
6580 EINA_SAFETY_ON_NULL_RETURN(ec);
6581 if (!ec->comp_data) return;
6583 E_FREE(ec->comp_data);
6586 EINTERN E_Comp_Wl_Client_Data *
6587 e_client_cdata_get(E_Client *ec)
6589 if (!ec) return NULL;
6591 return ec->comp_data;
6595 e_client_map_set(E_Client *ec, E_Map *em)
6597 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6599 return e_map_set_to_comp_object(em, ec->frame);
6603 e_client_map_get(const E_Client *ec)
6605 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
6607 return e_map_get_from_comp_object(ec->frame);
6611 e_client_map_enable_set(E_Client *ec, Eina_Bool enable)
6613 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6614 EINA_SAFETY_ON_NULL_RETURN_VAL(ec->frame, EINA_FALSE);
6616 evas_object_map_enable_set(ec->frame, enable);
6622 e_client_belong_to_parent_set(E_Client *ec, Eina_Bool set)
6625 ec->belong_to_parent = set;
6629 e_client_is_belong_to_parent(E_Client *ec)
6631 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6632 return ec->belong_to_parent;
6636 e_client_transient_policy_set(E_Client *ec, E_Transient policy)
6639 ec->transient_policy = policy;
6643 e_client_transient_policy_get(E_Client *ec)
6645 if (!ec) return E_TRANSIENT_ABOVE;
6646 return ec->transient_policy;
6650 e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb)
6652 if (_e_client_resize_object_create_cb && cb)
6653 CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT RESIZE OBJECT CREATE HOOK!!!");
6654 _e_client_resize_object_create_cb = cb;
6658 e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
6662 // FYI, we consider 0 and 1 to be the same value as a default unit size.
6663 ec->manage_resize.unit_size = unit_size;
6667 e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
6670 ec->desk_zoom.enable = enable;
6674 e_client_desk_zoom_enable_get(E_Client *ec)
6676 if (!ec) return EINA_FALSE;
6677 return ec->desk_zoom.enable;
6681 e_client_layout_apply(E_Client *ec, Eina_Bool apply)
6684 ec->apply_layout = apply;
6688 e_client_is_layout_apply(E_Client *ec)
6690 if (!ec) return EINA_FALSE;
6691 return ec->apply_layout;
6695 e_client_from_surface_resource(struct wl_resource *surface_resource)
6697 EINA_SAFETY_ON_NULL_RETURN_VAL(surface_resource, NULL);
6699 return e_comp_wl_util_client_from_surface_resource(surface_resource);
6703 e_client_fps_update(E_Client *ec)
6708 EINA_SAFETY_ON_NULL_RETURN(ec);
6710 if (!ec->fps.enabled) return;
6712 tim = ecore_time_get();
6714 dt = tim - ec->fps.frametimes[0];
6716 ec->fps.frametimes[0] = tim;
6720 if (ec->fps.lapse == 0.0)
6722 ec->fps.lapse = tim;
6723 ec->fps.flapse = ec->fps.cframes;
6725 else if ((tim - ec->fps.lapse) >= 0.5)
6727 ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
6728 (tim - ec->fps.lapse);
6729 ec->fps.lapse = tim;
6730 ec->fps.flapse = ec->fps.cframes;
6736 e_client_fps_get(E_Client *ec, double *fps)
6738 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6740 if (ec->fps.old_fps == ec->fps.fps)
6743 if (ec->fps.fps > 0.0)
6746 ec->fps.old_fps = ec->fps.fps;
6754 e_client_fps_enable(E_Client *ec, Eina_Bool enable)
6756 EINA_SAFETY_ON_NULL_RETURN(ec);
6758 ec->fps.enabled = enable;
6762 e_client_explicit_sync_get(E_Client *ec)
6764 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6766 return ec->explicit_sync;
6770 e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable)
6772 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6774 ec->explicit_sync = enable;
6780 e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec)
6782 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, -1);
6784 return ec->acquire_fence_fd;
6788 e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd)
6790 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
6792 ec->acquire_fence_fd = fd;
6798 e_client_intercept_hook_auto_placement_call(E_Client *ec)
6800 // no need to call the intercept hook if ec is NULL.
6801 if (!ec) return EINA_FALSE;
6803 if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT, ec))
6805 ELOGF("FOCUS", "E_CLIENT_INTERCEPT_HOOK_AUTO_PLACEMENT Intercepted.", ec);
6813 e_client_iconify_event_send(E_Client *ec)
6815 EINA_SAFETY_ON_NULL_RETURN(ec);
6817 _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
6821 e_client_uniconify_event_send(E_Client *ec)
6823 EINA_SAFETY_ON_NULL_RETURN(ec);
6825 _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
6829 e_client_stack_transient_for_done_notify(E_Client *ec)
6831 EINA_SAFETY_ON_NULL_RETURN(ec);
6833 wl_signal_emit_mutable(&PRI(ec)->events.stack_transient_for_done, NULL);
6836 #ifdef REFACTOR_DESK_AREA
6838 e_client_subsurface_stack_update(E_Client *ec)
6840 EINA_SAFETY_ON_NULL_RETURN(ec);
6842 wl_signal_emit_mutable(&PRI(ec)->events.subsurface_stack_update, ec);
6847 e_client_eval_pre_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6850 wl_signal_add(&priv->events.eval_pre_fetch, listener);
6854 e_client_eval_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6857 wl_signal_add(&priv->events.eval_fetch, listener);
6861 e_client_eval_pre_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6864 wl_signal_add(&priv->events.eval_pre_post_fetch, listener);
6868 e_client_eval_post_fetch_listener_add(E_Client *ec, struct wl_listener *listener)
6871 wl_signal_add(&priv->events.eval_post_fetch, listener);
6875 e_client_eval_pre_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6878 wl_signal_add(&priv->events.eval_pre_frame_assign, listener);
6882 e_client_eval_post_frame_assign_listener_add(E_Client *ec, struct wl_listener *listener)
6885 wl_signal_add(&priv->events.eval_post_frame_assign, listener);
6889 e_client_eval_pre_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6892 wl_signal_add(&priv->events.eval_pre_new_client, listener);
6896 e_client_eval_post_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6899 wl_signal_add(&priv->events.eval_post_new_client, listener);
6903 e_client_eval_visibility_listener_add(E_Client *ec, struct wl_listener *listener)
6906 wl_signal_add(&priv->events.eval_visibility, listener);
6910 e_client_eval_visibility_end_listener_add(E_Client *ec, struct wl_listener *listener)
6913 wl_signal_add(&priv->events.eval_visibility_end, listener);
6917 e_client_eval_end_listener_add(E_Client *ec, struct wl_listener *listener)
6920 wl_signal_add(&priv->events.eval_end, listener);
6924 e_client_move_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6927 wl_signal_add(&priv->events.move_begin, listener);
6931 e_client_move_update_listener_add(E_Client *ec, struct wl_listener *listener)
6934 wl_signal_add(&priv->events.move_update, listener);
6938 e_client_move_end_listener_add(E_Client *ec, struct wl_listener *listener)
6941 wl_signal_add(&priv->events.move_end, listener);
6945 e_client_move_resize_begin_listener_add(E_Client *ec, struct wl_listener *listener)
6948 wl_signal_add(&priv->events.move_resize_begin, listener);
6952 e_client_move_resize_update_listener_add(E_Client *ec, struct wl_listener *listener)
6955 wl_signal_add(&priv->events.move_resize_update, listener);
6959 e_client_move_resize_end_listener_add(E_Client *ec, struct wl_listener *listener)
6962 wl_signal_add(&priv->events.move_resize_end, listener);
6966 e_client_destroy_listener_add(E_Client *ec, struct wl_listener *listener)
6969 wl_signal_add(&priv->events.destroy, listener);
6973 e_client_new_client_listener_add(E_Client *ec, struct wl_listener *listener)
6976 wl_signal_add(&priv->events.new_client, listener);
6980 e_client_new_client_post_listener_add(E_Client *ec, struct wl_listener *listener)
6983 wl_signal_add(&priv->events.new_client_post, listener);
6987 e_client_unredirect_listener_add(E_Client *ec, struct wl_listener *listener)
6990 wl_signal_add(&priv->events.unredirect, listener);
6994 e_client_redirect_listener_add(E_Client *ec, struct wl_listener *listener)
6997 wl_signal_add(&priv->events.redirect, listener);
7001 e_client_aux_hint_change_listener_add(E_Client *ec, struct wl_listener *listener)
7004 wl_signal_add(&priv->events.aux_hint_change, listener);
7008 e_client_window_role_change_listener_add(E_Client *ec, struct wl_listener *listener)
7011 wl_signal_add(&priv->events.window_role_change, listener);
7015 e_client_transform_change_listener_add(E_Client *ec, struct wl_listener *listener)
7018 wl_signal_add(&priv->events.transform_change, listener);
7022 e_client_activate_done_listener_add(E_Client *ec, struct wl_listener *listener)
7025 wl_signal_add(&priv->events.activate_done, listener);
7029 e_client_mouse_in_listener_add(E_Client *ec, struct wl_listener *listener)
7032 wl_signal_add(&priv->events.mouse_in, listener);
7036 e_client_mouse_out_listener_add(E_Client *ec, struct wl_listener *listener)
7039 wl_signal_add(&priv->events.mouse_out, listener);
7043 e_client_mouse_down_listener_add(E_Client *ec, struct wl_listener *listener)
7046 wl_signal_add(&priv->events.mouse_down, listener);
7050 e_client_focus_set_listener_add(E_Client *ec, struct wl_listener *listener)
7053 wl_signal_add(&priv->events.focus_set, listener);
7057 e_client_focus_unset_listener_add(E_Client *ec, struct wl_listener *listener)
7060 wl_signal_add(&priv->events.focus_unset, listener);
7064 e_client_focus_defer_set_listener_add(E_Client *ec, struct wl_listener *listener)
7067 wl_signal_add(&priv->events.focus_defer_set, listener);
7071 e_client_focus_latest_set_listener_add(E_Client *ec, struct wl_listener *listener)
7074 wl_signal_add(&priv->events.focus_latest_set, listener);
7078 e_client_iconify_listener_add(E_Client *ec, struct wl_listener *listener)
7081 wl_signal_add(&priv->events.iconify, listener);
7085 e_client_uniconify_listener_add(E_Client *ec, struct wl_listener *listener)
7088 wl_signal_add(&priv->events.uniconify, listener);
7092 e_client_maximize_listener_add(E_Client *ec, struct wl_listener *listener)
7095 wl_signal_add(&priv->events.maximize, listener);
7099 e_client_unmaximize_listener_add(E_Client *ec, struct wl_listener *listener)
7102 wl_signal_add(&priv->events.unmaximize, listener);
7106 e_client_fullscreen_pre_listener_add(E_Client *ec, struct wl_listener *listener)
7109 wl_signal_add(&priv->events.fullscreen_pre, listener);
7113 e_client_fullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7116 wl_signal_add(&priv->events.fullscreen, listener);
7120 e_client_unfullscreen_listener_add(E_Client *ec, struct wl_listener *listener)
7123 wl_signal_add(&priv->events.unfullscreen, listener);
7127 e_client_move_listener_add(E_Client *ec, struct wl_listener *listener)
7130 wl_signal_add(&priv->events.move, listener);
7134 e_client_raise_listener_add(E_Client *ec, struct wl_listener *listener)
7137 wl_signal_add(&priv->events.raise, listener);
7141 e_client_lower_listener_add(E_Client *ec, struct wl_listener *listener)
7144 wl_signal_add(&priv->events.lower, listener);
7148 e_client_stack_below_listener_add(E_Client *ec, struct wl_listener *listener)
7151 wl_signal_add(&priv->events.stack_below, listener);
7155 e_client_stack_above_listener_add(E_Client *ec, struct wl_listener *listener)
7158 wl_signal_add(&priv->events.stack_above, listener);
7162 e_client_set_layer_listener_add(E_Client *ec, struct wl_listener *listener)
7165 wl_signal_add(&priv->events.set_layer, listener);
7169 e_client_stack_transient_for_done_listener_add(E_Client *ec, struct wl_listener *listener)
7172 wl_signal_add(&priv->events.stack_transient_for_done, listener);
7176 e_client_stick_listener_add(E_Client *ec, struct wl_listener *listener)
7179 wl_signal_add(&priv->events.stick, listener);
7183 e_client_unstick_listener_add(E_Client *ec, struct wl_listener *listener)
7186 wl_signal_add(&priv->events.unstick, listener);
7189 EINTERN struct wl_listener *
7190 e_client_destroy_listener_get(E_Client *ec, wl_notify_func_t notify)
7192 API_ENTRY_VAL(NULL);
7193 return wl_signal_get(&priv->events.destroy, notify);
7196 #ifdef REFACTOR_DESK_AREA
7198 e_client_get_above_listener_add(E_Client *ec, struct wl_listener *listener)
7201 wl_signal_add(&priv->events.get_above, listener);
7205 e_client_get_below_listener_add(E_Client *ec, struct wl_listener *listener)
7208 wl_signal_add(&priv->events.get_below, listener);
7212 e_client_get_visible_below_listener_add(E_Client *ec, struct wl_listener *listener)
7215 wl_signal_add(&priv->events.get_visible_below, listener);
7219 e_client_subsurface_stack_update_listener_add(E_Client *ec, struct wl_listener *listener)
7222 wl_signal_add(&priv->events.subsurface_stack_update, listener);
7227 e_client_shell_configure_send(E_Client *ec, uint32_t edges, int32_t width, int32_t height)
7229 EINA_SAFETY_ON_NULL_RETURN(ec);
7230 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7232 if ((!ec->comp_data->shell.surface) ||
7233 (!ec->comp_data->shell.configure_send))
7236 ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, edges, width, height);
7240 e_client_shell_configure(E_Client *ec, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
7242 EINA_SAFETY_ON_NULL_RETURN(ec);
7243 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7245 if ((!ec->comp_data->shell.surface) ||
7246 (!ec->comp_data->shell.configure))
7249 ec->comp_data->shell.configure(ec->comp_data->shell.surface, x, y, width, height);
7253 e_client_shell_ping(E_Client *ec)
7255 EINA_SAFETY_ON_NULL_RETURN(ec);
7256 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7258 if ((!ec->comp_data->shell.surface) ||
7259 (!ec->comp_data->shell.ping))
7262 ec->comp_data->shell.ping(ec->comp_data->shell.surface);
7266 _e_client_shell_map(E_Client *ec)
7268 EINA_SAFETY_ON_NULL_RETURN(ec);
7269 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7271 if ((!ec->comp_data->shell.surface) ||
7272 (!ec->comp_data->shell.map))
7275 ec->comp_data->shell.map(ec->comp_data->shell.surface);
7279 e_client_shell_unmap(E_Client *ec)
7281 EINA_SAFETY_ON_NULL_RETURN(ec);
7282 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7284 if ((!ec->comp_data->shell.surface) ||
7285 (!ec->comp_data->shell.unmap))
7288 ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
7292 e_client_show(E_Client *ec)
7294 EINA_SAFETY_ON_NULL_RETURN(ec);
7295 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7297 if (ec->comp_data->mapped)
7300 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.map) &&
7303 ELOGF("E_CLIENT", "Map.", ec);
7304 _e_client_shell_map(ec);
7306 else if (ec->internal || e_comp_wl_subsurface_can_show(ec) ||
7307 (ec == e_comp_wl->drag_client))
7309 ELOGF("E_CLIENT", "Map. internal:%d, drag:%d",
7310 ec, ec->internal, (ec == e_comp_wl->drag_client));
7311 ec->visible = EINA_TRUE;
7313 evas_object_show(ec->frame);
7314 ec->comp_data->mapped = 1;
7319 e_client_hide(E_Client *ec)
7323 EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
7325 if (!ec->comp_data->mapped)
7328 if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap))
7330 ELOGF("E_CLIENT", "Unmap", ec);
7332 if (priv->hide_by_request)
7333 ELOGF("COMP", "Currenlty hide_by_request state.", ec);
7335 if (ec->show_pending.count > 0)
7337 ELOGF("E_CLIENT", "Reset show_pending!!! (count:%d, run:%d)", ec, ec->show_pending.count, ec->show_pending.running);
7338 ec->show_pending.count = 0;
7339 if (ec->show_pending.running)
7341 // need to send visibility false;
7342 ec->visibility.obscured = E_VISIBILITY_UNOBSCURED;
7343 ELOGF("POL_VIS", "CLIENT VIS ON (fake). argb:%d, opaque:%2d", ec, ec->argb, ec->visibility.opaque);
7346 ec->show_pending.running = EINA_FALSE;
7348 e_client_shell_unmap(ec);
7350 else if ((ec->internal) || (e_comp_wl_subsurface_check(ec)) ||
7351 (ec == e_comp_wl->drag_client))
7353 ELOGF("E_CLIENT", "Unmap. internal:%d, sub:%p, drag:%d",
7354 ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client));
7355 ec->visible = EINA_FALSE;
7356 evas_object_hide(ec->frame);
7357 ec->comp_data->mapped = 0;