Re-apply color transforms when session is re-activated

When our session is re-activated, we need to re-apply color transforms
as the current gamma ramps might be outdated.
This commit is contained in:
Vlad Zahorodnii 2020-12-21 20:17:56 +02:00
parent 6adfe3064f
commit eaf94f465c
7 changed files with 22 additions and 1 deletions

View file

@ -128,6 +128,7 @@ void WaylandTestApplication::performStartup()
// first load options - done internally by a different thread
createOptions();
createSession();
createColorManager();
waylandServer()->createInternalConnection();

View file

@ -7,6 +7,7 @@
#include "colormanager.h"
#include "abstract_output.h"
#include "colordevice.h"
#include "logind.h"
#include "main.h"
#include "platform.h"
#include "utils.h"
@ -28,6 +29,7 @@ ColorManager::ColorManager(QObject *parent)
{
connect(kwinApp()->platform(), &Platform::outputEnabled, this, &ColorManager::handleOutputEnabled);
connect(kwinApp()->platform(), &Platform::outputDisabled, this, &ColorManager::handleOutputDisabled);
connect(LogindIntegration::self(), &LogindIntegration::sessionActiveChanged, this, &ColorManager::handleSessionActiveChanged);
}
ColorManager::~ColorManager()
@ -73,4 +75,14 @@ void ColorManager::handleOutputDisabled(AbstractOutput *output)
delete device;
}
void ColorManager::handleSessionActiveChanged(bool active)
{
if (!active) {
return;
}
for (ColorDevice *device : qAsConst(d->devices)) {
device->scheduleUpdate();
}
}
} // namespace KWin

View file

@ -52,6 +52,7 @@ Q_SIGNALS:
private Q_SLOTS:
void handleOutputEnabled(AbstractOutput *output);
void handleOutputDisabled(AbstractOutput *output);
void handleSessionActiveChanged(bool active);
private:
QScopedPointer<ColorManagerPrivate> d;

View file

@ -272,10 +272,14 @@ void Application::createWorkspace()
emit workspaceCreated();
}
void Application::createSession()
{
LogindIntegration::create(this);
}
void Application::createInput()
{
ScreenLockerWatcher::create(this);
LogindIntegration::create(this);
auto input = InputRedirection::create(this);
input->init();
m_platform->createPlatformCursor(this);

1
main.h
View file

@ -207,6 +207,7 @@ protected:
void notifyKSplash();
void notifyStarted();
void createSession();
void createInput();
void createWorkspace();
void createAtoms();

View file

@ -149,6 +149,7 @@ void ApplicationWayland::performStartup()
}
// first load options - done internally by a different thread
createOptions();
createSession();
createColorManager();
waylandServer()->createInternalConnection();

View file

@ -231,6 +231,7 @@ void ApplicationX11::performStartup()
installNativeX11EventFilter();
// first load options - done internally by a different thread
createOptions();
createSession();
createColorManager();
// Check whether another windowmanager is running