diff --git a/abstract_client.cpp b/abstract_client.cpp index 7c61bf9bd2..85713e50ce 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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(*it); diff --git a/activation.cpp b/activation.cpp index f98b25e96e..068cc60b53 100644 --- a/activation.cpp +++ b/activation.cpp @@ -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(*(--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 ret; const auto mcs = mainClients(); for (auto mc: mcs) { if (X11Client *c = dynamic_cast(mc)) { diff --git a/activities.cpp b/activities.cpp index 67418915b7..af8007f6d8 100644 --- a/activities.cpp +++ b/activities.cpp @@ -164,8 +164,8 @@ void Activities::reallyStop(const QString &id) QSet saveSessionIds; QSet dontCloseSessionIds; - const ClientList &clients = ws->clientList(); - for (ClientList::const_iterator it = clients.constBegin(); it != clients.constEnd(); ++it) { + const QList &clients = ws->clientList(); + for (auto it = clients.constBegin(); it != clients.constEnd(); ++it) { const X11Client *c = (*it); const QByteArray sessionId = c->sessionId(); if (sessionId.isEmpty()) { diff --git a/autotests/integration/activation_test.cpp b/autotests/integration/activation_test.cpp index 964474cd64..dd55386339 100644 --- a/autotests/integration/activation_test.cpp +++ b/autotests/integration/activation_test.cpp @@ -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 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 stackingOrder = workspace()->stackingOrder(); QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); QVERIFY(client1->isFullScreen()); QVERIFY(client2->isFullScreen()); diff --git a/autotests/integration/stacking_order_test.cpp b/autotests/integration/stacking_order_test.cpp index a5973280ea..bdefb40646 100644 --- a/autotests/integration/stacking_order_test.cpp +++ b/autotests/integration/stacking_order_test.cpp @@ -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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{member1, member2, leader, transient})); workspace()->activateClient(member1); QTRY_VERIFY(member1->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member2, leader, member1, transient})); + QCOMPARE(workspace()->stackingOrder(), (QList{member2, leader, member1, transient})); workspace()->activateClient(member2); QTRY_VERIFY(member2->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient})); + QCOMPARE(workspace()->stackingOrder(), (QList{leader, member1, member2, transient})); workspace()->activateClient(transient); QTRY_VERIFY(transient->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient})); + QCOMPARE(workspace()->stackingOrder(), (QList{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{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{leader, member1, member2, transient})); workspace()->activateClient(leader); QTRY_VERIFY(leader->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member1, member2, transient, leader})); + QCOMPARE(workspace()->stackingOrder(), (QList{member1, member2, transient, leader})); workspace()->activateClient(member1); QTRY_VERIFY(member1->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{member2, transient, leader, member1})); + QCOMPARE(workspace()->stackingOrder(), (QList{member2, transient, leader, member1})); workspace()->activateClient(member2); QTRY_VERIFY(member2->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{transient, leader, member1, member2})); + QCOMPARE(workspace()->stackingOrder(), (QList{transient, leader, member1, member2})); workspace()->activateClient(transient); QTRY_VERIFY(transient->isActive()); - QCOMPARE(workspace()->stackingOrder(), (ToplevelList{leader, member1, member2, transient})); + QCOMPARE(workspace()->stackingOrder(), (QList{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{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{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{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{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{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{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{clientB, clientA})); } WAYLANDTEST_MAIN(StackingOrderTest) diff --git a/composite.cpp b/composite.cpp index 935eeeee83..2fbf3e269c 100644 --- a/composite.cpp +++ b/composite.cpp @@ -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 windows = Workspace::self()->xStackingOrder(); + QList 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; diff --git a/deleted.h b/deleted.h index 4681d61ed8..bb7fe2f94c 100644 --- a/deleted.h +++ b/deleted.h @@ -162,7 +162,7 @@ public: * * Because the window is Deleted, it can have only Deleted child transients. */ - DeletedList transients() const { + QList 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 m_transientFor; + QList m_transients; bool m_wasPopupWindow; bool m_wasOutline; qreal m_bufferScale = 1; diff --git a/effects.cpp b/effects.cpp index b8a3c4312d..a64099dd0c 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1118,7 +1118,7 @@ EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const EffectWindowList EffectsHandlerImpl::stackingOrder() const { - ToplevelList list = Workspace::self()->xStackingOrder(); + QList list = Workspace::self()->xStackingOrder(); EffectWindowList ret; for (Toplevel *t : list) { if (EffectWindow *w = effectWindow(t)) diff --git a/geometry.cpp b/geometry.cpp index bdef7a8224..a106e93a27 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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); diff --git a/group.cpp b/group.cpp index 806f9a77d1..905e44d34d 100644 --- a/group.cpp +++ b/group.cpp @@ -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 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 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 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(cl)) { // checkGroupTransients() uses this to break loops, so hasTransient() must detect them - ConstClientList set; + QList 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 &set) const { if (const X11Client *t = dynamic_cast(cl->transientFor())) { if (t == this) @@ -742,7 +742,7 @@ QList X11Client::mainClients() const return QList{const_cast< AbstractClient* >(t)}; QList 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()) diff --git a/group.h b/group.h index ad55741fbf..41e5d9dce6 100644 --- a/group.h +++ b/group.h @@ -39,7 +39,7 @@ public: xcb_window_t leader() const; const X11Client *leaderClient() const; X11Client *leaderClient(); - const ClientList& members() const; + const QList &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 _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 &Group::members() const { return _members; } diff --git a/input.cpp b/input.cpp index 2b21c3b60f..f1b54be768 100644 --- a/input.cpp +++ b/input.cpp @@ -2132,7 +2132,7 @@ Toplevel *InputRedirection::findToplevel(const QPoint &pos) if (effects && static_cast(effects)->isMouseInterception()) { return nullptr; } - const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); + const QList &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 &stacking = Workspace::self()->stackingOrder(); if (stacking.isEmpty()) { return nullptr; } diff --git a/keyboard_input.cpp b/keyboard_input.cpp index 92ef612ba5..a6f3762653 100644 --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -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 &stacking = Workspace::self()->stackingOrder(); if (!stacking.isEmpty()) { auto it = stacking.end(); do { diff --git a/layers.cpp b/layers.cpp index f60e2659e1..151ff9dfc5 100644 --- a/layers.cpp +++ b/layers.cpp @@ -65,7 +65,7 @@ along with this program. If not, see . 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 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 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 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 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(*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(*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 Workspace::constrainedStackingOrder() { - ToplevelList layer[ NumLayers ]; + QList layer[ NumLayers ]; // build the order from layers QVector< QMap > 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 stacking; for (int lay = FirstLayer; lay < NumLayers; ++lay) { stacking += layer[lay]; } @@ -636,7 +636,7 @@ void Workspace::blockStackingUpdates(bool block) namespace { template -QList ensureStackingOrderInList(const ToplevelList &stackingOrder, const QList &list) +QList ensureStackingOrderInList(const QList &stackingOrder, const QList &list) { static_assert(std::is_base_of::value, "U must be derived from T"); @@ -660,7 +660,7 @@ QList ensureStackingOrderInList(const ToplevelList &stackingOrder, const QLi } // Ensure list is in stacking order -ClientList Workspace::ensureStackingOrder(const ClientList& list) const +QList Workspace::ensureStackingOrder(const QList &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 Workspace::xStackingOrder() const { if (m_xStackingDirty) { const_cast(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) { diff --git a/placement.cpp b/placement.cpp index a891f7c0d5..4d12cccd84 100644 --- a/placement.cpp +++ b/placement.cpp @@ -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(*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(*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(*l); if (isIrrelevant(client, c, desktop)) { continue; diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 8693bdc2dc..1953ab4b38 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -637,7 +637,7 @@ void SceneOpenGL2::paintCursor() glDisable(GL_BLEND); } -qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels) +qint64 SceneOpenGL::paint(QRegion damage, QList toplevels) { // actually paint the frame, flushed with the NEXT frame createStackingOrder(toplevels); diff --git a/plugins/scenes/opengl/scene_opengl.h b/plugins/scenes/opengl/scene_opengl.h index 4d8b2d31e5..55622aca2c 100644 --- a/plugins/scenes/opengl/scene_opengl.h +++ b/plugins/scenes/opengl/scene_opengl.h @@ -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 windows) override; Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override; Shadow *createShadow(Toplevel *toplevel) override; void screenGeometryChanged(const QSize &size) override; diff --git a/plugins/scenes/qpainter/scene_qpainter.cpp b/plugins/scenes/qpainter/scene_qpainter.cpp index 3ae749df3a..93b6c49c1e 100644 --- a/plugins/scenes/qpainter/scene_qpainter.cpp +++ b/plugins/scenes/qpainter/scene_qpainter.cpp @@ -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 toplevels) { QElapsedTimer renderTimer; renderTimer.start(); diff --git a/plugins/scenes/qpainter/scene_qpainter.h b/plugins/scenes/qpainter/scene_qpainter.h index 7aef28e3ba..e2c844d3f8 100644 --- a/plugins/scenes/qpainter/scene_qpainter.h +++ b/plugins/scenes/qpainter/scene_qpainter.h @@ -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 windows) override; void paintGenericScreen(int mask, ScreenPaintData data) override; CompositingType compositingType() const override; bool initFailed() const override; diff --git a/plugins/scenes/xrender/scene_xrender.cpp b/plugins/scenes/xrender/scene_xrender.cpp index d9aaa1ecf5..3335e46d6f 100644 --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -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 toplevels) { QElapsedTimer renderTimer; renderTimer.start(); diff --git a/plugins/scenes/xrender/scene_xrender.h b/plugins/scenes/xrender/scene_xrender.h index 7520ee34dd..47c041bc5b 100644 --- a/plugins/scenes/xrender/scene_xrender.h +++ b/plugins/scenes/xrender/scene_xrender.h @@ -154,7 +154,7 @@ public: CompositingType compositingType() const override { return XRenderCompositing; } - qint64 paint(QRegion damage, ToplevelList windows) override; + qint64 paint(QRegion damage, QList windows) override; Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override; Shadow *createShadow(Toplevel *toplevel) override; void screenGeometryChanged(const QSize &size) override; diff --git a/scene.cpp b/scene.cpp index 2920a4a71d..b466046b54 100644 --- a/scene.cpp +++ b/scene.cpp @@ -441,7 +441,7 @@ void Scene::windowGeometryShapeChanged(Toplevel *c) w->discardShape(); } -void Scene::createStackingOrder(ToplevelList toplevels) +void Scene::createStackingOrder(QList toplevels) { // TODO: cache the stacking_order in case it has not changed foreach (Toplevel *c, toplevels) { diff --git a/scene.h b/scene.h index 2430970ac6..7e7aee5847 100644 --- a/scene.h +++ b/scene.h @@ -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 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 toplevels); void clearStackingOrder(); // shared implementation, starts painting the screen void paintScreen(int *mask, const QRegion &damage, const QRegion &repaint, diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index d8f8674b8e..682a025754 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -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 &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 &clients = Workspace::self()->clientList(); + for (auto it = clients.begin(); it != clients.end(); ++it) { checkClient((*it)); } if (waylandServer()) { diff --git a/sm.cpp b/sm.cpp index e1aa8bca27..140a34dda9 100644 --- a/sm.cpp +++ b/sm.cpp @@ -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 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; diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index e1143c956e..c9b031d9df 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -283,7 +283,7 @@ QWeakPointer TabBoxHandlerImpl::clientToAddToList(TabBoxClient* cl TabBoxClientList TabBoxHandlerImpl::stackingOrder() const { - ToplevelList stacking = Workspace::self()->stackingOrder(); + QList stacking = Workspace::self()->stackingOrder(); TabBoxClientList ret; foreach (Toplevel *toplevel, stacking) { if (auto client = qobject_cast(toplevel)) { diff --git a/toplevel.cpp b/toplevel.cpp index d66aac3ff2..3a11f30bd7 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -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(); diff --git a/toplevel.h b/toplevel.h index 772f5e30f1..32266a13ea 100644 --- a/toplevel.h +++ b/toplevel.h @@ -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*) diff --git a/useractions.cpp b/useractions.cpp index 361ed0e4a9..54f4827c04 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -1537,7 +1537,7 @@ bool Workspace::switchWindow(AbstractClient *c, Direction direction, QPoint curP AbstractClient *switchTo = nullptr; int bestScore = 0; - ToplevelList clist = stackingOrder(); + QList clist = stackingOrder(); for (auto i = clist.rbegin(); i != clist.rend(); ++i) { auto client = qobject_cast(*i); if (!client) { diff --git a/utils.h b/utils.h index 85a0c5c810..a66b8232c9 100644 --- a/utils.h +++ b/utils.h @@ -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 { diff --git a/workspace.cpp b/workspace.cpp index f6a3cca472..8b35459ac2 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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 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(const_cast(*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 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(*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(*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(*(--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(*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(); diff --git a/workspace.h b/workspace.h index 639e969d23..bbe955d338 100644 --- a/workspace.h +++ b/workspace.h @@ -207,25 +207,25 @@ public: /** * @return List of clients currently managed by Workspace */ - const ClientList &clientList() const { + const QList &clientList() const { return clients; } /** * @return List of unmanaged "clients" currently registered in Workspace */ - const UnmanagedList &unmanagedList() const { + const QList &unmanagedList() const { return unmanaged; } /** * @return List of desktop "clients" currently managed by Workspace */ - const ClientList &desktopList() const { + const QList &desktopList() const { return desktops; } /** * @return List of deleted "clients" currently managed by Workspace */ - const DeletedList &deletedList() const { + const QList &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 &stackingOrder() const; + QList xStackingOrder() const; + QList ensureStackingOrder(const QList &clients) const; QList ensureStackingOrder(const QList &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 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 clients; QList m_allClients; - ClientList desktops; - UnmanagedList unmanaged; - DeletedList deleted; + QList desktops; + QList unmanaged; + QList deleted; QList m_internalClients; - ToplevelList unconstrained_stacking_order; // Topmost last - ToplevelList stacking_order; // Topmost last + QList unconstrained_stacking_order; // Topmost last + QList stacking_order; // Topmost last QVector manual_overlays; //Topmost last bool force_restacking; - ToplevelList x_stacking; // From XQueryTree() + QList x_stacking; // From XQueryTree() std::unique_ptr m_xStackingQueryTree; bool m_xStackingDirty = false; QList should_get_focus; // Last is most recent @@ -610,7 +610,7 @@ private: bool showing_desktop; - GroupList groups; + QList groups; bool was_user_interaction; QScopedPointer m_wasUserInteractionFilter; @@ -730,7 +730,7 @@ inline void Workspace::removeGroup(Group* group) groups.removeAll(group); } -inline const ToplevelList& Workspace::stackingOrder() const +inline const QList &Workspace::stackingOrder() const { // TODO: Q_ASSERT( block_stacking_updates == 0 ); return stacking_order; diff --git a/x11client.cpp b/x11client.cpp index e5e0aa90d0..76a504c75e 100644 --- a/x11client.cpp +++ b/x11client.cpp @@ -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 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?! diff --git a/x11client.h b/x11client.h index 06867d9054..34bb1371d7 100644 --- a/x11client.h +++ b/x11client.h @@ -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 &set) const; void setShortcutInternal() override; void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool);