Drop some custom list typedefs

Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example

    QList<QWeakPointer<TabBoxClient>> TabBoxClientList

in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?

Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.

So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24950
This commit is contained in:
Vlad Zahorodnii 2019-10-16 12:11:04 +03:00
parent 84d75cb567
commit 9d4a32596c
34 changed files with 163 additions and 191 deletions

View file

@ -1035,7 +1035,7 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint
replay = isActive(); // for clickraise mode
bool mustReplay = !rules()->checkAcceptFocus(acceptsFocus());
if (mustReplay) {
ToplevelList::const_iterator it = workspace()->stackingOrder().constEnd(),
auto it = workspace()->stackingOrder().constEnd(),
begin = workspace()->stackingOrder().constBegin();
while (mustReplay && --it != begin && *it != this) {
AbstractClient *c = qobject_cast<AbstractClient*>(*it);

View file

@ -417,7 +417,7 @@ void Workspace::clientHidden(AbstractClient* c)
AbstractClient *Workspace::clientUnderMouse(int screen) const
{
ToplevelList::const_iterator it = stackingOrder().constEnd();
auto it = stackingOrder().constEnd();
while (it != stackingOrder().constBegin()) {
AbstractClient *client = qobject_cast<AbstractClient*>(*(--it));
if (!client) {
@ -751,8 +751,8 @@ xcb_timestamp_t X11Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id
&& cl != this && X11Client::belongToSameApplication(cl, this, SameApplicationCheck::RelaxedForActive);
};
if (isTransient()) {
auto clientMainClients = [this] () -> ClientList {
ClientList ret;
auto clientMainClients = [this]() {
QList<X11Client *> ret;
const auto mcs = mainClients();
for (auto mc: mcs) {
if (X11Client *c = dynamic_cast<X11Client *>(mc)) {

View file

@ -164,8 +164,8 @@ void Activities::reallyStop(const QString &id)
QSet<QByteArray> saveSessionIds;
QSet<QByteArray> dontCloseSessionIds;
const ClientList &clients = ws->clientList();
for (ClientList::const_iterator it = clients.constBegin(); it != clients.constEnd(); ++it) {
const QList<X11Client *> &clients = ws->clientList();
for (auto it = clients.constBegin(); it != clients.constEnd(); ++it) {
const X11Client *c = (*it);
const QByteArray sessionId = c->sessionId();
if (sessionId.isEmpty()) {

View file

@ -402,7 +402,7 @@ void ActivationTest::testSwitchToWindowMaximized()
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
QVERIFY(geometryChangedSpy2.wait());
const ToplevelList stackingOrder = workspace()->stackingOrder();
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2));
QCOMPARE(client1->maximizeMode(), MaximizeFull);
QCOMPARE(client2->maximizeMode(), MaximizeFull);
@ -487,7 +487,7 @@ void ActivationTest::testSwitchToWindowFullScreen()
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
QVERIFY(geometryChangedSpy2.wait());
const ToplevelList stackingOrder = workspace()->stackingOrder();
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2));
QVERIFY(client1->isFullScreen());
QVERIFY(client2->isFullScreen());

View file

@ -108,7 +108,7 @@ void StackingOrderTest::testTransientIsAboveParent()
QVERIFY(!parent->isTransient());
// Initially, the stacking order should contain only the parent window.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent}));
// Create the transient.
KWayland::Client::Surface *transientSurface =
@ -125,13 +125,13 @@ void StackingOrderTest::testTransientIsAboveParent()
QVERIFY(transient->isTransient());
// The transient should be above the parent.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient}));
// The transient still stays above the parent if we activate the latter.
workspace()->activateClient(parent);
QTRY_VERIFY(parent->isActive());
QTRY_VERIFY(!transient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient}));
}
void StackingOrderTest::testRaiseTransient()
@ -152,7 +152,7 @@ void StackingOrderTest::testRaiseTransient()
QVERIFY(!parent->isTransient());
// Initially, the stacking order should contain only the parent window.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent}));
// Create the transient.
KWayland::Client::Surface *transientSurface =
@ -169,7 +169,7 @@ void StackingOrderTest::testRaiseTransient()
QVERIFY(transient->isTransient());
// The transient should be above the parent.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient}));
// Create a window that doesn't have any relationship to the parent or the transient.
KWayland::Client::Surface *anotherSurface =
@ -184,28 +184,28 @@ void StackingOrderTest::testRaiseTransient()
QVERIFY(!anotherClient->isTransient());
// The newly created surface has to be above both the parent and the transient.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient, anotherClient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient, anotherClient}));
// If we activate the parent, the transient should be raised too.
workspace()->activateClient(parent);
QTRY_VERIFY(parent->isActive());
QTRY_VERIFY(!transient->isActive());
QTRY_VERIFY(!anotherClient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{anotherClient, parent, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{anotherClient, parent, transient}));
// Go back to the initial setup.
workspace()->activateClient(anotherClient);
QTRY_VERIFY(!parent->isActive());
QTRY_VERIFY(!transient->isActive());
QTRY_VERIFY(anotherClient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient, anotherClient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient, anotherClient}));
// If we activate the transient, the parent should be raised too.
workspace()->activateClient(transient);
QTRY_VERIFY(!parent->isActive());
QTRY_VERIFY(transient->isActive());
QTRY_VERIFY(!anotherClient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{anotherClient, parent, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{anotherClient, parent, transient}));
}
struct WindowUnrefDeleter
@ -234,7 +234,7 @@ void StackingOrderTest::testDeletedTransient()
QVERIFY(parent->isActive());
QVERIFY(!parent->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent}));
// Create the first transient.
KWayland::Client::Surface *transient1Surface =
@ -251,7 +251,7 @@ void StackingOrderTest::testDeletedTransient()
QVERIFY(transient1->isTransient());
QCOMPARE(transient1->transientFor(), parent);
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient1}));
// Create the second transient.
KWayland::Client::Surface *transient2Surface =
@ -268,7 +268,7 @@ void StackingOrderTest::testDeletedTransient()
QVERIFY(transient2->isTransient());
QCOMPARE(transient2->transientFor(), transient1);
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient1, transient2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient1, transient2}));
// Activate the parent, both transients have to be above it.
workspace()->activateClient(parent);
@ -297,7 +297,7 @@ void StackingOrderTest::testDeletedTransient()
// The deleted transient still has to be above its old parent (transient1).
QTRY_VERIFY(parent->isActive());
QTRY_VERIFY(!transient1->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{parent, transient1, deletedTransient.data()}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{parent, transient1, deletedTransient.data()}));
}
static xcb_window_t createGroupWindow(xcb_connection_t *conn,
@ -376,7 +376,7 @@ void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
QCOMPARE(leader->windowId(), leaderWid);
QVERIFY(!leader->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader}));
// Create another group member.
windowCreatedSpy.clear();
@ -392,7 +392,7 @@ void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
QCOMPARE(member1->group(), leader->group());
QVERIFY(!member1->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1}));
// Create yet another group member.
windowCreatedSpy.clear();
@ -408,7 +408,7 @@ void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
QCOMPARE(member2->group(), leader->group());
QVERIFY(!member2->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2}));
// Create a group transient.
windowCreatedSpy.clear();
@ -448,24 +448,24 @@ void StackingOrderTest::testGroupTransientIsAboveWindowGroup()
QVERIFY(transient->groupTransient());
QVERIFY(!transient->isDialog()); // See above why
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
// If we activate any member of the window group, the transient will be above it.
workspace()->activateClient(leader);
QTRY_VERIFY(leader->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, member2, leader, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, member2, leader, transient}));
workspace()->activateClient(member1);
QTRY_VERIFY(member1->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member2, leader, member1, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member2, leader, member1, transient}));
workspace()->activateClient(member2);
QTRY_VERIFY(member2->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
workspace()->activateClient(transient);
QTRY_VERIFY(transient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
}
void StackingOrderTest::testRaiseGroupTransient()
@ -490,7 +490,7 @@ void StackingOrderTest::testRaiseGroupTransient()
QCOMPARE(leader->windowId(), leaderWid);
QVERIFY(!leader->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader}));
// Create another group member.
windowCreatedSpy.clear();
@ -506,7 +506,7 @@ void StackingOrderTest::testRaiseGroupTransient()
QCOMPARE(member1->group(), leader->group());
QVERIFY(!member1->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1}));
// Create yet another group member.
windowCreatedSpy.clear();
@ -522,7 +522,7 @@ void StackingOrderTest::testRaiseGroupTransient()
QCOMPARE(member2->group(), leader->group());
QVERIFY(!member2->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2}));
// Create a group transient.
windowCreatedSpy.clear();
@ -562,7 +562,7 @@ void StackingOrderTest::testRaiseGroupTransient()
QVERIFY(transient->groupTransient());
QVERIFY(!transient->isDialog()); // See above why
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
// Create a Wayland client that is not a member of the window group.
KWayland::Client::Surface *anotherSurface =
@ -576,27 +576,27 @@ void StackingOrderTest::testRaiseGroupTransient()
QVERIFY(anotherClient->isActive());
QVERIFY(!anotherClient->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient, anotherClient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient, anotherClient}));
// If we activate the leader, then only it and the transient have to be raised.
workspace()->activateClient(leader);
QTRY_VERIFY(leader->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, member2, anotherClient, leader, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, member2, anotherClient, leader, transient}));
// If another member of the window group is activated, then the transient will
// be above that member and the leader.
workspace()->activateClient(member2);
QTRY_VERIFY(member2->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, anotherClient, leader, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, anotherClient, leader, member2, transient}));
// FIXME: If we activate the transient, only it will be raised.
workspace()->activateClient(anotherClient);
QTRY_VERIFY(anotherClient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, leader, member2, transient, anotherClient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, leader, member2, transient, anotherClient}));
workspace()->activateClient(transient);
QTRY_VERIFY(transient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, leader, member2, anotherClient, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, leader, member2, anotherClient, transient}));
}
void StackingOrderTest::testDeletedGroupTransient()
@ -624,7 +624,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QCOMPARE(leader->windowId(), leaderWid);
QVERIFY(!leader->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader}));
// Create another group member.
windowCreatedSpy.clear();
@ -640,7 +640,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QCOMPARE(member1->group(), leader->group());
QVERIFY(!member1->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1}));
// Create yet another group member.
windowCreatedSpy.clear();
@ -656,7 +656,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QCOMPARE(member2->group(), leader->group());
QVERIFY(!member2->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2}));
// Create a group transient.
windowCreatedSpy.clear();
@ -696,7 +696,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QVERIFY(transient->groupTransient());
QVERIFY(!transient->isDialog()); // See above why
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
// Unmap the transient.
connect(transient, &X11Client::windowClosed, this,
@ -717,7 +717,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QVERIFY(deletedTransient.data());
// The transient has to be above each member of the window group.
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, deletedTransient.data()}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, deletedTransient.data()}));
}
void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
@ -744,7 +744,7 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
QCOMPARE(leader->windowId(), leaderWid);
QVERIFY(!leader->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader}));
// Create another group member.
windowCreatedSpy.clear();
@ -760,7 +760,7 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
QCOMPARE(member1->group(), leader->group());
QVERIFY(!member1->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1}));
// Create yet another group member.
windowCreatedSpy.clear();
@ -776,7 +776,7 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
QCOMPARE(member2->group(), leader->group());
QVERIFY(!member2->isTransient());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2}));
// Create a group transient.
windowCreatedSpy.clear();
@ -796,23 +796,23 @@ void StackingOrderTest::testDontKeepAboveNonModalDialogGroupTransients()
QVERIFY(transient->isDialog());
QVERIFY(!transient->isModal());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
workspace()->activateClient(leader);
QTRY_VERIFY(leader->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, member2, transient, leader}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member1, member2, transient, leader}));
workspace()->activateClient(member1);
QTRY_VERIFY(member1->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member2, transient, leader, member1}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{member2, transient, leader, member1}));
workspace()->activateClient(member2);
QTRY_VERIFY(member2->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{transient, leader, member1, member2}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{transient, leader, member1, member2}));
workspace()->activateClient(transient);
QTRY_VERIFY(transient->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{leader, member1, member2, transient}));
}
void StackingOrderTest::testKeepAbove()
@ -831,7 +831,7 @@ void StackingOrderTest::testKeepAbove()
QVERIFY(clientA->isActive());
QVERIFY(!clientA->keepAbove());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientA}));
// Create the second client.
KWayland::Client::Surface *clientBSurface =
@ -845,12 +845,12 @@ void StackingOrderTest::testKeepAbove()
QVERIFY(clientB->isActive());
QVERIFY(!clientB->keepAbove());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientA, clientB}));
// Go to the initial test position.
workspace()->activateClient(clientA);
QTRY_VERIFY(clientA->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientB, clientA}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientB, clientA}));
// Set the "keep-above" flag on the client B, it should go above other clients.
{
@ -860,7 +860,7 @@ void StackingOrderTest::testKeepAbove()
QVERIFY(clientB->keepAbove());
QVERIFY(!clientB->isActive());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientA, clientB}));
}
void StackingOrderTest::testKeepBelow()
@ -879,7 +879,7 @@ void StackingOrderTest::testKeepBelow()
QVERIFY(clientA->isActive());
QVERIFY(!clientA->keepBelow());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientA}));
// Create the second client.
KWayland::Client::Surface *clientBSurface =
@ -893,7 +893,7 @@ void StackingOrderTest::testKeepBelow()
QVERIFY(clientB->isActive());
QVERIFY(!clientB->keepBelow());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientA, clientB}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientA, clientB}));
// Set the "keep-below" flag on the client B, it should go below other clients.
{
@ -903,7 +903,7 @@ void StackingOrderTest::testKeepBelow()
QVERIFY(clientB->isActive());
QVERIFY(clientB->keepBelow());
QCOMPARE(workspace()->stackingOrder(), (ToplevelList{clientB, clientA}));
QCOMPARE(workspace()->stackingOrder(), (QList<Toplevel *>{clientB, clientA}));
}
WAYLANDTEST_MAIN(StackingOrderTest)

View file

@ -614,8 +614,8 @@ void Compositor::performCompositing()
}
// Create a list of all windows in the stacking order
ToplevelList windows = Workspace::self()->xStackingOrder();
ToplevelList damaged;
QList<Toplevel *> windows = Workspace::self()->xStackingOrder();
QList<Toplevel *> damaged;
// Reset the damage state of each window and fetch the damage region
// without waiting for a reply
@ -968,7 +968,7 @@ void X11Compositor::updateClientCompositeBlocking(X11Client *c)
// If !c we just check if we can resume in case a blocking client was lost.
bool shouldResume = true;
for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin();
for (auto it = Workspace::self()->clientList().constBegin();
it != Workspace::self()->clientList().constEnd(); ++it) {
if ((*it)->isBlockingCompositing()) {
shouldResume = false;

View file

@ -162,7 +162,7 @@ public:
*
* Because the window is Deleted, it can have only Deleted child transients.
*/
DeletedList transients() const {
QList<Deleted *> transients() const {
return m_transients;
}
@ -236,8 +236,8 @@ private:
bool m_wasX11Client;
bool m_wasWaylandClient;
bool m_wasGroupTransient;
ToplevelList m_transientFor;
DeletedList m_transients;
QList<Toplevel *> m_transientFor;
QList<Deleted *> m_transients;
bool m_wasPopupWindow;
bool m_wasOutline;
qreal m_bufferScale = 1;

View file

@ -1118,7 +1118,7 @@ EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const
EffectWindowList EffectsHandlerImpl::stackingOrder() const
{
ToplevelList list = Workspace::self()->xStackingOrder();
QList<Toplevel *> list = Workspace::self()->xStackingOrder();
EffectWindowList ret;
for (Toplevel *t : list) {
if (EffectWindow *w = effectWindow(t))

View file

@ -138,7 +138,7 @@ void Workspace::updateClientArea(bool force)
iS ++)
new_sareas[ i ][ iS ] = screens[ iS ];
}
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it) {
for (auto it = clients.constBegin(); it != clients.constEnd(); ++it) {
if (!(*it)->hasStrut())
continue;
QRect r = (*it)->adjustedClientArea(desktopArea, desktopArea);

View file

@ -154,7 +154,7 @@ void Group::lostLeader()
Group* Workspace::findGroup(xcb_window_t leader) const
{
Q_ASSERT(leader != XCB_WINDOW_NONE);
for (GroupList::ConstIterator it = groups.constBegin();
for (auto it = groups.constBegin();
it != groups.constEnd();
++it)
if ((*it)->leader() == leader)
@ -167,7 +167,7 @@ Group* Workspace::findGroup(xcb_window_t leader) const
Group* Workspace::findClientLeaderGroup(const X11Client *c) const
{
Group* ret = nullptr;
for (ClientList::ConstIterator it = clients.constBegin();
for (auto it = clients.constBegin();
it != clients.constEnd();
++it) {
if (*it == c)
@ -180,7 +180,7 @@ Group* Workspace::findClientLeaderGroup(const X11Client *c) const
// This most probably means the app uses group transients without
// setting group for its windows. Merging the two groups is a bad
// hack, but there's no really good solution for this case.
ClientList old_group = (*it)->group()->members();
QList<X11Client *> old_group = (*it)->group()->members();
// old_group autodeletes when being empty
for (int pos = 0;
pos < old_group.count();
@ -248,7 +248,7 @@ void Workspace::updateOnAllDesktopsOfTransients(AbstractClient* c)
// A new window has been mapped. Check if it's not a mainwindow for some already existing transient window.
void Workspace::checkTransients(xcb_window_t w)
{
for (ClientList::ConstIterator it = clients.constBegin();
for (auto it = clients.constBegin();
it != clients.constEnd();
++it)
(*it)->checkTransient(w);
@ -452,7 +452,7 @@ void X11Client::removeFromMainClients()
if (transientFor())
transientFor()->removeTransient(this);
if (groupTransient()) {
for (ClientList::ConstIterator it = group()->members().constBegin();
for (auto it = group()->members().constBegin();
it != group()->members().constEnd();
++it)
(*it)->removeTransient(this);
@ -466,24 +466,24 @@ void X11Client::removeFromMainClients()
void X11Client::cleanGrouping()
{
// qDebug() << "CLEANGROUPING:" << this;
// for ( ClientList::ConstIterator it = group()->members().begin();
// for ( auto it = group()->members().begin();
// it != group()->members().end();
// ++it )
// qDebug() << "CL:" << *it;
// ClientList mains;
// QList<X11Client *> mains;
// mains = mainClients();
// for ( ClientList::ConstIterator it = mains.begin();
// for ( auto it = mains.begin();
// it != mains.end();
// ++it )
// qDebug() << "MN:" << *it;
removeFromMainClients();
// qDebug() << "CLEANGROUPING2:" << this;
// for ( ClientList::ConstIterator it = group()->members().begin();
// for ( auto it = group()->members().begin();
// it != group()->members().end();
// ++it )
// qDebug() << "CL2:" << *it;
// mains = mainClients();
// for ( ClientList::ConstIterator it = mains.begin();
// for ( auto it = mains.begin();
// it != mains.end();
// ++it )
// qDebug() << "MN2:" << *it;
@ -497,12 +497,12 @@ void X11Client::cleanGrouping()
++it;
}
// qDebug() << "CLEANGROUPING3:" << this;
// for ( ClientList::ConstIterator it = group()->members().begin();
// for ( auto it = group()->members().begin();
// it != group()->members().end();
// ++it )
// qDebug() << "CL3:" << *it;
// mains = mainClients();
// for ( ClientList::ConstIterator it = mains.begin();
// for ( auto it = mains.begin();
// it != mains.end();
// ++it )
// qDebug() << "MN3:" << *it;
@ -511,15 +511,15 @@ void X11Client::cleanGrouping()
// lists of all group members, but then made windows that
// were transient for 'this' group transient, which again
// added 'this' to those transient lists :(
ClientList group_members = group()->members();
QList<X11Client *> group_members = group()->members();
group()->removeMember(this);
in_group = nullptr;
for (ClientList::ConstIterator it = group_members.constBegin();
for (auto it = group_members.constBegin();
it != group_members.constEnd();
++it)
(*it)->removeTransient(this);
// qDebug() << "CLEANGROUPING4:" << this;
// for ( ClientList::ConstIterator it = group_members.begin();
// for ( auto it = group_members.begin();
// it != group_members.end();
// ++it )
// qDebug() << "CL4:" << *it;
@ -532,12 +532,12 @@ void X11Client::cleanGrouping()
// Non-group transients not causing loops are checked in verifyTransientFor().
void X11Client::checkGroupTransients()
{
for (ClientList::ConstIterator it1 = group()->members().constBegin();
for (auto it1 = group()->members().constBegin();
it1 != group()->members().constEnd();
++it1) {
if (!(*it1)->groupTransient()) // check all group transients in the group
continue; // TODO optimize to check only the changed ones?
for (ClientList::ConstIterator it2 = group()->members().constBegin();
for (auto it2 = group()->members().constBegin();
it2 != group()->members().constEnd();
++it2) { // group transients can be transient only for others in the group,
// so don't make them transient for the ones that are transient for it
@ -563,7 +563,7 @@ void X11Client::checkGroupTransients()
// transient for it - the indirect transiency actually shouldn't break anything,
// but it can lead to exponentially expensive operations (#95231)
// TODO this is pretty slow as well
for (ClientList::ConstIterator it3 = group()->members().constBegin();
for (auto it3 = group()->members().constBegin();
it3 != group()->members().constEnd();
++it3) {
if (*it1 == *it2 || *it2 == *it3 || *it1 == *it3)
@ -653,7 +653,7 @@ void X11Client::addTransient(AbstractClient* cl)
check_active_modal = true;
// qDebug() << "ADDTRANS:" << this << ":" << cl;
// qDebug() << kBacktrace();
// for ( ClientList::ConstIterator it = transients_list.begin();
// for ( auto it = transients_list.begin();
// it != transients_list.end();
// ++it )
// qDebug() << "AT:" << (*it);
@ -691,13 +691,13 @@ bool X11Client::hasTransient(const AbstractClient* cl, bool indirect) const
{
if (const X11Client *c = dynamic_cast<const X11Client *>(cl)) {
// checkGroupTransients() uses this to break loops, so hasTransient() must detect them
ConstClientList set;
QList<const X11Client *> set;
return hasTransientInternal(c, indirect, set);
}
return false;
}
bool X11Client::hasTransientInternal(const X11Client *cl, bool indirect, ConstClientList& set) const
bool X11Client::hasTransientInternal(const X11Client *cl, bool indirect, QList<const X11Client *> &set) const
{
if (const X11Client *t = dynamic_cast<const X11Client *>(cl->transientFor())) {
if (t == this)
@ -742,7 +742,7 @@ QList<AbstractClient*> X11Client::mainClients() const
return QList<AbstractClient*>{const_cast< AbstractClient* >(t)};
QList<AbstractClient*> result;
Q_ASSERT(group());
for (ClientList::ConstIterator it = group()->members().constBegin();
for (auto it = group()->members().constBegin();
it != group()->members().constEnd();
++it)
if ((*it)->hasTransient(this, false))
@ -848,13 +848,13 @@ void X11Client::checkGroup(Group* set_group, bool force)
if (groupTransient()) {
// no longer transient for ones in the old group
if (old_group != nullptr) {
for (ClientList::ConstIterator it = old_group->members().constBegin();
for (auto it = old_group->members().constBegin();
it != old_group->members().constEnd();
++it)
(*it)->removeTransient(this);
}
// and make transient for all in the new group
for (ClientList::ConstIterator it = group()->members().constBegin();
for (auto it = group()->members().constBegin();
it != group()->members().constEnd();
++it) {
if (*it == this)
@ -864,7 +864,7 @@ void X11Client::checkGroup(Group* set_group, bool force)
}
// group transient splashscreens should be transient even for windows
// in group mapped later
for (ClientList::ConstIterator it = group()->members().constBegin();
for (auto it = group()->members().constBegin();
it != group()->members().constEnd();
++it) {
if (!(*it)->isSplash())

View file

@ -39,7 +39,7 @@ public:
xcb_window_t leader() const;
const X11Client *leaderClient() const;
X11Client *leaderClient();
const ClientList& members() const;
const QList<X11Client *> &members() const;
QIcon icon() const;
void addMember(X11Client *member);
void removeMember(X11Client *member);
@ -52,7 +52,7 @@ public:
EffectWindowGroupImpl* effectGroup();
private:
void startupIdChanged();
ClientList _members;
QList<X11Client *> _members;
X11Client *leader_client;
xcb_window_t leader_wid;
NETWinInfo* leader_info;
@ -76,7 +76,7 @@ inline X11Client *Group::leaderClient()
return leader_client;
}
inline const ClientList& Group::members() const
inline const QList<X11Client *> &Group::members() const
{
return _members;
}

View file

@ -2132,7 +2132,7 @@ Toplevel *InputRedirection::findToplevel(const QPoint &pos)
if (effects && static_cast<EffectsHandlerImpl*>(effects)->isMouseInterception()) {
return nullptr;
}
const UnmanagedList &unmanaged = Workspace::self()->unmanagedList();
const QList<Unmanaged *> &unmanaged = Workspace::self()->unmanagedList();
foreach (Unmanaged *u, unmanaged) {
if (u->inputGeometry().contains(pos) && acceptsInput(u, pos)) {
return u;
@ -2148,7 +2148,7 @@ Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos)
return nullptr;
}
const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked();
const ToplevelList &stacking = Workspace::self()->stackingOrder();
const QList<Toplevel *> &stacking = Workspace::self()->stackingOrder();
if (stacking.isEmpty()) {
return nullptr;
}

View file

@ -158,7 +158,7 @@ void KeyboardInputRedirection::update()
// TODO: this needs better integration
Toplevel *found = nullptr;
if (waylandServer()->isScreenLocked()) {
const ToplevelList &stacking = Workspace::self()->stackingOrder();
const QList<Toplevel *> &stacking = Workspace::self()->stackingOrder();
if (!stacking.isEmpty()) {
auto it = stacking.end();
do {

View file

@ -65,7 +65,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
When some client attribute changes (above/below flag, transiency...),
Workspace::updateClientLayer() should be called in order to make
sure it's moved to the appropriate layer ClientList if needed.
sure it's moved to the appropriate layer QList<X11Client *> if needed.
Currently the things that affect client in which layer a client
belongs: KeepAbove/Keep Below flags, window type, fullscreen
@ -119,7 +119,7 @@ void Workspace::updateStackingOrder(bool propagate_new_clients)
blocked_propagating_new_clients = true;
return;
}
ToplevelList new_stacking_order = constrainedStackingOrder();
QList<Toplevel *> new_stacking_order = constrainedStackingOrder();
bool changed = (force_restacking || new_stacking_order != stacking_order);
force_restacking = false;
stacking_order = new_stacking_order;
@ -211,9 +211,9 @@ void Workspace::propagateClients(bool propagate_new_clients)
cl[pos++] = win;
}
// TODO this is still not completely in the map order
for (ClientList::ConstIterator it = desktops.constBegin(); it != desktops.constEnd(); ++it)
for (auto it = desktops.constBegin(); it != desktops.constEnd(); ++it)
cl[pos++] = (*it)->window();
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
for (auto it = clients.constBegin(); it != clients.constEnd(); ++it)
cl[pos++] = (*it)->window();
rootInfo()->setClientList(cl, pos);
delete [] cl;
@ -221,7 +221,7 @@ void Workspace::propagateClients(bool propagate_new_clients)
cl = new xcb_window_t[ manual_overlays.count() + stacking_order.count()];
pos = 0;
for (ToplevelList::ConstIterator it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) {
for (auto it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) {
if ((*it)->isClient())
cl[pos++] = (*it)->window();
}
@ -245,7 +245,7 @@ void Workspace::propagateClients(bool propagate_new_clients)
AbstractClient* Workspace::topClientOnDesktop(int desktop, int screen, bool unconstrained, bool only_normal) const
{
// TODO Q_ASSERT( block_stacking_updates == 0 );
ToplevelList list;
QList<Toplevel *> list;
if (!unconstrained)
list = stacking_order;
else
@ -322,7 +322,7 @@ void Workspace::lowerClient(AbstractClient* c, bool nogroup)
unconstrained_stacking_order.prepend(c);
if (!nogroup && c->isTransient()) {
// lower also all windows in the group, in their reversed stacking order
ClientList wins;
QList<X11Client *> wins;
if (auto group = c->group()) {
wins = ensureStackingOrder(group->members());
}
@ -350,7 +350,7 @@ void Workspace::lowerClientWithinApplication(AbstractClient* c)
unconstrained_stacking_order.removeAll(c);
bool lowered = false;
// first try to put it below the bottom-most window of the application
for (ToplevelList::Iterator it = unconstrained_stacking_order.begin();
for (auto it = unconstrained_stacking_order.begin();
it != unconstrained_stacking_order.end();
++it) {
AbstractClient *client = qobject_cast<AbstractClient*>(*it);
@ -485,7 +485,7 @@ void Workspace::restoreSessionStackingOrder(X11Client *c)
return;
StackingUpdatesBlocker blocker(this);
unconstrained_stacking_order.removeAll(c);
for (ToplevelList::Iterator it = unconstrained_stacking_order.begin(); // from bottom
for (auto it = unconstrained_stacking_order.begin(); // from bottom
it != unconstrained_stacking_order.end();
++it) {
X11Client *current = qobject_cast<X11Client *>(*it);
@ -503,13 +503,13 @@ void Workspace::restoreSessionStackingOrder(X11Client *c)
/**
* Returns a stacking order based upon \a list that fulfills certain contained.
*/
ToplevelList Workspace::constrainedStackingOrder()
QList<Toplevel *> Workspace::constrainedStackingOrder()
{
ToplevelList layer[ NumLayers ];
QList<Toplevel *> layer[ NumLayers ];
// build the order from layers
QVector< QMap<Group*, Layer> > minimum_layer(screens()->count());
for (ToplevelList::ConstIterator it = unconstrained_stacking_order.constBegin(),
for (auto it = unconstrained_stacking_order.constBegin(),
end = unconstrained_stacking_order.constEnd(); it != end; ++it) {
Layer l = (*it)->layer();
@ -528,7 +528,7 @@ ToplevelList Workspace::constrainedStackingOrder()
}
layer[ l ].append(*it);
}
ToplevelList stacking;
QList<Toplevel *> stacking;
for (int lay = FirstLayer; lay < NumLayers; ++lay) {
stacking += layer[lay];
}
@ -636,7 +636,7 @@ void Workspace::blockStackingUpdates(bool block)
namespace {
template <class T>
QList<T*> ensureStackingOrderInList(const ToplevelList &stackingOrder, const QList<T*> &list)
QList<T*> ensureStackingOrderInList(const QList<Toplevel *> &stackingOrder, const QList<T*> &list)
{
static_assert(std::is_base_of<Toplevel, T>::value,
"U must be derived from T");
@ -660,7 +660,7 @@ QList<T*> ensureStackingOrderInList(const ToplevelList &stackingOrder, const QLi
}
// Ensure list is in stacking order
ClientList Workspace::ensureStackingOrder(const ClientList& list) const
QList<X11Client *> Workspace::ensureStackingOrder(const QList<X11Client *> &list) const
{
return ensureStackingOrderInList(stacking_order, list);
}
@ -726,7 +726,7 @@ bool Workspace::keepDeletedTransientAbove(const Toplevel *mainWindow, const Dele
}
// Returns all windows in their stacking order on the root window.
ToplevelList Workspace::xStackingOrder() const
QList<Toplevel *> Workspace::xStackingOrder() const
{
if (m_xStackingDirty) {
const_cast<Workspace*>(this)->updateXStackingOrder();
@ -785,7 +785,7 @@ void X11Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource
workspace()->raiseOrLowerClient(this);
return;
}
ToplevelList::const_iterator it = workspace()->stackingOrder().constBegin(),
auto it = workspace()->stackingOrder().constBegin(),
end = workspace()->stackingOrder().constEnd();
while (it != end) {
if (*it == this) {
@ -815,7 +815,7 @@ void X11Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource
other = workspace()->findClient(Predicate::WindowMatch, above);
if (other && detail == XCB_STACK_MODE_ABOVE) {
ToplevelList::const_iterator it = workspace()->stackingOrder().constEnd(),
auto it = workspace()->stackingOrder().constEnd(),
begin = workspace()->stackingOrder().constBegin();
while (--it != begin) {

View file

@ -247,8 +247,7 @@ void Placement::placeSmart(AbstractClient* c, const QRect& area, Policy /*next*/
cxl = x; cxr = x + cw;
cyt = y; cyb = y + ch;
ToplevelList::ConstIterator l;
for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
for (auto l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
AbstractClient *client = qobject_cast<AbstractClient*>(*l);
if (isIrrelevant(client, c, desktop)) {
continue;
@ -296,8 +295,7 @@ void Placement::placeSmart(AbstractClient* c, const QRect& area, Policy /*next*/
if (possible - cw > x) possible -= cw;
// compare to the position of each client on the same desk
ToplevelList::ConstIterator l;
for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
for (auto l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
AbstractClient *client = qobject_cast<AbstractClient*>(*l);
if (isIrrelevant(client, c, desktop)) {
continue;
@ -327,8 +325,7 @@ void Placement::placeSmart(AbstractClient* c, const QRect& area, Policy /*next*/
if (possible - ch > y) possible -= ch;
//test the position of each window on the desk
ToplevelList::ConstIterator l;
for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
for (auto l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
AbstractClient *client = qobject_cast<AbstractClient*>(*l);
if (isIrrelevant(client, c, desktop)) {
continue;

View file

@ -637,7 +637,7 @@ void SceneOpenGL2::paintCursor()
glDisable(GL_BLEND);
}
qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
qint64 SceneOpenGL::paint(QRegion damage, QList<Toplevel *> toplevels)
{
// actually paint the frame, flushed with the NEXT frame
createStackingOrder(toplevels);

View file

@ -47,7 +47,7 @@ public:
~SceneOpenGL() override;
bool initFailed() const override;
bool hasPendingFlush() const override;
qint64 paint(QRegion damage, ToplevelList windows) override;
qint64 paint(QRegion damage, QList<Toplevel *> windows) override;
Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override;
Shadow *createShadow(Toplevel *toplevel) override;
void screenGeometryChanged(const QSize &size) override;

View file

@ -91,7 +91,7 @@ void SceneQPainter::paintGenericScreen(int mask, ScreenPaintData data)
m_painter->restore();
}
qint64 SceneQPainter::paint(QRegion damage, ToplevelList toplevels)
qint64 SceneQPainter::paint(QRegion damage, QList<Toplevel *> toplevels)
{
QElapsedTimer renderTimer;
renderTimer.start();

View file

@ -36,7 +36,7 @@ public:
~SceneQPainter() override;
bool usesOverlayWindow() const override;
OverlayWindow* overlayWindow() const override;
qint64 paint(QRegion damage, ToplevelList windows) override;
qint64 paint(QRegion damage, QList<Toplevel *> windows) override;
void paintGenericScreen(int mask, ScreenPaintData data) override;
CompositingType compositingType() const override;
bool initFailed() const override;

View file

@ -249,7 +249,7 @@ bool SceneXrender::initFailed() const
}
// the entry point for painting
qint64 SceneXrender::paint(QRegion damage, ToplevelList toplevels)
qint64 SceneXrender::paint(QRegion damage, QList<Toplevel *> toplevels)
{
QElapsedTimer renderTimer;
renderTimer.start();

View file

@ -154,7 +154,7 @@ public:
CompositingType compositingType() const override {
return XRenderCompositing;
}
qint64 paint(QRegion damage, ToplevelList windows) override;
qint64 paint(QRegion damage, QList<Toplevel *> windows) override;
Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override;
Shadow *createShadow(Toplevel *toplevel) override;
void screenGeometryChanged(const QSize &size) override;

View file

@ -441,7 +441,7 @@ void Scene::windowGeometryShapeChanged(Toplevel *c)
w->discardShape();
}
void Scene::createStackingOrder(ToplevelList toplevels)
void Scene::createStackingOrder(QList<Toplevel *> toplevels)
{
// TODO: cache the stacking_order in case it has not changed
foreach (Toplevel *c, toplevels) {

View file

@ -76,7 +76,7 @@ public:
// The entry point for the main part of the painting pass.
// returns the time since the last vblank signal - if there's one
// ie. "what of this frame is lost to painting"
virtual qint64 paint(QRegion damage, ToplevelList windows) = 0;
virtual qint64 paint(QRegion damage, QList<Toplevel *> windows) = 0;
/**
* Adds the Toplevel to the Scene.
@ -207,7 +207,7 @@ public Q_SLOTS:
void windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted);
protected:
virtual Window *createWindow(Toplevel *toplevel) = 0;
void createStackingOrder(ToplevelList toplevels);
void createStackingOrder(QList<Toplevel *> toplevels);
void clearStackingOrder();
// shared implementation, starts painting the screen
void paintScreen(int *mask, const QRegion &damage, const QRegion &repaint,

View file

@ -202,8 +202,8 @@ void ClientLevel::removeClient(AbstractClient *client)
void ClientLevel::init()
{
const ClientList &clients = Workspace::self()->clientList();
for (ClientList::const_iterator it = clients.begin(); it != clients.end(); ++it) {
const QList<X11Client *> &clients = Workspace::self()->clientList();
for (auto it = clients.begin(); it != clients.end(); ++it) {
X11Client *client = *it;
setupClientConnections(client);
if (!exclude(client) && shouldAdd(client)) {
@ -214,8 +214,8 @@ void ClientLevel::init()
void ClientLevel::reInit()
{
const ClientList &clients = Workspace::self()->clientList();
for (ClientList::const_iterator it = clients.begin(); it != clients.end(); ++it) {
const QList<X11Client *> &clients = Workspace::self()->clientList();
for (auto it = clients.begin(); it != clients.end(); ++it) {
checkClient((*it));
}
if (waylandServer()) {

4
sm.cpp
View file

@ -125,7 +125,7 @@ void Workspace::storeSession(KConfig* config, SMSavePhase phase)
int count = 0;
int active_client = -1;
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
for (auto it = clients.begin(); it != clients.end(); ++it) {
X11Client *c = (*it);
if (c->windowType() > NET::Splash) {
//window types outside this are not tooltips/menus/OSDs
@ -204,7 +204,7 @@ void Workspace::storeSubSession(const QString &name, QSet<QByteArray> sessionIds
KConfigGroup cg(KSharedConfig::openConfig(), QLatin1String("SubSession: ") + name);
int count = 0;
int active_client = -1;
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
for (auto it = clients.begin(); it != clients.end(); ++it) {
X11Client *c = (*it);
if (c->windowType() > NET::Splash) {
continue;

View file

@ -283,7 +283,7 @@ QWeakPointer<TabBoxClient> TabBoxHandlerImpl::clientToAddToList(TabBoxClient* cl
TabBoxClientList TabBoxHandlerImpl::stackingOrder() const
{
ToplevelList stacking = Workspace::self()->stackingOrder();
QList<Toplevel *> stacking = Workspace::self()->stackingOrder();
TabBoxClientList ret;
foreach (Toplevel *toplevel, stacking) {
if (auto client = qobject_cast<AbstractClient*>(toplevel)) {

View file

@ -76,22 +76,6 @@ QDebug& operator<<(QDebug& stream, const Toplevel* cl)
return stream;
}
QDebug& operator<<(QDebug& stream, const ToplevelList& list)
{
stream << "LIST:(";
bool first = true;
for (ToplevelList::ConstIterator it = list.begin();
it != list.end();
++it) {
if (!first)
stream << ":";
first = false;
stream << *it;
}
stream << ")";
return stream;
}
QRect Toplevel::decorationRect() const
{
return rect();

View file

@ -1033,7 +1033,6 @@ inline bool Toplevel::isPopupWindow() const
}
QDebug& operator<<(QDebug& stream, const Toplevel*);
QDebug& operator<<(QDebug& stream, const ToplevelList&);
} // namespace
Q_DECLARE_METATYPE(KWin::Toplevel*)

View file

@ -1537,7 +1537,7 @@ bool Workspace::switchWindow(AbstractClient *c, Direction direction, QPoint curP
AbstractClient *switchTo = nullptr;
int bestScore = 0;
ToplevelList clist = stackingOrder();
QList<Toplevel *> clist = stackingOrder();
for (auto i = clist.rbegin(); i != clist.rend(); ++i) {
auto client = qobject_cast<AbstractClient*>(*i);
if (!client) {

View file

@ -50,14 +50,6 @@ class Deleted;
class Group;
class Options;
typedef QList< Toplevel* > ToplevelList;
typedef QList< X11Client *> ClientList;
typedef QList< const X11Client *> ConstClientList;
typedef QList< Unmanaged* > UnmanagedList;
typedef QList< Deleted* > DeletedList;
typedef QList< Group* > GroupList;
extern Options* options;
enum Layer {

View file

@ -537,12 +537,12 @@ Workspace::~Workspace()
// TODO: grabXServer();
// Use stacking_order, so that kwin --replace keeps stacking order
const ToplevelList stack = stacking_order;
const QList<Toplevel *> stack = stacking_order;
// "mutex" the stackingorder, since anything trying to access it from now on will find
// many dangeling pointers and crash
stacking_order.clear();
for (ToplevelList::const_iterator it = stack.constBegin(), end = stack.constEnd(); it != end; ++it) {
for (auto it = stack.constBegin(), end = stack.constEnd(); it != end; ++it) {
X11Client *c = qobject_cast<X11Client *>(const_cast<Toplevel*>(*it));
if (!c) {
continue;
@ -565,7 +565,7 @@ Workspace::~Workspace()
}
}
for (UnmanagedList::iterator it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it)
for (auto it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it)
(*it)->release(ReleaseReason::KWinShutsDown);
for (InternalClient *client : m_internalClients) {
@ -777,7 +777,7 @@ void Workspace::updateToolWindows(bool also_hide)
{
// TODO: What if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?)
if (!options->isHideUtilityWindowsForInactive()) {
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
for (auto it = clients.constBegin(); it != clients.constEnd(); ++it)
(*it)->hideClient(false);
return;
}
@ -799,7 +799,7 @@ void Workspace::updateToolWindows(bool also_hide)
// SELI TODO: But maybe it should - what if a new client has been added that's not in stacking order yet?
QVector<AbstractClient*> to_show, to_hide;
for (ToplevelList::ConstIterator it = stacking_order.constBegin();
for (auto it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it) {
auto c = qobject_cast<AbstractClient*>(*it);
@ -934,7 +934,7 @@ void Workspace::slotCurrentDesktopChanged(uint oldDesktop, uint newDesktop)
void Workspace::updateClientVisibilityOnDesktopChange(uint newDesktop)
{
for (ToplevelList::ConstIterator it = stacking_order.constBegin();
for (auto it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it) {
X11Client *c = qobject_cast<X11Client *>(*it);
@ -1002,7 +1002,7 @@ AbstractClient *Workspace::findClientToActivateOnDesktop(uint desktop)
}
// from actiavtion.cpp
if (options->isNextFocusPrefersMouse()) {
ToplevelList::const_iterator it = stackingOrder().constEnd();
auto it = stackingOrder().constEnd();
while (it != stackingOrder().constBegin()) {
X11Client *client = qobject_cast<X11Client *>(*(--it));
if (!client) {
@ -1045,7 +1045,7 @@ void Workspace::updateCurrentActivity(const QString &new_activity)
// mapping done from front to back => less exposure events
//Notify::raise((Notify::Event) (Notify::DesktopChange+new_desktop));
for (ToplevelList::ConstIterator it = stacking_order.constBegin();
for (auto it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it) {
X11Client *c = qobject_cast<X11Client *>(*it);
@ -1332,7 +1332,7 @@ void Workspace::disableGlobalShortcutsForClient(bool disable)
global_shortcuts_disabled_for_client = disable;
// Update also Alt+LMB actions etc.
for (ClientList::ConstIterator it = clients.constBegin();
for (auto it = clients.constBegin();
it != clients.constEnd();
++it)
(*it)->updateMouseGrab();

View file

@ -207,25 +207,25 @@ public:
/**
* @return List of clients currently managed by Workspace
*/
const ClientList &clientList() const {
const QList<X11Client *> &clientList() const {
return clients;
}
/**
* @return List of unmanaged "clients" currently registered in Workspace
*/
const UnmanagedList &unmanagedList() const {
const QList<Unmanaged *> &unmanagedList() const {
return unmanaged;
}
/**
* @return List of desktop "clients" currently managed by Workspace
*/
const ClientList &desktopList() const {
const QList<X11Client *> &desktopList() const {
return desktops;
}
/**
* @return List of deleted "clients" currently managed by Workspace
*/
const DeletedList &deletedList() const {
const QList<Deleted *> &deletedList() const {
return deleted;
}
/**
@ -269,9 +269,9 @@ public:
* Returns the list of clients sorted in stacking order, with topmost client
* at the last position
*/
const ToplevelList& stackingOrder() const;
ToplevelList xStackingOrder() const;
ClientList ensureStackingOrder(const ClientList& clients) const;
const QList<Toplevel *> &stackingOrder() const;
QList<Toplevel *> xStackingOrder() const;
QList<X11Client *> ensureStackingOrder(const QList<X11Client *> &clients) const;
QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const;
AbstractClient* topClientOnDesktop(int desktop, int screen, bool unconstrained = false,
@ -542,7 +542,7 @@ private:
bool switchWindow(AbstractClient *c, Direction direction, QPoint curPos, int desktop);
void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder
ToplevelList constrainedStackingOrder();
QList<Toplevel *> constrainedStackingOrder();
void raiseClientWithinApplication(AbstractClient* c);
void lowerClientWithinApplication(AbstractClient* c);
bool allowFullClientRaising(const AbstractClient* c, xcb_timestamp_t timestamp);
@ -591,18 +591,18 @@ private:
AbstractClient* delayfocus_client;
QPoint focusMousePos;
ClientList clients;
QList<X11Client *> clients;
QList<AbstractClient*> m_allClients;
ClientList desktops;
UnmanagedList unmanaged;
DeletedList deleted;
QList<X11Client *> desktops;
QList<Unmanaged *> unmanaged;
QList<Deleted *> deleted;
QList<InternalClient *> m_internalClients;
ToplevelList unconstrained_stacking_order; // Topmost last
ToplevelList stacking_order; // Topmost last
QList<Toplevel *> unconstrained_stacking_order; // Topmost last
QList<Toplevel *> stacking_order; // Topmost last
QVector<xcb_window_t> manual_overlays; //Topmost last
bool force_restacking;
ToplevelList x_stacking; // From XQueryTree()
QList<Toplevel *> x_stacking; // From XQueryTree()
std::unique_ptr<Xcb::Tree> m_xStackingQueryTree;
bool m_xStackingDirty = false;
QList<AbstractClient*> should_get_focus; // Last is most recent
@ -610,7 +610,7 @@ private:
bool showing_desktop;
GroupList groups;
QList<Group *> groups;
bool was_user_interaction;
QScopedPointer<X11EventFilter> m_wasUserInteractionFilter;
@ -730,7 +730,7 @@ inline void Workspace::removeGroup(Group* group)
groups.removeAll(group);
}
inline const ToplevelList& Workspace::stackingOrder() const
inline const QList<Toplevel *> &Workspace::stackingOrder() const
{
// TODO: Q_ASSERT( block_stacking_updates == 0 );
return stacking_order;

View file

@ -871,7 +871,7 @@ void X11Client::setShade(ShadeMode mode)
if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input()))
setActive(true);
if (shade_mode == ShadeHover) {
ToplevelList order = workspace()->stackingOrder();
QList<Toplevel *> order = workspace()->stackingOrder();
// invalidate, since "this" could be the topmost toplevel and shade_below dangeling
shade_below = nullptr;
// this is likely related to the index parameter?!

View file

@ -419,7 +419,7 @@ private:
void fetchIconicName();
QString readName() const;
void setCaption(const QString& s, bool force = false);
bool hasTransientInternal(const X11Client *c, bool indirect, ConstClientList& set) const;
bool hasTransientInternal(const X11Client *c, bool indirect, QList<const X11Client *> &set) const;
void setShortcutInternal() override;
void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool);