From 767885ddca81469d34e26a4546ddb1d460b2d987 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Sun, 31 Mar 2019 16:16:29 +0900 Subject: [PATCH] modify code to use e_client_geometry_get not ec->w and ec->h directly we have to consider the transform geometry while calculating visibility or iconic state. Change-Id: Ifaec0ae3d8a8cadc207d2ade44cd871907d4ee8f --- src/bin/e_client.c | 27 +++++++++++++--------- src/bin/e_policy.c | 19 +++++++++++---- src/bin/e_policy_visibility.c | 54 ++++++++++++++++++++++++++++++++++++++----- src/bin/e_policy_wl.c | 23 +++++++++++++----- 4 files changed, 96 insertions(+), 27 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 6aac08d..9d19588 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -784,13 +784,11 @@ _e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer) E_Client *above = NULL; E_Zone *_z = NULL; int x = 0, y = 0, w = 0, h = 0; + int ax = 0, ay = 0, aw = 0, ah = 0; if (!ec) return NULL; - x = ec->x; - y = ec->y; - w = ec->w; - h = ec->h; + e_client_geometry_get(ec, &x, &y, &w, &h); if (ec->zone) { @@ -816,7 +814,8 @@ _e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer) (above->frame) && (above->icccm.accepts_focus || above->icccm.take_focus)) { - if (E_CONTAINS(above->x, above->y, above->w, above->h, x, y, w, h)) + e_client_geometry_get(above, &ax, &ay, &aw, &ah); + if (E_CONTAINS(ax, ay, aw, ah, x, y, w, h)) break; } above = e_client_above_get(above); @@ -2324,6 +2323,8 @@ _e_client_eval(E_Client *ec) int send_event = 1; unsigned int prop = 0; int tx, ty, tw, th; + int ex, ey, ew, eh; + int px, py, pw, ph; if (e_object_is_del(E_OBJECT(ec))) { @@ -2375,21 +2376,25 @@ _e_client_eval(E_Client *ec) if (evas_object_visible_get(ec->parent->frame)) { - if ((!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) || - (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->parent->x, ec->parent->y, ec->parent->w, ec->parent->h))) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + e_client_geometry_get(ec->parent, &px, &py, &pw, &ph); + + if ((!E_CONTAINS(ex, ey, ew, eh, zx, zy, zw, zh)) || + (!E_CONTAINS(ex, ey, ew, eh, px, py, pw, ph))) { int x, y; e_comp_object_util_center_pos_get(ec->parent->frame, &x, &y); - if (E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) + if (E_CONTAINS(x, y, ew, eh, zx, zy, zw, zh)) { e_client_pos_set(ec, x, y); } else { - x = ec->parent->x; - y = ec->parent->y; - if (!E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) + x = px; + y = py; + + if (!E_CONTAINS(x, y, ew, eh, zx, zy, zw, zh)) { e_comp_object_util_center_on(ec->frame, ec->parent->frame); diff --git a/src/bin/e_policy.c b/src/bin/e_policy.c index 6fa2343..96e8198 100644 --- a/src/bin/e_policy.c +++ b/src/bin/e_policy.c @@ -820,6 +820,7 @@ static void _e_policy_cb_hook_client_eval_post_new_client(void *d EINA_UNUSED, E_Client *ec) { int zx, zy, zh, zw; + int ex, ey, ew, eh; if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->new_client) && (!e_pixmap_usable_get(ec->pixmap))) return; @@ -830,8 +831,9 @@ _e_policy_cb_hook_client_eval_post_new_client(void *d EINA_UNUSED, E_Client *ec) zy = ec->zone->y; zw = ec->zone->w; zh = ec->zone->h; + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) + if (E_CONTAINS(ex, ey, ew, eh, zx, zy, zw, zh)) e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); } } @@ -872,6 +874,9 @@ _e_policy_cb_hook_client_fullscreen_pre(void* data EINA_UNUSED, E_Client *ec) static void _e_policy_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec) { + int ex, ey, ew, eh; + int ax, ay, aw, ah; + if (ec->visibility.changed) { if (ec->visibility.obscured == E_VISIBILITY_UNOBSCURED) @@ -907,7 +912,9 @@ _e_policy_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec) if (ec->zone->display_state == E_ZONE_DISPLAY_STATE_ON) { - if (!E_CONTAINS(ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h, ec->x, ec->y, ec->w, ec->h)) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + if (!E_CONTAINS(ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h, ex, ey, ew, eh)) { if (ec->visibility.last_sent_type == E_VISIBILITY_PRE_UNOBSCURED) { @@ -943,7 +950,8 @@ _e_policy_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec) find_above = EINA_TRUE; - if (E_CONTAINS(above_ec->x, above_ec->y, above_ec->w, above_ec->h, ec->x, ec->y, ec->w, ec->h)) + e_client_geometry_get(above_ec, &ax, &ay, &aw, &ah); + if (E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) break; } @@ -1247,6 +1255,7 @@ _e_policy_cb_client_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve E_Event_Client *ev; E_Client *ec; int zx, zy, zw, zh; + int ex, ey, ew, eh; ev = event; if (!ev) goto end; @@ -1264,7 +1273,9 @@ _e_policy_cb_client_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve zw = ec->zone->w; zh = ec->zone->h; - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + if (E_CONTAINS(ex, ey, ew, eh, zx, zy, zw, zh)) e_policy_stack_clients_restack_above_lockscreen(ev->ec, EINA_TRUE); else e_policy_stack_clients_restack_above_lockscreen(ev->ec, EINA_FALSE); diff --git a/src/bin/e_policy_visibility.c b/src/bin/e_policy_visibility.c index 8acb3a8..4711bbf 100644 --- a/src/bin/e_policy_visibility.c +++ b/src/bin/e_policy_visibility.c @@ -229,15 +229,21 @@ _e_policy_check_above_alpha_opaque(E_Client *ec) E_Client *above_ec; Evas_Object *o; Eina_Bool alpha_opaque = EINA_FALSE; + int ex, ey, ew, eh; + int ax, ay, aw, ah; + + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); for (o = evas_object_above_get(ec->frame); o; o = evas_object_above_get(o)) { above_ec = evas_object_data_get(o, "E_Client"); if (!above_ec) continue; if (e_client_util_ignored_get(above_ec)) continue; - if (!E_CONTAINS(above_ec->x, above_ec->y, above_ec->w, above_ec->h, ec->x, ec->y, ec->w, ec->h)) continue; if (above_ec->comp_data && !above_ec->comp_data->mapped) continue; + e_client_geometry_get(above_ec, &ax, &ay, &aw, &ah); + if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; + if (above_ec->argb) { if (above_ec->visibility.opaque <= 0) @@ -1245,6 +1251,10 @@ _e_vis_client_check_obscured_by_same_layer(E_Client *ec) { Eina_Bool obscured = EINA_FALSE; E_Client *above = NULL; + int ex, ey, ew, eh; + int ax, ay, aw, ah; + + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); for (above = e_client_above_get(ec); above; above = e_client_above_get(above)) { @@ -1254,7 +1264,9 @@ _e_vis_client_check_obscured_by_same_layer(E_Client *ec) if (above->iconic && above->exp_iconify.by_client) continue; if (above->bg_state) continue; if (above->comp_data && !above->comp_data->mapped) continue; - if (!E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h)) continue; + + e_client_geometry_get(above, &ax, &ay, &aw, &ah); + if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; if (!above->argb) { @@ -1285,6 +1297,10 @@ _e_vis_client_check_obscured_by_above_layers(E_Client *ec) { Eina_Bool obscured = EINA_FALSE; E_Client *above = NULL; + int ex, ey, ew, eh; + int ax, ay, aw, ah; + + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); for (above = e_client_above_get(ec); above; above = e_client_above_get(above)) { @@ -1294,7 +1310,9 @@ _e_vis_client_check_obscured_by_above_layers(E_Client *ec) if (above->iconic && above->exp_iconify.by_client) continue; if (above->bg_state) continue; if (above->comp_data && !above->comp_data->mapped) continue; - if (!E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h)) continue; + + e_client_geometry_get(above, &ax, &ay, &aw, &ah); + if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; if (!above->argb) { @@ -1502,6 +1520,8 @@ _e_vis_ec_activity_check(E_Client *ec, Eina_Bool check_alpha) static void _e_vis_ec_job_exec(E_Client *ec, E_Vis_Job_Type type) { + int ex, ey, ew, eh; + VS_INF(ec, "Job Run: type %d", type); E_Vis_Client *vc = NULL; @@ -1520,7 +1540,8 @@ _e_vis_ec_job_exec(E_Client *ec, E_Vis_Job_Type type) e_client_activate(ec, 1); if (e_policy_client_is_lockscreen(ec)) { - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + if (E_CONTAINS(ex, ey, ew, eh, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); } else @@ -1589,11 +1610,24 @@ _e_vis_ec_above_visible_type(E_Client *ec, Eina_Bool check_child) { E_Client *above; E_Pol_Vis_Type above_vis_type = E_POL_VIS_TYPE_ALPHA; + int ex, ey, ew, eh; + int ax, ay, aw, ah; + int cx, cy, cw, ch; + + cx = ec->desk->geom.x; + cy = ec->desk->geom.y; + cw = ec->desk->geom.w; + ch = ec->desk->geom.h; + + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + // check whether ec is out of its container or not + if (!E_INTERSECTS(ex, ey, ew, eh, cx, cy, cw, ch)) + return E_POL_VIS_TYPE_NON_ALPHA; for (above = e_client_above_get(ec); above; above = e_client_above_get(above)) { if (e_client_util_ignored_get(above)) continue; - if (!E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h)) continue; if (check_child && (above->parent == ec)) continue; if (above->first_mapped) { @@ -1607,6 +1641,9 @@ _e_vis_ec_above_visible_type(E_Client *ec, Eina_Bool check_child) if (above->bg_state) continue; + e_client_geometry_get(above, &ax, &ay, &aw, &ah); + if (!E_CONTAINS(ax, ay, aw, ah, ex, ey, ew, eh)) continue; + if (above->visibility.obscured == E_VISIBILITY_UNOBSCURED) { if (!above->argb) @@ -1843,6 +1880,9 @@ _e_vis_transient_top_get(E_Client *ec) static Eina_Bool _e_vis_intercept_show(void *data EINA_UNUSED, E_Client *ec) { + int ex, ey, ew, eh; + int tx, ty, tw, th; + VS_DBG(ec, "INTERCEPT SHOW: new_client %d size %d %d", ec->new_client, ec->w, ec->h); @@ -1862,7 +1902,9 @@ _e_vis_intercept_show(void *data EINA_UNUSED, E_Client *ec) return EINA_TRUE; /* allow show if topmost child is alpha window or not fully cover region of ec */ - if ((topmost->argb) || !(E_CONTAINS(topmost->x, topmost->y, topmost->w, topmost->h, ec->x, ec->y, ec->w, ec->h))) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + e_client_geometry_get(topmost, &tx, &ty, &tw, &th); + if ((topmost->argb) || !(E_CONTAINS(tx, ty, tw, th, ex, ey, ew, eh))) return EINA_TRUE; /* do not show until child is shown */ diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index a250276..3fb3ebd 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -1405,8 +1405,11 @@ e_policy_wl_activate(E_Client *ec) if (e_policy_client_is_lockscreen(ec)) { - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) - e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); + int ex, ey, ew, eh; + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + if (E_CONTAINS(ex, ey, ew, eh, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) + e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); } else e_policy_stack_check_above_lockscreen(ec, ec->layer, NULL, EINA_TRUE); @@ -1913,8 +1916,11 @@ _tzpol_iface_cb_notilv_set(struct wl_client *client, struct wl_resource *res_tzp if (e_policy_client_is_lockscreen(ec)) { - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) - e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); + int ex, ey, ew, eh; + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + if (E_CONTAINS(ex, ey, ew, eh, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) + e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); } else e_policy_stack_check_above_lockscreen(ec, ec->layer, NULL, EINA_TRUE); @@ -1952,7 +1958,10 @@ e_policy_wl_notification_level_fetch(E_Client *ec) if (changed_stack && e_policy_client_is_lockscreen(ec)) { - if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) + int ex, ey, ew, eh; + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + + if (E_CONTAINS(ex, ey, ew, eh, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h)) e_policy_stack_clients_restack_above_lockscreen(ec, EINA_TRUE); } } @@ -4351,6 +4360,7 @@ _e_tzsh_indicator_find_topvisible_client(E_Zone *zone) E_Client *ec; Evas_Object *o; E_Comp_Wl_Client_Data *cdata; + int ex, ey, ew, eh; o = evas_object_top_get(e_comp->evas); for (; o; o = evas_object_below_get(o)) @@ -4375,7 +4385,8 @@ _e_tzsh_indicator_find_topvisible_client(E_Zone *zone) cdata = (E_Comp_Wl_Client_Data *)ec->comp_data; if (cdata && cdata->sub.data) continue; - if (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h)) + e_client_geometry_get(ec, &ex, &ey, &ew, &eh); + if (!E_CONTAINS(ex, ey, ew, eh, zone->x, zone->y, zone->w, zone->h)) continue; return ec; -- 2.7.4