[drm] Code cleanup in DrmOutput class
ClosedPublic

Authored by romangg on Nov 9 2018, 9:59 PM.

Details

Reviewers
None
Group Reviewers
KWin
Commits
R108:0af57d6366e6: [drm] Code cleanup in DrmOutput class
Summary

Removes unneeded includes and reorders the code in a sensible way.

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.
romangg created this revision.Nov 9 2018, 9:59 PM
Restricted Application added a project: KWin. · View Herald TranscriptNov 9 2018, 9:59 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
romangg requested review of this revision.Nov 9 2018, 9:59 PM

why are we moving methods about?

why are we moving methods about?

For readability of the file. initCursor should be close to the other init functions. static fromWaylandDpmsMode and toWaylandDpmsMode above the function, which actually uses them. The two simple getters currentRefreshRate and pixelSize also next to each other.

The include changes are obviously sensible. +2 on that.

Some people in kwin are quite particular about git history tracking, I personally don't care either way, but I'm reluctant to click accept.

git history tracking

I believe the git history is fine as long as lines are only moved around in a commit and not otherwise edited. At least git blame works as intended with the -M option:

$ git blame -L 600,610 plugins/platforms/drm/drm_output.cpp
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 600)     switch (mode) {
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 601)     case DrmOutput::DpmsMode::On:
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 602)         return OutputInterface::DpmsMode::On;
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 603)     case DrmOutput::DpmsMode::Standby:
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 604)         return OutputInterface::DpmsMode::Standby;
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 605)     case DrmOutput::DpmsMode::Suspend:
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 606)         return OutputInterface::DpmsMode::Suspend;
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 607)     case DrmOutput::DpmsMode::Off:
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 608)         return OutputInterface::DpmsMode::Off;
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 609)     default:
b21de43b96 (Roman Gilg 2018-11-09 22:58:23 +0100 610)         Q_UNREACHABLE();

$ git blame -M -L 600,610 plugins/platforms/drm/drm_output.cpp
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 600)     switch (mode) {
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 601)     case DrmOutput::DpmsMode::On:
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 602)         return OutputInterface::DpmsMode::On;
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 603)     case DrmOutput::DpmsMode::Standby:
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 604)         return OutputInterface::DpmsMode::Standby;
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 605)     case DrmOutput::DpmsMode::Suspend:
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 606)         return OutputInterface::DpmsMode::Suspend;
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 607)     case DrmOutput::DpmsMode::Off:
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 608)         return OutputInterface::DpmsMode::Off;
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 609)     default:
629cc70123 backends/drm/drm_output.cpp (Sebastian Kügler 2016-03-21 15:11:17 +0100 610)         Q_UNREACHABLE();
This revision was not accepted when it landed; it landed in state Needs Review.Nov 14 2018, 7:03 PM
This revision was automatically updated to reflect the committed changes.