#include "e.h"
Eina_Bool
-_e_policy_stack_transient_for_check_descendant(E_Client *ec, E_Client *ancestor)
+_e_policy_stack_transient_for_check_descendant(E_Client *ec, E_Client *ancestor, E_Transient policy)
{
E_Client *parent = NULL;
Eina_Bool is_descendant = EINA_FALSE;
if (!ec) return EINA_FALSE;
if (!ancestor) return EINA_FALSE;
+ if (ec->transient_policy != policy) return EINA_FALSE;
parent = ec->parent;
while (parent)
{
- if (parent && (eina_list_data_find(ancestor->transients, parent)))
+ if (parent->transient_policy != policy)
+ return EINA_FALSE;
+
+ if (eina_list_data_find(ancestor->transients, parent))
{
is_descendant = EINA_TRUE;
break;
_e_policy_stack_transient_for_apply(E_Client *ec)
{
int raise;
- E_Client *child, *top;
+ E_Client *child, *top, *bottom;
Eina_List *l;
Eina_Bool intercepted = EINA_FALSE;
}
if ((top != ec) && (eina_list_data_find(ec->parent->transients, top)))
{
- if (!e_client_mapped_get(top))
+ if (!e_client_is_internal(top))
{
- top = e_client_below_get(top);
- continue;
+ if (!e_client_mapped_get(top))
+ {
+ top = e_client_below_get(top);
+ continue;
+ }
}
if (top->transient_for_always_on_top)
{
else
break;
}
- if (_e_policy_stack_transient_for_check_descendant(top, ec->parent))
+
+ if (_e_policy_stack_transient_for_check_descendant(top, ec->parent, E_TRANSIENT_ABOVE))
break;
top = e_client_below_get(top);
}
else if (ec->transient_policy == E_TRANSIENT_BELOW)
{
- e_client_stack_below(ec, ec->parent);
+ if (eina_list_count(ec->parent->transients) <= 1)
+ e_client_stack_below(ec, ec->parent);
+ else
+ {
+ bottom = e_client_bottom_get();
+ while (bottom)
+ {
+ if (bottom == ec->parent)
+ break;
+
+ if ((bottom != ec) && (eina_list_data_find(ec->parent->transients, bottom)))
+ {
+ if (!e_client_is_internal(bottom))
+ {
+ if (!e_client_mapped_get(bottom))
+ {
+ bottom = e_client_above_get(bottom);
+ continue;
+ }
+ }
+
+ if (bottom->transient_policy == E_TRANSIENT_BELOW)
+ break;
+ }
+
+ if (_e_policy_stack_transient_for_check_descendant(bottom, ec->parent, E_TRANSIENT_BELOW))
+ break;
+
+ bottom = e_client_above_get(bottom);
+ }
+
+ if (bottom)
+ e_client_stack_below(ec, bottom);
+ else
+ e_client_stack_below(ec, ec->parent);
+ }
}
}
EINA_SAFETY_ON_NULL_RETURN(ec);
- ELOGF("POL", "Set Transient_stack. parent(win:%zx, ec:%p), is_transient_for:%d",
- ec, e_client_util_win_get(parent), parent, transient);
+ ELOGF("POL", "Set Transient_stack. new parent(win:%zx, ec:%p) old parent(win:%zx, ec:%p), is_transient_for:%d",
+ ec, e_client_util_win_get(parent), parent, e_client_util_win_get(ec->parent), ec->parent, transient);
if (!parent)
{