From 9bf6e2bd68691b79d0e79999c7644506e4442920 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 31 Aug 2021 09:41:22 +0300 Subject: [PATCH] Port Workspace::supportInformation() to AbstractOutput --- src/screens.cpp | 32 -------------------------------- src/screens.h | 10 ---------- src/workspace.cpp | 23 +++++++++++++---------- 3 files changed, 13 insertions(+), 52 deletions(-) diff --git a/src/screens.cpp b/src/screens.cpp index 3c972d06e4..59cedb90df 100644 --- a/src/screens.cpp +++ b/src/screens.cpp @@ -15,8 +15,6 @@ #include #include #include "platform.h" -#include "wayland_server.h" -#include "abstract_wayland_output.h" namespace KWin { @@ -185,36 +183,6 @@ int Screens::physicalDpiY(int screen) const return size(screen).height() / physicalSize(screen).height() * qreal(25.4); } -bool Screens::isVrrCapable(int screen) const -{ -#ifdef KWIN_UNIT_TEST - Q_UNUSED(screen); - return false; -#else - if (auto output = findOutput(screen)) { - if (auto waylandoutput = dynamic_cast(output)) { - return waylandoutput->capabilities() & AbstractWaylandOutput::Capability::Vrr; - } - } -#endif - return true; -} - -RenderLoop::VrrPolicy Screens::vrrPolicy(int screen) const -{ -#ifdef KWIN_UNIT_TEST - Q_UNUSED(screen); - return RenderLoop::VrrPolicy::Never; -#else - if (auto output = findOutput(screen)) { - if (auto waylandOutput = dynamic_cast(output)) { - return waylandOutput->vrrPolicy(); - } - } - return RenderLoop::VrrPolicy::Never; -#endif -} - int Screens::number(const QPoint &pos) const { // TODO: Do something about testScreens and other tests that use MockScreens. diff --git a/src/screens.h b/src/screens.h index a1ac40bddd..fd98b33356 100644 --- a/src/screens.h +++ b/src/screens.h @@ -11,7 +11,6 @@ // KWin includes #include -#include // KDE includes #include #include @@ -111,15 +110,6 @@ public: int physicalDpiX(int screen) const; int physicalDpiY(int screen) const; - /** - * @returns @c true if the @p screen is capable of variable refresh rate and if the platform can use it - */ - bool isVrrCapable(int screen) const; - /** - * @returns the vrr policy of the @p screen - */ - RenderLoop::VrrPolicy vrrPolicy(int screen) const; - Q_SIGNALS: void countChanged(int previousCount, int newCount); /** diff --git a/src/workspace.cpp b/src/workspace.cpp index 6721c29ed4..6151060f76 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -13,7 +13,7 @@ // kwin libs #include // kwin -#include "abstract_output.h" +#include "abstract_wayland_output.h" #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" #endif @@ -1614,23 +1614,26 @@ QString Workspace::supportInformation() const support.append(QStringLiteral(" yes\n")); else support.append(QStringLiteral(" no\n")); - support.append(QStringLiteral("Number of Screens: %1\n\n").arg(screens()->count())); - for (int i=0; icount(); ++i) { - const QRect geo = screens()->geometry(i); + const QVector outputs = kwinApp()->platform()->enabledOutputs(); + support.append(QStringLiteral("Number of Screens: %1\n\n").arg(outputs.count())); + for (int i = 0; i < outputs.count(); ++i) { + const auto output = outputs[i]; + const QRect geo = outputs[i]->geometry(); support.append(QStringLiteral("Screen %1:\n").arg(i)); support.append(QStringLiteral("---------\n")); - support.append(QStringLiteral("Name: %1\n").arg(screens()->name(i))); + support.append(QStringLiteral("Name: %1\n").arg(output->name())); support.append(QStringLiteral("Geometry: %1,%2,%3x%4\n") .arg(geo.x()) .arg(geo.y()) .arg(geo.width()) .arg(geo.height())); - support.append(QStringLiteral("Scale: %1\n").arg(screens()->scale(i))); - support.append(QStringLiteral("Refresh Rate: %1\n").arg(screens()->refreshRate(i))); - if (waylandServer()) { + support.append(QStringLiteral("Scale: %1\n").arg(output->scale())); + support.append(QStringLiteral("Refresh Rate: %1\n").arg(output->refreshRate())); + const auto waylandOutput = qobject_cast(output); + if (waylandOutput) { QString vrr = QStringLiteral("incapable"); - if (screens()->isVrrCapable(i)) { - switch(screens()->vrrPolicy(i)) { + if (waylandOutput->capabilities() & AbstractWaylandOutput::Capability::Vrr) { + switch (waylandOutput->vrrPolicy()) { case RenderLoop::VrrPolicy::Never: vrr = QStringLiteral("never"); break;