Make iterating over Layer enum simple
ClosedPublic

Authored by gladhorn on Sun, Aug 11, 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.Sun, Aug 11, 9:53 AM
Restricted Application added a project: KWin. · View Herald TranscriptSun, Aug 11, 9:53 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
gladhorn requested review of this revision.Sun, Aug 11, 9:53 AM
romangg accepted this revision.Sun, Aug 11, 10:38 AM
This revision is now accepted and ready to land.Sun, Aug 11, 10:38 AM
zzag added a subscriber: zzag.Sun, Aug 11, 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.Sun, Aug 11, 1:56 PM
This revision now requires changes to proceed.Sun, Aug 11, 1:56 PM
gladhorn marked an inline comment as done.Sun, Aug 11, 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.Sun, Aug 11, 2:11 PM
gladhorn marked an inline comment as done.

Removed, cast, made if one line.

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