/* find new object for stacking if cw2 is on state of layer_pending */
if ((cw2) && (cw2->ec->layer_pending))
{
- E_Client *new_stack = NULL;
+ E_Client *new_stack = NULL, *current_ec = NULL;
+ current_ec = cw2->ec;
if (raising)
{
- while ((new_stack = e_client_below_get(cw2->ec)))
+ while ((new_stack = e_client_below_get(current_ec)))
{
if (new_stack == cw->ec) continue;
if (new_stack->layer != cw2->ec->layer) break;
if (!new_stack->layer_pending) break;
+ current_ec = new_stack;
}
if ((new_stack) && (new_stack->layer == cw2->ec->layer))
stack = new_stack->frame;
}
else
{
- while ((new_stack = e_client_above_get(cw2->ec)))
+ while ((new_stack = e_client_above_get(current_ec)))
{
if (new_stack == cw->ec) continue;
if (new_stack->layer != cw2->ec->layer) break;
if (!new_stack->layer_pending) break;
+ current_ec = new_stack;
}
if ((new_stack) && (new_stack->layer == cw2->ec->layer))
stack = new_stack->frame;