Drop EffectWindowList

Use `QList<EffectWindow *>` instead.
This commit is contained in:
Vlad Zahorodnii 2023-11-20 15:02:51 +02:00
parent b28d2c2d80
commit 433b753360
12 changed files with 38 additions and 40 deletions

View file

@ -904,10 +904,10 @@ EffectWindow *EffectsHandler::findWindow(const QUuid &id) const
return nullptr;
}
EffectWindowList EffectsHandler::stackingOrder() const
QList<EffectWindow *> EffectsHandler::stackingOrder() const
{
QList<Window *> list = workspace()->stackingOrder();
EffectWindowList ret;
QList<EffectWindow *> ret;
for (Window *t : list) {
if (EffectWindow *w = t->effectWindow()) {
ret.append(w);
@ -937,11 +937,11 @@ void EffectsHandler::setTabBoxWindow(EffectWindow *w)
#endif
}
EffectWindowList EffectsHandler::currentTabBoxWindowList() const
QList<EffectWindow *> EffectsHandler::currentTabBoxWindowList() const
{
#if KWIN_BUILD_TABBOX
const auto clients = workspace()->tabbox()->currentClientList();
EffectWindowList ret;
QList<EffectWindow *> ret;
ret.reserve(clients.size());
std::transform(std::cbegin(clients), std::cend(clients),
std::back_inserter(ret),
@ -950,7 +950,7 @@ EffectWindowList EffectsHandler::currentTabBoxWindowList() const
});
return ret;
#else
return EffectWindowList();
return QList<EffectWindow *>();
#endif
}
@ -2021,10 +2021,10 @@ QWindow *EffectWindow::internalWindow() const
}
template<typename T>
EffectWindowList getMainWindows(T *c)
QList<EffectWindow *> getMainWindows(T *c)
{
const auto mainwindows = c->mainWindows();
EffectWindowList ret;
QList<EffectWindow *> ret;
ret.reserve(mainwindows.size());
std::transform(std::cbegin(mainwindows), std::cend(mainwindows),
std::back_inserter(ret),
@ -2034,7 +2034,7 @@ EffectWindowList getMainWindows(T *c)
return ret;
}
EffectWindowList EffectWindow::mainWindows() const
QList<EffectWindow *> EffectWindow::mainWindows() const
{
return getMainWindows(d->m_window);
}
@ -2108,10 +2108,10 @@ EffectWindowGroup::~EffectWindowGroup()
{
}
EffectWindowList EffectWindowGroup::members() const
QList<EffectWindow *> EffectWindowGroup::members() const
{
const auto memberList = m_group->members();
EffectWindowList ret;
QList<EffectWindow *> ret;
ret.reserve(memberList.size());
std::transform(std::cbegin(memberList), std::cend(memberList), std::back_inserter(ret), [](auto window) {
return window->effectWindow();

View file

@ -81,7 +81,6 @@ class WorkspaceScene;
class VirtualDesktop;
typedef QPair<QString, Effect *> EffectPair;
typedef QList<KWin::EffectWindow *> EffectWindowList;
/**
* EffectWindow::setData() and EffectWindow::data() global roles.
@ -136,7 +135,7 @@ class KWIN_EXPORT EffectsHandler : public QObject
* if used manually.
*/
Q_PROPERTY(qreal animationTimeFactor READ animationTimeFactor)
Q_PROPERTY(KWin::EffectWindowList stackingOrder READ stackingOrder)
Q_PROPERTY(QList<EffectWindow *> stackingOrder READ stackingOrder)
/**
* Whether window decorations use the alpha channel.
*/
@ -440,12 +439,12 @@ public:
* @since 5.16
*/
Q_SCRIPTABLE KWin::EffectWindow *findWindow(const QUuid &id) const;
EffectWindowList stackingOrder() const;
QList<EffectWindow *> stackingOrder() const;
// window will be temporarily painted as if being at the top of the stack
Q_SCRIPTABLE void setElevatedWindow(KWin::EffectWindow *w, bool set);
void setTabBoxWindow(EffectWindow *);
EffectWindowList currentTabBoxWindowList() const;
QList<EffectWindow *> currentTabBoxWindowList() const;
void refTabBox();
void unrefTabBox();
void closeTabBox();
@ -1638,7 +1637,7 @@ public:
bool isModal() const;
Q_SCRIPTABLE KWin::EffectWindow *findModal();
Q_SCRIPTABLE KWin::EffectWindow *transientFor();
Q_SCRIPTABLE KWin::EffectWindowList mainWindows() const;
Q_SCRIPTABLE QList<KWin::EffectWindow *> mainWindows() const;
/**
* Returns whether the window should be excluded from window switching effects.
@ -2056,7 +2055,7 @@ public:
explicit EffectWindowGroup(Group *group);
virtual ~EffectWindowGroup();
EffectWindowList members() const;
QList<EffectWindow *> members() const;
private:
Group *m_group;
@ -2083,6 +2082,5 @@ inline void EffectWindow::addLayerRepaint(int x, int y, int w, int h)
} // namespace
Q_DECLARE_METATYPE(KWin::EffectWindow *)
Q_DECLARE_METATYPE(KWin::EffectWindowList)
/** @} */

View file

@ -70,7 +70,7 @@ ContrastEffect::ContrastEffect()
});
// Fetch the contrast regions for all windows
const EffectWindowList windowList = effects->stackingOrder();
const QList<EffectWindow *> windowList = effects->stackingOrder();
for (EffectWindow *window : windowList) {
slotWindowAdded(window);
}
@ -92,7 +92,7 @@ void ContrastEffect::slotScreenGeometryChanged()
return;
}
const EffectWindowList windowList = effects->stackingOrder();
const QList<EffectWindow *> windowList = effects->stackingOrder();
for (EffectWindow *window : windowList) {
updateContrastRegion(window);
}

View file

@ -44,7 +44,7 @@ void KWin::BlendChanges::start(int delay)
return;
}
const EffectWindowList allWindows = effects->stackingOrder();
const QList<EffectWindow *> allWindows = effects->stackingOrder();
for (auto window : allWindows) {
if (!window->isFullScreen()) {
redirect(window);
@ -71,7 +71,7 @@ void BlendChanges::postPaintScreen()
m_timeline.reset();
m_state = Off;
const EffectWindowList allWindows = effects->stackingOrder();
const QList<EffectWindow *> allWindows = effects->stackingOrder();
for (auto window : allWindows) {
unredirect(window);
}

View file

@ -159,7 +159,7 @@ void HighlightWindowEffect::slotPropertyNotify(EffectWindow *w, long a, EffectWi
void HighlightWindowEffect::prepareHighlighting()
{
const EffectWindowList windows = effects->stackingOrder();
const QList<EffectWindow *> windows = effects->stackingOrder();
for (EffectWindow *window : windows) {
if (!isHighlightWindow(window)) {
continue;
@ -174,7 +174,7 @@ void HighlightWindowEffect::prepareHighlighting()
void HighlightWindowEffect::finishHighlighting()
{
const EffectWindowList windows = effects->stackingOrder();
const QList<EffectWindow *> windows = effects->stackingOrder();
for (EffectWindow *window : windows) {
if (isHighlightWindow(window)) {
startRevertAnimation(window);

View file

@ -336,7 +336,7 @@ void SlideEffect::finishedSwitching()
if (m_state == State::Inactive) {
return;
}
const EffectWindowList windows = effects->stackingOrder();
const QList<EffectWindow *> windows = effects->stackingOrder();
for (EffectWindow *w : windows) {
w->setData(WindowForceBackgroundContrastRole, QVariant());
w->setData(WindowForceBlurRole, QVariant());

View file

@ -128,7 +128,7 @@ private:
EffectWindowVisibleRef visibilityRef;
};
EffectWindowList m_elevatedWindows;
QList<EffectWindow *> m_elevatedWindows;
QHash<EffectWindow *, WindowData> m_windowData;
};

View file

@ -167,7 +167,7 @@ public:
/**
* Register a list of windows for managing.
*/
inline void manage(const EffectWindowList &list)
inline void manage(const QList<EffectWindow *> &list)
{
for (int i = 0; i < list.size(); i++) {
manage(list.at(i));
@ -257,7 +257,7 @@ public:
/**
* Return a list of all currently registered windows.
*/
inline EffectWindowList managedWindows() const
inline QList<EffectWindow *> managedWindows() const
{
return m_managedWindows.keys();
}

View file

@ -36,8 +36,8 @@ void SlideBackEffect::slotStackingOrderChanged()
return;
}
EffectWindowList newStackingOrder = effects->stackingOrder(),
usableNewStackingOrder = usableWindows(newStackingOrder);
QList<EffectWindow *> newStackingOrder = effects->stackingOrder(),
usableNewStackingOrder = usableWindows(newStackingOrder);
if (usableNewStackingOrder == usableOldStackingOrder || usableNewStackingOrder.isEmpty()) {
oldStackingOrder = newStackingOrder;
usableOldStackingOrder = usableNewStackingOrder;
@ -142,7 +142,7 @@ void SlideBackEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mill
data.mask |= Effect::PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
}
const EffectWindowList windows = effects->stackingOrder();
const QList<EffectWindow *> windows = effects->stackingOrder();
for (auto *w : windows) {
w->setData(WindowForceBlurRole, QVariant(true));
}
@ -192,7 +192,7 @@ void SlideBackEffect::postPaintWindow(EffectWindow *w)
// If we are still intersecting with the upmostWindow it is moving. slide to somewhere else
// restore the stacking order of all windows not intersecting any more except panels
if (coveringWindows.contains(w)) {
EffectWindowList tmpList;
QList<EffectWindow *> tmpList;
for (EffectWindow *tmp : std::as_const(elevatedList)) {
QRect elevatedGeometry = tmp->frameGeometry().toRect();
if (motionManager.isManaging(tmp)) {
@ -311,9 +311,9 @@ bool SlideBackEffect::intersects(EffectWindow *windowUnder, const QRect &windowO
return windowUnderGeometry.intersects(windowOverGeometry);
}
EffectWindowList SlideBackEffect::usableWindows(const EffectWindowList &allWindows)
QList<EffectWindow *> SlideBackEffect::usableWindows(const QList<EffectWindow *> &allWindows)
{
EffectWindowList retList;
QList<EffectWindow *> retList;
auto isWindowVisible = [](const EffectWindow *window) {
return window && effects->virtualScreenGeometry().intersects(window->frameGeometry().toAlignedRect());
};

View file

@ -46,10 +46,10 @@ public Q_SLOTS:
private:
WindowMotionManager motionManager;
EffectWindowList usableOldStackingOrder;
EffectWindowList oldStackingOrder;
EffectWindowList coveringWindows;
EffectWindowList elevatedList;
QList<EffectWindow *> usableOldStackingOrder;
QList<EffectWindow *> oldStackingOrder;
QList<EffectWindow *> coveringWindows;
QList<EffectWindow *> elevatedList;
EffectWindow *m_justMapped, *m_upmostWindow;
QHash<EffectWindow *, QRect> destinationList;
int m_tabboxActive;
@ -59,7 +59,7 @@ private:
QRect getSlideDestination(const QRect &windowUnderGeometry, const QRect &windowOverGeometry);
bool isWindowUsable(EffectWindow *w);
bool intersects(EffectWindow *windowUnder, const QRect &windowOverGeometry);
EffectWindowList usableWindows(const EffectWindowList &allWindows);
QList<EffectWindow *> usableWindows(const QList<EffectWindow *> &allWindows);
QRect getModalGroupGeometry(EffectWindow *w);
void windowRaised(EffectWindow *w);
};

View file

@ -67,7 +67,7 @@ SlidingPopupsEffect::SlidingPopupsEffect()
reconfigure(ReconfigureAll);
const EffectWindowList windows = effects->stackingOrder();
const QList<EffectWindow *> windows = effects->stackingOrder();
for (EffectWindow *window : windows) {
setupSlideData(window);
}

View file

@ -211,7 +211,7 @@ ScriptedEffect::~ScriptedEffect() = default;
bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript)
{
qRegisterMetaType<QJSValueList>();
qRegisterMetaType<EffectWindowList>();
qRegisterMetaType<QList<KWin::EffectWindow *>>();
QFile scriptFile(pathToScript);
if (!scriptFile.open(QIODevice::ReadOnly)) {