Make iterating over Layer enum simple

Summary:
Having a function with a confusing comment, to iterate over the enum,
is mostly confusing. Make it boring by just moving the cast to the one
place that uses it.

Reviewers: #kwin, romangg, zzag

Reviewed By: #kwin, romangg, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23085
This commit is contained in:
Frederik Gladhorn 2019-08-11 16:23:03 +02:00
parent dd944b2d5e
commit 969403b35f
2 changed files with 3 additions and 10 deletions

View file

@ -530,10 +530,9 @@ ToplevelList Workspace::constrainedStackingOrder()
layer[ l ].append(*it);
}
ToplevelList stacking;
for (Layer lay = FirstLayer;
lay < NumLayers;
++lay)
stacking += layer[ lay ];
for (int lay = FirstLayer; lay < NumLayers; ++lay) {
stacking += layer[lay];
}
// now keep transients above their mainwindows
// TODO this could(?) use some optimization
for (int i = stacking.size() - 1; i >= 0;) {

View file

@ -90,12 +90,6 @@ enum Layer {
NumLayers // number of layers, must be last
};
// yes, I know this is not 100% like standard operator++
inline void operator++(Layer& lay)
{
lay = static_cast< Layer >(lay + 1);
}
enum StrutArea {
StrutAreaInvalid = 0, // Null
StrutAreaTop = 1 << 0,