Workspace::ensureStackingOrder can operate on QList<Client*> or QList<AbstractClient*>
Preparation for getting Client::transients() to be AbstractClient as ensureStackingOrder is called on the transients.
This commit is contained in:
parent
ba8d11b305
commit
4ad749e560
2 changed files with 22 additions and 6 deletions
27
layers.cpp
27
layers.cpp
|
@ -617,18 +617,21 @@ void Workspace::blockStackingUpdates(bool block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure list is in stacking order
|
namespace {
|
||||||
ClientList Workspace::ensureStackingOrder(const ClientList& list) const
|
template <class T>
|
||||||
|
QList<T*> ensureStackingOrderInList(const ToplevelList &stackingOrder, const QList<T*> &list)
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<Toplevel, T>::value,
|
||||||
|
"U must be derived from T");
|
||||||
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
||||||
if (list.count() < 2)
|
if (list.count() < 2)
|
||||||
return list;
|
return list;
|
||||||
// TODO is this worth optimizing?
|
// TODO is this worth optimizing?
|
||||||
ClientList result = list;
|
QList<T*> result = list;
|
||||||
for (ToplevelList::ConstIterator it = stacking_order.constBegin();
|
for (auto it = stackingOrder.begin();
|
||||||
it != stacking_order.constEnd();
|
it != stackingOrder.end();
|
||||||
++it) {
|
++it) {
|
||||||
Client *c = qobject_cast<Client*>(*it);
|
T *c = qobject_cast<T*>(*it);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -637,6 +640,18 @@ ClientList Workspace::ensureStackingOrder(const ClientList& list) const
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure list is in stacking order
|
||||||
|
ClientList Workspace::ensureStackingOrder(const ClientList& list) const
|
||||||
|
{
|
||||||
|
return ensureStackingOrderInList(stacking_order, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<AbstractClient*> Workspace::ensureStackingOrder(const QList<AbstractClient*> &list) const
|
||||||
|
{
|
||||||
|
return ensureStackingOrderInList(stacking_order, list);
|
||||||
|
}
|
||||||
|
|
||||||
// check whether a transient should be actually kept above its mainwindow
|
// check whether a transient should be actually kept above its mainwindow
|
||||||
// there may be some special cases where this rule shouldn't be enfored
|
// there may be some special cases where this rule shouldn't be enfored
|
||||||
|
|
|
@ -243,6 +243,7 @@ public:
|
||||||
const ToplevelList& stackingOrder() const;
|
const ToplevelList& stackingOrder() const;
|
||||||
ToplevelList xStackingOrder() const;
|
ToplevelList xStackingOrder() const;
|
||||||
ClientList ensureStackingOrder(const ClientList& clients) const;
|
ClientList ensureStackingOrder(const ClientList& clients) const;
|
||||||
|
QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const;
|
||||||
|
|
||||||
Client* topClientOnDesktop(int desktop, int screen, bool unconstrained = false,
|
Client* topClientOnDesktop(int desktop, int screen, bool unconstrained = false,
|
||||||
bool only_normal = true) const;
|
bool only_normal = true) const;
|
||||||
|
|
Loading…
Reference in a new issue