return NULL;
}
+static Eina_Bool
+_e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
+{
+ E_Client *above = NULL;
+ Eina_Bool fully_contain = EINA_FALSE;
+
+ if (!ec) return EINA_FALSE;
+
+ above = e_client_above_get(ec);
+ while (above)
+ {
+ if ((check_layer) &&
+ (above->layer <= ec->layer))
+ {
+ above = e_client_above_get(above);
+ continue;
+ }
+
+ if ((!e_object_is_del(E_OBJECT(above))) &&
+ (!e_client_util_ignored_get(above)) &&
+ (above->visible) &&
+ (above->frame) &&
+ (above->icccm.accepts_focus || above->icccm.take_focus))
+ {
+ if (E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h))
+ {
+ fully_contain = EINA_TRUE;
+ break;
+ }
+ }
+ above = e_client_above_get(above);
+ }
+
+ return fully_contain;
+}
+
static void
_e_client_find_next_focus(E_Client *ec)
{
if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
return;
+ if (_e_client_check_fully_contain_by_above(ec, EINA_TRUE))
+ return;
+
next_focus = _e_client_find_focus_same_layer(ec);
if (next_focus)
evas_object_focus_set(next_focus->frame, 1);
{
if (!focus_ec)
{
- focus_ec = ec;
- evas_object_focus_set(ec->frame, 1);
+ Eina_Bool obscured = EINA_FALSE;
+ obscured = _e_client_check_fully_contain_by_above(ec, EINA_FALSE);
+ if (!obscured)
+ {
+ focus_ec = ec;
+ evas_object_focus_set(ec->frame, 1);
+ }
}
}
e_client_focus_defer_unset(ec);
if (!ec->lock_focus_out)
{
E_Client *focus_ec = ec;
+ Eina_Bool obscured = EINA_FALSE;
if (ec->transients)
focus_ec = e_client_transient_child_top_get(ec, EINA_TRUE);
- evas_object_focus_set(focus_ec->frame, 1);
+ obscured = _e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
+ if (!obscured)
+ evas_object_focus_set(focus_ec->frame, 1);
+ else
+ e_client_focus_defer_set(focus_ec);
}
}
static void
_tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
{
- E_Client *ec, *below = NULL;
+ E_Client *ec = NULL;
ec = wl_resource_get_user_data(surf);
EINA_SAFETY_ON_NULL_RETURN(ec);
if (e_policy_visibility_client_lower(ec))
return;
- below = ec;
- while ((below = e_client_below_get(below)))
- {
- if ((e_client_util_ignored_get(below)) ||
- (below->iconic))
- continue;
-
- break;
- }
-
evas_object_lower(ec->frame);
if (!e_client_first_mapped_get(ec))
e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
- if ((!below) || (!ec->focused)) return;
-
- evas_object_focus_set(below->frame, 1);
}
static void
_tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t res_id)
{
- E_Client *ec, *below = NULL;
+ E_Client *ec = NULL;
ELOGF("TZPOL",
"LOWER_RES|res_tzpol:0x%08x|res_id:%d",
EINA_SAFETY_ON_NULL_RETURN(ec);
EINA_SAFETY_ON_NULL_RETURN(ec->frame);
- below = ec;
- while ((below = e_client_below_get(below)))
- {
- if ((e_client_util_ignored_get(below)) ||
- (below->iconic))
- continue;
-
- break;
- }
-
evas_object_lower(ec->frame);
if (!e_client_first_mapped_get(ec))
e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
- if ((!below) || (!ec->focused)) return;
-
- if ((below->icccm.accepts_focus) ||(below->icccm.take_focus))
- evas_object_focus_set(below->frame, 1);
}
// --------------------------------------------------------