core: Drop Platform::supportsGammaControl()

If the platform doesn't support setting gamma ramps, let the request
fail. In long term, we need a software fallback too so this property is
not that relevant.
This commit is contained in:
Vlad Zahorodnii 2022-11-04 10:21:49 +02:00
parent 084f92bd7a
commit 5762b9a4cc
7 changed files with 7 additions and 44 deletions

View file

@ -77,7 +77,6 @@ DrmBackend::DrmBackend(Session *session, QObject *parent)
, m_explicitGpus(splitPathList(qEnvironmentVariable("KWIN_DRM_DEVICES"), ':'))
, m_dpmsFilter()
{
setSupportsGammaControl(true);
}
DrmBackend::~DrmBackend() = default;

View file

@ -29,8 +29,6 @@ VirtualBackend::VirtualBackend(QObject *parent)
qDebug() << "Screenshots saved to: " << m_screenshotDir->path();
}
}
setSupportsGammaControl(true);
}
VirtualBackend::~VirtualBackend()

View file

@ -121,8 +121,6 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent)
connect(m_updateOutputsTimer.get(), &QTimer::timeout, this, &X11StandalonePlatform::updateOutputs);
m_keyboard = std::make_unique<X11Keyboard>();
setSupportsGammaControl(true);
}
X11StandalonePlatform::~X11StandalonePlatform()

View file

@ -188,15 +188,6 @@ public:
*/
virtual QVector<CompositingType> supportedCompositors() const = 0;
/**
* Whether gamma control is supported by the backend.
* @since 5.12
*/
bool supportsGammaControl() const
{
return m_supportsGammaControl;
}
virtual Outputs outputs() const = 0;
Output *findOutput(const QString &name) const;
@ -244,10 +235,6 @@ protected:
{
return m_deviceIdentifier;
}
void setSupportsGammaControl(bool set)
{
m_supportsGammaControl = set;
}
private:
bool m_ready = false;
@ -257,7 +244,6 @@ private:
qreal m_initialOutputScale = 1;
EGLDisplay m_eglDisplay;
EGLContext m_globalShareContext = EGL_NO_CONTEXT;
bool m_supportsGammaControl = false;
};
} // namespace KWin

View file

@ -193,7 +193,7 @@ bool NightColorDBusInterface::isRunning() const
bool NightColorDBusInterface::isAvailable() const
{
return m_manager->isAvailable();
return true; // TODO: Night color should register its own dbus service instead.
}
int NightColorDBusInterface::currentTemperature() const

View file

@ -80,10 +80,6 @@ NightColorManager::NightColorManager()
// we may always read in the current config
readConfig();
if (!isAvailable()) {
return;
}
// legacy shortcut with localized key (to avoid breaking existing config)
if (i18n("Toggle Night Color") != QStringLiteral("Toggle Night Color")) {
QAction toggleActionLegacy;
@ -150,7 +146,7 @@ void NightColorManager::hardReset()
updateTransitionTimings(true);
updateTargetTemperature();
if (isAvailable() && isEnabled() && !isInhibited()) {
if (isEnabled() && !isInhibited()) {
setRunning(true);
commitGammaRamps(currentTargetTemp());
}
@ -205,11 +201,6 @@ bool NightColorManager::isRunning() const
return m_running;
}
bool NightColorManager::isAvailable() const
{
return kwinApp()->platform()->supportsGammaControl();
}
int NightColorManager::currentTemperature() const
{
return m_currentTemp;
@ -312,15 +303,11 @@ void NightColorManager::readConfig()
void NightColorManager::resetAllTimers()
{
cancelAllTimers();
if (isAvailable()) {
setRunning(isEnabled() && !isInhibited());
// we do this also for active being false in order to reset the temperature back to the day value
updateTransitionTimings(false);
updateTargetTemperature();
resetQuickAdjustTimer(currentTargetTemp());
} else {
setRunning(false);
}
setRunning(isEnabled() && !isInhibited());
// we do this also for active being false in order to reset the temperature back to the day value
updateTransitionTimings(false);
updateTargetTemperature();
resetQuickAdjustTimer(currentTargetTemp());
}
void NightColorManager::cancelAllTimers()

View file

@ -129,11 +129,6 @@ public:
*/
bool isRunning() const;
/**
* Returns @c true if Night Color is supported by platform; otherwise @c false.
*/
bool isAvailable() const;
/**
* Returns the current screen color temperature.
*/