diff --git a/backends/kwayland/waylandscreen.h b/backends/kwayland/waylandscreen.h --- a/backends/kwayland/waylandscreen.h +++ b/backends/kwayland/waylandscreen.h @@ -15,9 +15,7 @@ * License along with this library; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ - -#ifndef KSCREEN_WAYLAND_SCREEN_H -#define KSCREEN_WAYLAND_SCREEN_H +#pragma once #include "abstractbackend.h" #include "config.h" @@ -37,7 +35,7 @@ public: explicit WaylandScreen(WaylandConfig *config); - ~WaylandScreen() override; + ~WaylandScreen() override = default; KScreen::ScreenPtr toKScreenScreen(KScreen::ConfigPtr &parent) const; void updateKScreenScreen(KScreen::ScreenPtr &screen) const; @@ -51,6 +49,4 @@ int m_outputCount; }; -} // namespace - -#endif // KSCREEN_WAYLAND_SCREEN_H +} diff --git a/backends/kwayland/waylandscreen.cpp b/backends/kwayland/waylandscreen.cpp --- a/backends/kwayland/waylandscreen.cpp +++ b/backends/kwayland/waylandscreen.cpp @@ -15,50 +15,51 @@ * License along with this library; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ +#include "waylandscreen.h" #include "waylandconfig.h" -#include "waylandscreen.h" #include "waylandoutput.h" #include - using namespace KScreen; WaylandScreen::WaylandScreen(WaylandConfig *config) : QObject(config) , m_outputCount(0) { } -WaylandScreen::~WaylandScreen() -{ -} - ScreenPtr WaylandScreen::toKScreenScreen(KScreen::ConfigPtr &parent) const { Q_UNUSED(parent); + KScreen::ScreenPtr kscreenScreen(new KScreen::Screen); updateKScreenScreen(kscreenScreen); return kscreenScreen; } void WaylandScreen::setOutputs(const QList &outputs) { m_outputCount = outputs.count(); + QRect r; - Q_FOREACH (auto o, outputs) { - if (o->enabled()) { - r |= QRect(o->outputDevice()->globalPosition(), o->outputDevice()->pixelSize() / o->outputDevice()->scale()); + for (auto *out : outputs) { + if (out->enabled()) { + const auto *dev = out->outputDevice(); + r |= QRect(dev->globalPosition(), dev->pixelSize() / dev->scale()); } } m_size = r.size(); } void WaylandScreen::updateKScreenScreen(KScreen::ScreenPtr &screen) const { screen->setMinSize(QSize(0, 0)); - screen->setMaxSize(QSize(64000, 64000)); // 64000^2 should be enough for everyone. + + // 64000^2 should be enough for everyone. + screen->setMaxSize(QSize(64000, 64000)); + screen->setCurrentSize(m_size); screen->setMaxActiveOutputsCount(m_outputCount); }