ConstrainedStackingOrder() return ToplevelList

icc-effect-5.14.5
Martin Gräßlin 2012-04-07 17:29:22 +02:00
parent f8fd648a61
commit c175e75939
2 changed files with 28 additions and 14 deletions

View File

@ -115,7 +115,13 @@ void Workspace::updateStackingOrder(bool propagate_new_clients)
blocked_propagating_new_clients = true; blocked_propagating_new_clients = true;
return; return;
} }
ClientList new_stacking_order = constrainedStackingOrder(); ToplevelList constrainedOrder = constrainedStackingOrder();
ClientList new_stacking_order;
foreach (Toplevel *t, constrainedOrder) {
if (Client *c = qobject_cast<Client*>(t)) {
new_stacking_order << c;
}
}
bool changed = (new_stacking_order != stacking_order || force_restacking); bool changed = (new_stacking_order != stacking_order || force_restacking);
force_restacking = false; force_restacking = false;
stacking_order = new_stacking_order; stacking_order = new_stacking_order;
@ -503,9 +509,9 @@ void Workspace::circulateDesktopApplications()
/*! /*!
Returns a stacking order based upon \a list that fulfills certain contained. Returns a stacking order based upon \a list that fulfills certain contained.
*/ */
ClientList Workspace::constrainedStackingOrder() ToplevelList Workspace::constrainedStackingOrder()
{ {
ClientList layer[ NumLayers ]; ToplevelList layer[ NumLayers ];
#if 0 #if 0
kDebug(1212) << "stacking1:"; kDebug(1212) << "stacking1:";
@ -534,7 +540,7 @@ ClientList Workspace::constrainedStackingOrder()
} }
layer[ l ].append(*it); layer[ l ].append(*it);
} }
ClientList stacking; ToplevelList stacking;
for (Layer lay = FirstLayer; for (Layer lay = FirstLayer;
lay < NumLayers; lay < NumLayers;
++lay) ++lay)
@ -551,13 +557,14 @@ ClientList Workspace::constrainedStackingOrder()
for (int i = stacking.size() - 1; for (int i = stacking.size() - 1;
i >= 0; i >= 0;
) { ) {
if (!stacking[ i ]->isTransient()) { Client *current = qobject_cast<Client*>(stacking[i]);
if (!current || !current->isTransient()) {
--i; --i;
continue; continue;
} }
int i2 = -1; int i2 = -1;
if (stacking[ i ]->groupTransient()) { if (current->groupTransient()) {
if (stacking[ i ]->group()->members().count() > 0) { if (current->group()->members().count() > 0) {
// find topmost client this one is transient for // find topmost client this one is transient for
for (i2 = stacking.size() - 1; for (i2 = stacking.size() - 1;
i2 >= 0; i2 >= 0;
@ -566,8 +573,12 @@ ClientList Workspace::constrainedStackingOrder()
i2 = -1; // don't reorder, already the topmost in the group i2 = -1; // don't reorder, already the topmost in the group
break; break;
} }
if (stacking[ i2 ]->hasTransient(stacking[ i ], true) Client *c2 = qobject_cast<Client*>(stacking[ i2 ]);
&& keepTransientAbove(stacking[ i2 ], stacking[ i ])) if (!c2) {
continue;
}
if (c2->hasTransient(current, true)
&& keepTransientAbove(c2, current))
break; break;
} }
} // else i2 remains pointing at -1 } // else i2 remains pointing at -1
@ -575,12 +586,16 @@ ClientList Workspace::constrainedStackingOrder()
for (i2 = stacking.size() - 1; for (i2 = stacking.size() - 1;
i2 >= 0; i2 >= 0;
--i2) { --i2) {
if (stacking[ i2 ] == stacking[ i ]) { Client *c2 = qobject_cast<Client*>(stacking[ i2 ]);
if (!c2) {
continue;
}
if (c2 == current) {
i2 = -1; // don't reorder, already on top of its mainwindow i2 = -1; // don't reorder, already on top of its mainwindow
break; break;
} }
if (stacking[ i2 ] == stacking[ i ]->transientFor() if (c2 == current->transientFor()
&& keepTransientAbove(stacking[ i2 ], stacking[ i ])) && keepTransientAbove(c2, current))
break; break;
} }
} }
@ -588,7 +603,6 @@ ClientList Workspace::constrainedStackingOrder()
--i; --i;
continue; continue;
} }
Client* current = stacking[ i ];
stacking.removeAt(i); stacking.removeAt(i);
--i; // move onto the next item (for next for () iteration) --i; // move onto the next item (for next for () iteration)
--i2; // adjust index of the mainwindow after the remove above --i2; // adjust index of the mainwindow after the remove above

View File

@ -714,7 +714,7 @@ private:
void switchWindow(Direction direction); void switchWindow(Direction direction);
void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder
ClientList constrainedStackingOrder(); ToplevelList constrainedStackingOrder();
void raiseClientWithinApplication(Client* c); void raiseClientWithinApplication(Client* c);
void lowerClientWithinApplication(Client* c); void lowerClientWithinApplication(Client* c);
bool allowFullClientRaising(const Client* c, Time timestamp); bool allowFullClientRaising(const Client* c, Time timestamp);