Port Workspace::supportInformation() to AbstractOutput
This commit is contained in:
parent
1b2e8437ac
commit
9bf6e2bd68
3 changed files with 13 additions and 52 deletions
|
@ -15,8 +15,6 @@
|
||||||
#include <workspace.h>
|
#include <workspace.h>
|
||||||
#include <config-kwin.h>
|
#include <config-kwin.h>
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "wayland_server.h"
|
|
||||||
#include "abstract_wayland_output.h"
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -185,36 +183,6 @@ int Screens::physicalDpiY(int screen) const
|
||||||
return size(screen).height() / physicalSize(screen).height() * qreal(25.4);
|
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<AbstractWaylandOutput*>(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<AbstractWaylandOutput *>(output)) {
|
|
||||||
return waylandOutput->vrrPolicy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RenderLoop::VrrPolicy::Never;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int Screens::number(const QPoint &pos) const
|
int Screens::number(const QPoint &pos) const
|
||||||
{
|
{
|
||||||
// TODO: Do something about testScreens and other tests that use MockScreens.
|
// TODO: Do something about testScreens and other tests that use MockScreens.
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
// KWin includes
|
// KWin includes
|
||||||
#include <kwinglobals.h>
|
#include <kwinglobals.h>
|
||||||
#include <renderloop.h>
|
|
||||||
// KDE includes
|
// KDE includes
|
||||||
#include <KConfig>
|
#include <KConfig>
|
||||||
#include <KSharedConfig>
|
#include <KSharedConfig>
|
||||||
|
@ -111,15 +110,6 @@ public:
|
||||||
int physicalDpiX(int screen) const;
|
int physicalDpiX(int screen) const;
|
||||||
int physicalDpiY(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:
|
Q_SIGNALS:
|
||||||
void countChanged(int previousCount, int newCount);
|
void countChanged(int previousCount, int newCount);
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// kwin libs
|
// kwin libs
|
||||||
#include <kwinglplatform.h>
|
#include <kwinglplatform.h>
|
||||||
// kwin
|
// kwin
|
||||||
#include "abstract_output.h"
|
#include "abstract_wayland_output.h"
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
#ifdef KWIN_BUILD_ACTIVITIES
|
||||||
#include "activities.h"
|
#include "activities.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1614,23 +1614,26 @@ QString Workspace::supportInformation() const
|
||||||
support.append(QStringLiteral(" yes\n"));
|
support.append(QStringLiteral(" yes\n"));
|
||||||
else
|
else
|
||||||
support.append(QStringLiteral(" no\n"));
|
support.append(QStringLiteral(" no\n"));
|
||||||
support.append(QStringLiteral("Number of Screens: %1\n\n").arg(screens()->count()));
|
const QVector<AbstractOutput *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||||
for (int i=0; i<screens()->count(); ++i) {
|
support.append(QStringLiteral("Number of Screens: %1\n\n").arg(outputs.count()));
|
||||||
const QRect geo = screens()->geometry(i);
|
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("Screen %1:\n").arg(i));
|
||||||
support.append(QStringLiteral("---------\n"));
|
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")
|
support.append(QStringLiteral("Geometry: %1,%2,%3x%4\n")
|
||||||
.arg(geo.x())
|
.arg(geo.x())
|
||||||
.arg(geo.y())
|
.arg(geo.y())
|
||||||
.arg(geo.width())
|
.arg(geo.width())
|
||||||
.arg(geo.height()));
|
.arg(geo.height()));
|
||||||
support.append(QStringLiteral("Scale: %1\n").arg(screens()->scale(i)));
|
support.append(QStringLiteral("Scale: %1\n").arg(output->scale()));
|
||||||
support.append(QStringLiteral("Refresh Rate: %1\n").arg(screens()->refreshRate(i)));
|
support.append(QStringLiteral("Refresh Rate: %1\n").arg(output->refreshRate()));
|
||||||
if (waylandServer()) {
|
const auto waylandOutput = qobject_cast<AbstractWaylandOutput *>(output);
|
||||||
|
if (waylandOutput) {
|
||||||
QString vrr = QStringLiteral("incapable");
|
QString vrr = QStringLiteral("incapable");
|
||||||
if (screens()->isVrrCapable(i)) {
|
if (waylandOutput->capabilities() & AbstractWaylandOutput::Capability::Vrr) {
|
||||||
switch(screens()->vrrPolicy(i)) {
|
switch (waylandOutput->vrrPolicy()) {
|
||||||
case RenderLoop::VrrPolicy::Never:
|
case RenderLoop::VrrPolicy::Never:
|
||||||
vrr = QStringLiteral("never");
|
vrr = QStringLiteral("never");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue