Make iterating over Layer enum simple
ClosedPublic

Authored by gladhorn on Aug 11 2019, 9:53 AM.

Details

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.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
gladhorn created this revision.Aug 11 2019, 9:53 AM
Restricted Application added a project: KWin. · View Herald TranscriptAug 11 2019, 9:53 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
gladhorn requested review of this revision.Aug 11 2019, 9:53 AM
romangg accepted this revision.Aug 11 2019, 10:38 AM
This revision is now accepted and ready to land.Aug 11 2019, 10:38 AM
zzag added a subscriber: zzag.Aug 11 2019, 1:56 PM

to iterate over the enum, is mostly confusing

I actually find it a bit cool because we're iterating through layers, but yeah this part can be simpler. :-)

layers.cpp
534

You don't need this static_cast.

zzag requested changes to this revision.Aug 11 2019, 1:56 PM
This revision now requires changes to proceed.Aug 11 2019, 1:56 PM
gladhorn marked an inline comment as done.Aug 11 2019, 2:02 PM
In D23085#510297, @zzag wrote:

to iterate over the enum, is mostly confusing

I actually find it a bit cool because we're iterating through layers, but yeah this part can be simpler. :-)

Yes, I was amused as well, but to understand what is going on I had to read code in two places instead of one.

layers.cpp
534

Nice, of course :)

gladhorn updated this revision to Diff 63544.Aug 11 2019, 2:11 PM
gladhorn marked an inline comment as done.

Removed, cast, made if one line.

zzag accepted this revision.Aug 11 2019, 2:20 PM
This revision is now accepted and ready to land.Aug 11 2019, 2:20 PM
This revision was automatically updated to reflect the committed changes.