2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2015-03-20 13:41:03 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
2015-03-20 13:41:03 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2016-04-07 07:24:17 +00:00
|
|
|
#include "platform.h"
|
2019-08-28 18:54:37 +00:00
|
|
|
|
2015-04-02 12:37:23 +00:00
|
|
|
#include <config-kwin.h>
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2015-04-01 13:36:40 +00:00
|
|
|
#include "composite.h"
|
|
|
|
#include "cursor.h"
|
2022-06-02 18:21:21 +00:00
|
|
|
#include "dmabuftexture.h"
|
2017-08-21 06:53:56 +00:00
|
|
|
#include "effects.h"
|
2017-08-21 09:59:52 +00:00
|
|
|
#include "outline.h"
|
2022-04-14 12:33:28 +00:00
|
|
|
#include "output.h"
|
2022-04-14 10:51:20 +00:00
|
|
|
#include "outputconfiguration.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "overlaywindow.h"
|
2016-02-23 11:29:05 +00:00
|
|
|
#include "pointer_input.h"
|
2017-09-08 13:49:52 +00:00
|
|
|
#include "scene.h"
|
2016-04-15 11:47:56 +00:00
|
|
|
#include "screenedge.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "screens.h"
|
2022-04-22 09:27:33 +00:00
|
|
|
#include "wayland/outputchangeset_v2.h"
|
|
|
|
#include "wayland/outputconfiguration_v2_interface.h"
|
2015-03-20 13:41:03 +00:00
|
|
|
#include "wayland_server.h"
|
[colorcorrection] Night Color - blue light filter at nighttime
With Wayland KWin needs to provide certain services, which were provided
before that by the Xserver. One of these is gamma correction, which includes
the - by many people beloved - functionality to reduce the blue light at
nighttime. This patch provides the KWin part of that. It is self contained,
but in the end will work in tandem with a lib in Plasma Workspace and a KCM
in Plasma Desktop, which can be used to configure Night Color.
* Three modi:
** Automatic: The location and sun timings are determined automatically
(location data updates will be provided by the workspace)
** Location: The sun timings are determined by fixed location data
** Timings: The sun timings are set manually by the user
* Color temperature value changes are smoothly applied:
** Configuration changes, which lead to other current values are changed
in a quick way over a few seconds
** Changes on sunrise and sunset are applied slowly over the course of few
minutes till several hours depending on the configuration
* The current color value is set immediately at startup or after suspend
phases and VT switches. There is no flickering.
* All configuration is done via a DBus interface, changed values are tested
on correctness and applied atomically
* Self contained mechanism, speaks directly to the hardware by setting the
gamma ramps on the CRTC
* Currently working on DRM backend, extensible to other platform backends in
the future
* The code is written in a way to make the classes later easily extendable to
also provide normal color correction, as it's currently done by KGamma on X
Test Plan:
Manually with the workspace parts and added integration tests in KWin using
the virtual backend.
BUG:371494
Reviewers: #kwin, graesslin
Subscribers: kwin, plasma-devel, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5928
2017-12-11 09:43:12 +00:00
|
|
|
|
2022-04-22 09:27:33 +00:00
|
|
|
#include <KCoreAddons>
|
2015-03-20 13:41:03 +00:00
|
|
|
|
2022-03-09 16:25:44 +00:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
#include <private/qtx11extras_p.h>
|
|
|
|
#else
|
2020-04-27 10:49:36 +00:00
|
|
|
#include <QX11Info>
|
2022-03-09 16:25:44 +00:00
|
|
|
#endif
|
2020-04-27 10:49:36 +00:00
|
|
|
|
2020-04-29 13:54:06 +00:00
|
|
|
#include <cerrno>
|
|
|
|
|
2015-03-20 13:41:03 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
Platform::Platform(QObject *parent)
|
2015-03-20 13:41:03 +00:00
|
|
|
: QObject(parent)
|
2016-07-18 08:27:56 +00:00
|
|
|
, m_eglDisplay(EGL_NO_DISPLAY)
|
2015-03-20 13:41:03 +00:00
|
|
|
{
|
2022-04-14 12:33:28 +00:00
|
|
|
connect(this, &Platform::outputDisabled, this, [this](Output *output) {
|
2021-10-25 00:05:23 +00:00
|
|
|
if (m_primaryOutput == output) {
|
|
|
|
setPrimaryOutput(enabledOutputs().value(0, nullptr));
|
|
|
|
}
|
|
|
|
});
|
2022-04-14 12:33:28 +00:00
|
|
|
connect(this, &Platform::outputEnabled, this, [this](Output *output) {
|
2021-10-25 00:05:23 +00:00
|
|
|
if (!m_primaryOutput) {
|
|
|
|
setPrimaryOutput(output);
|
|
|
|
}
|
|
|
|
});
|
2015-03-20 13:41:03 +00:00
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
Platform::~Platform()
|
2015-03-20 13:41:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-17 14:12:21 +00:00
|
|
|
PlatformCursorImage Platform::cursorImage() const
|
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
Cursor *cursor = Cursors::self()->currentCursor();
|
2020-04-02 16:18:01 +00:00
|
|
|
return PlatformCursorImage(cursor->image(), cursor->hotspot());
|
2016-10-17 14:12:21 +00:00
|
|
|
}
|
|
|
|
|
2021-10-02 08:26:51 +00:00
|
|
|
InputBackend *Platform::createInputBackend()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
OpenGLBackend *Platform::createOpenGLBackend()
|
2015-03-27 07:51:56 +00:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
QPainterBackend *Platform::createQPainterBackend()
|
2015-03-27 08:05:03 +00:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-06-14 10:53:27 +00:00
|
|
|
std::optional<DmaBufParams> Platform::testCreateDmaBuf(const QSize &size, quint32 format, const QVector<uint64_t> &modifiers)
|
2022-05-13 09:06:17 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(size)
|
2022-06-02 18:21:21 +00:00
|
|
|
Q_UNUSED(format)
|
|
|
|
Q_UNUSED(modifiers)
|
2022-05-13 09:06:17 +00:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2022-06-02 18:21:21 +00:00
|
|
|
std::shared_ptr<DmaBufTexture> Platform::createDmaBufTexture(const QSize &size, quint32 format, uint64_t modifier)
|
|
|
|
{
|
|
|
|
Q_UNUSED(size)
|
|
|
|
Q_UNUSED(format)
|
|
|
|
Q_UNUSED(modifier)
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2022-06-14 10:53:27 +00:00
|
|
|
std::shared_ptr<DmaBufTexture> Platform::createDmaBufTexture(const DmaBufParams &attribs)
|
2022-06-02 18:21:21 +00:00
|
|
|
{
|
|
|
|
return createDmaBufTexture({attribs.width, attribs.height}, attribs.format, attribs.modifier);
|
|
|
|
}
|
|
|
|
|
2016-04-15 11:47:56 +00:00
|
|
|
Edge *Platform::createScreenEdge(ScreenEdges *edges)
|
|
|
|
{
|
|
|
|
return new Edge(edges);
|
|
|
|
}
|
|
|
|
|
2016-08-15 10:00:03 +00:00
|
|
|
void Platform::createPlatformCursor(QObject *parent)
|
|
|
|
{
|
|
|
|
new InputRedirectionCursor(parent);
|
|
|
|
}
|
|
|
|
|
2021-07-21 10:11:21 +00:00
|
|
|
void Platform::requestOutputsChange(KWaylandServer::OutputConfigurationV2Interface *config)
|
2016-03-10 18:57:07 +00:00
|
|
|
{
|
2019-08-28 18:54:37 +00:00
|
|
|
if (!m_supportsOutputChanges) {
|
|
|
|
qCWarning(KWIN_CORE) << "This backend does not support configuration changes.";
|
|
|
|
config->setFailed();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-04-14 10:51:20 +00:00
|
|
|
OutputConfiguration cfg;
|
2019-08-28 18:54:37 +00:00
|
|
|
const auto changes = config->changes();
|
|
|
|
for (auto it = changes.begin(); it != changes.end(); it++) {
|
2021-07-21 10:11:21 +00:00
|
|
|
const KWaylandServer::OutputChangeSetV2 *changeset = it.value();
|
2022-04-14 08:32:51 +00:00
|
|
|
auto output = findOutput(it.key()->uuid());
|
2019-08-28 18:54:37 +00:00
|
|
|
if (!output) {
|
|
|
|
qCWarning(KWIN_CORE) << "Could NOT find output matching " << it.key()->uuid();
|
|
|
|
continue;
|
|
|
|
}
|
2021-09-28 08:29:56 +00:00
|
|
|
auto props = cfg.changeSet(output);
|
|
|
|
props->enabled = changeset->enabled();
|
|
|
|
props->pos = changeset->position();
|
|
|
|
props->scale = changeset->scale();
|
|
|
|
props->modeSize = changeset->size();
|
|
|
|
props->refreshRate = changeset->refreshRate();
|
2022-04-14 12:33:28 +00:00
|
|
|
props->transform = static_cast<Output::Transform>(changeset->transform());
|
2021-09-28 08:29:56 +00:00
|
|
|
props->overscan = changeset->overscan();
|
2022-04-14 12:33:28 +00:00
|
|
|
props->rgbRange = static_cast<Output::RgbRange>(changeset->rgbRange());
|
2021-09-28 08:29:56 +00:00
|
|
|
props->vrrPolicy = static_cast<RenderLoop::VrrPolicy>(changeset->vrrPolicy());
|
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
|
2022-02-24 03:26:04 +00:00
|
|
|
const auto allOutputs = outputs();
|
2022-03-23 10:13:38 +00:00
|
|
|
bool allDisabled = !std::any_of(allOutputs.begin(), allOutputs.end(), [&cfg](const auto &output) {
|
2022-04-14 08:32:51 +00:00
|
|
|
return cfg.changeSet(output)->enabled;
|
2021-09-28 08:29:56 +00:00
|
|
|
});
|
|
|
|
if (allDisabled) {
|
|
|
|
qCWarning(KWIN_CORE) << "Disabling all outputs through configuration changes is not allowed";
|
|
|
|
config->setFailed();
|
|
|
|
return;
|
2019-08-28 18:54:37 +00:00
|
|
|
}
|
|
|
|
|
2021-09-28 08:29:56 +00:00
|
|
|
if (applyOutputChanges(cfg)) {
|
2021-11-18 16:12:37 +00:00
|
|
|
if (config->primaryChanged() || !primaryOutput()->isEnabled()) {
|
|
|
|
auto requestedPrimaryOutput = findOutput(config->primary()->uuid());
|
|
|
|
if (requestedPrimaryOutput && requestedPrimaryOutput->isEnabled()) {
|
|
|
|
setPrimaryOutput(requestedPrimaryOutput);
|
|
|
|
} else {
|
|
|
|
auto defaultPrimaryOutput = enabledOutputs().constFirst();
|
|
|
|
qCWarning(KWIN_CORE) << "Requested invalid primary screen, using" << defaultPrimaryOutput;
|
|
|
|
setPrimaryOutput(defaultPrimaryOutput);
|
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
}
|
2021-09-28 08:29:56 +00:00
|
|
|
Q_EMIT screens()->changed();
|
|
|
|
config->setApplied();
|
|
|
|
} else {
|
|
|
|
qCDebug(KWIN_CORE) << "Applying config failed";
|
|
|
|
config->setFailed();
|
2019-08-28 18:54:37 +00:00
|
|
|
}
|
2021-09-28 08:29:56 +00:00
|
|
|
}
|
2021-01-14 08:21:59 +00:00
|
|
|
|
2022-04-14 10:51:20 +00:00
|
|
|
bool Platform::applyOutputChanges(const OutputConfiguration &config)
|
2021-09-28 08:29:56 +00:00
|
|
|
{
|
2022-02-09 08:43:52 +00:00
|
|
|
const auto availableOutputs = outputs();
|
2022-04-14 12:33:28 +00:00
|
|
|
QVector<Output *> toBeEnabledOutputs;
|
|
|
|
QVector<Output *> toBeDisabledOutputs;
|
2022-02-09 08:43:52 +00:00
|
|
|
for (const auto &output : availableOutputs) {
|
2022-04-14 08:32:51 +00:00
|
|
|
if (config.constChangeSet(output)->enabled) {
|
2022-02-24 04:36:26 +00:00
|
|
|
toBeEnabledOutputs << output;
|
|
|
|
} else {
|
|
|
|
toBeDisabledOutputs << output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const auto &output : toBeEnabledOutputs) {
|
2022-04-14 08:32:51 +00:00
|
|
|
output->applyChanges(config);
|
2022-02-24 04:36:26 +00:00
|
|
|
}
|
|
|
|
for (const auto &output : toBeDisabledOutputs) {
|
2022-04-14 08:32:51 +00:00
|
|
|
output->applyChanges(config);
|
2021-10-25 00:05:23 +00:00
|
|
|
}
|
2021-09-28 08:29:56 +00:00
|
|
|
return true;
|
2019-08-28 18:54:37 +00:00
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *Platform::findOutput(int screenId) const
|
2020-08-18 18:42:45 +00:00
|
|
|
{
|
|
|
|
return enabledOutputs().value(screenId);
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *Platform::findOutput(const QUuid &uuid) const
|
2019-08-28 18:54:37 +00:00
|
|
|
{
|
|
|
|
const auto outs = outputs();
|
|
|
|
auto it = std::find_if(outs.constBegin(), outs.constEnd(),
|
2022-04-14 12:33:28 +00:00
|
|
|
[uuid](Output *output) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return output->uuid() == uuid;
|
|
|
|
});
|
2019-08-28 18:54:37 +00:00
|
|
|
if (it != outs.constEnd()) {
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *Platform::findOutput(const QString &name) const
|
2021-10-20 14:24:44 +00:00
|
|
|
{
|
|
|
|
const auto candidates = outputs();
|
2022-04-14 12:33:28 +00:00
|
|
|
for (Output *candidate : candidates) {
|
2021-10-20 14:24:44 +00:00
|
|
|
if (candidate->name() == name) {
|
|
|
|
return candidate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *Platform::outputAt(const QPoint &pos) const
|
2021-08-27 15:49:54 +00:00
|
|
|
{
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *bestOutput = nullptr;
|
2021-08-27 15:49:54 +00:00
|
|
|
int minDistance = INT_MAX;
|
|
|
|
const auto candidates = enabledOutputs();
|
2022-04-14 12:33:28 +00:00
|
|
|
for (Output *output : candidates) {
|
2021-08-27 15:49:54 +00:00
|
|
|
const QRect &geo = output->geometry();
|
|
|
|
if (geo.contains(pos)) {
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
int distance = QPoint(geo.topLeft() - pos).manhattanLength();
|
|
|
|
distance = std::min(distance, QPoint(geo.topRight() - pos).manhattanLength());
|
|
|
|
distance = std::min(distance, QPoint(geo.bottomRight() - pos).manhattanLength());
|
|
|
|
distance = std::min(distance, QPoint(geo.bottomLeft() - pos).manhattanLength());
|
|
|
|
if (distance < minDistance) {
|
|
|
|
minDistance = distance;
|
|
|
|
bestOutput = output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bestOutput;
|
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
void Platform::repaint(const QRect &rect)
|
2015-05-05 08:54:13 +00:00
|
|
|
{
|
2021-11-09 10:36:24 +00:00
|
|
|
if (Compositor::compositing()) {
|
|
|
|
Compositor::self()->scene()->addRepaint(rect);
|
2015-05-05 08:54:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
void Platform::setReady(bool ready)
|
2015-05-05 17:02:52 +00:00
|
|
|
{
|
|
|
|
if (m_ready == ready) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_ready = ready;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT readyChanged(m_ready);
|
2015-05-05 17:02:52 +00:00
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *Platform::createVirtualOutput(const QString &name, const QSize &size, double scale)
|
2021-10-05 17:06:28 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(name);
|
|
|
|
Q_UNUSED(size);
|
|
|
|
Q_UNUSED(scale);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
void Platform::removeVirtualOutput(Output *output)
|
2021-10-05 17:06:28 +00:00
|
|
|
{
|
|
|
|
Q_ASSERT(!output);
|
|
|
|
}
|
|
|
|
|
2016-04-07 07:18:10 +00:00
|
|
|
void Platform::warpPointer(const QPointF &globalPos)
|
2015-06-05 17:34:03 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(globalPos)
|
|
|
|
}
|
|
|
|
|
2020-10-15 09:27:00 +00:00
|
|
|
bool Platform::supportsNativeFence() const
|
|
|
|
{
|
|
|
|
if (Compositor *compositor = Compositor::self()) {
|
|
|
|
return compositor->scene()->supportsNativeFence();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-18 08:27:56 +00:00
|
|
|
EGLDisplay KWin::Platform::sceneEglDisplay() const
|
2015-08-18 06:35:34 +00:00
|
|
|
{
|
2016-07-18 08:27:56 +00:00
|
|
|
return m_eglDisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Platform::setSceneEglDisplay(EGLDisplay display)
|
|
|
|
{
|
|
|
|
m_eglDisplay = display;
|
2015-08-18 06:35:34 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 14:41:37 +00:00
|
|
|
bool Platform::requiresCompositing() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-09 15:32:43 +00:00
|
|
|
bool Platform::compositingPossible() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Platform::compositingNotPossibleReason() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Platform::openGLCompositingIsBroken() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-05-10 08:34:09 +00:00
|
|
|
void Platform::createOpenGLSafePoint(OpenGLSafePoint safePoint)
|
|
|
|
{
|
|
|
|
Q_UNUSED(safePoint)
|
|
|
|
}
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
void Platform::startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName)
|
2016-11-15 09:22:56 +00:00
|
|
|
{
|
2016-11-15 13:23:51 +00:00
|
|
|
if (!input()) {
|
|
|
|
callback(nullptr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
input()->startInteractiveWindowSelection(callback, cursorName);
|
2016-11-15 09:22:56 +00:00
|
|
|
}
|
|
|
|
|
2016-11-23 14:53:17 +00:00
|
|
|
void Platform::startInteractivePositionSelection(std::function<void(const QPoint &)> callback)
|
|
|
|
{
|
|
|
|
if (!input()) {
|
|
|
|
callback(QPoint(-1, -1));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
input()->startInteractivePositionSelection(callback);
|
|
|
|
}
|
|
|
|
|
2017-01-17 06:12:44 +00:00
|
|
|
void Platform::setupActionForGlobalAccel(QAction *action)
|
|
|
|
{
|
|
|
|
Q_UNUSED(action)
|
|
|
|
}
|
|
|
|
|
2022-06-01 11:02:36 +00:00
|
|
|
std::unique_ptr<OverlayWindow> Platform::createOverlayWindow()
|
2017-08-07 15:54:56 +00:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2020-04-27 10:49:36 +00:00
|
|
|
static quint32 monotonicTime()
|
|
|
|
{
|
|
|
|
timespec ts;
|
|
|
|
|
|
|
|
const int result = clock_gettime(CLOCK_MONOTONIC, &ts);
|
2022-03-25 12:20:32 +00:00
|
|
|
if (result) {
|
2020-04-27 10:49:36 +00:00
|
|
|
qCWarning(KWIN_CORE, "Failed to query monotonic time: %s", strerror(errno));
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2020-04-27 10:49:36 +00:00
|
|
|
|
|
|
|
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000L;
|
|
|
|
}
|
|
|
|
|
2017-08-24 14:53:40 +00:00
|
|
|
void Platform::updateXTime()
|
|
|
|
{
|
2020-04-27 10:49:36 +00:00
|
|
|
switch (kwinApp()->operationMode()) {
|
|
|
|
case Application::OperationModeX11:
|
|
|
|
kwinApp()->setX11Time(QX11Info::getTimestamp(), Application::TimestampUpdate::Always);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Application::OperationModeXwayland:
|
|
|
|
kwinApp()->setX11Time(monotonicTime(), Application::TimestampUpdate::Always);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Do not update the current X11 time stamp if it's the Wayland only session.
|
|
|
|
break;
|
|
|
|
}
|
2017-08-24 14:53:40 +00:00
|
|
|
}
|
|
|
|
|
2017-08-21 09:59:52 +00:00
|
|
|
OutlineVisual *Platform::createOutline(Outline *outline)
|
|
|
|
{
|
|
|
|
if (Compositor::compositing()) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return new CompositedOutlineVisual(outline);
|
2017-08-21 09:59:52 +00:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-08-21 06:53:56 +00:00
|
|
|
void Platform::invertScreen()
|
|
|
|
{
|
|
|
|
if (effects) {
|
2022-03-23 10:13:38 +00:00
|
|
|
if (Effect *inverter = static_cast<EffectsHandlerImpl *>(effects)->provides(Effect::ScreenInversion)) {
|
2017-08-21 06:53:56 +00:00
|
|
|
qCDebug(KWIN_CORE) << "inverting screen using Effect plugin";
|
|
|
|
QMetaObject::invokeMethod(inverter, "toggleScreenInversion", Qt::DirectConnection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-23 18:21:26 +00:00
|
|
|
void Platform::createEffectsHandler(Compositor *compositor, Scene *scene)
|
|
|
|
{
|
|
|
|
new EffectsHandlerImpl(compositor, scene);
|
|
|
|
}
|
|
|
|
|
2017-11-07 19:12:51 +00:00
|
|
|
QString Platform::supportInformation() const
|
|
|
|
{
|
|
|
|
return QStringLiteral("Name: %1\n").arg(metaObject()->className());
|
|
|
|
}
|
|
|
|
|
2020-10-16 14:57:35 +00:00
|
|
|
EGLContext Platform::sceneEglGlobalShareContext() const
|
|
|
|
{
|
|
|
|
return m_globalShareContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Platform::setSceneEglGlobalShareContext(EGLContext context)
|
|
|
|
{
|
|
|
|
m_globalShareContext = context;
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
void Platform::setPrimaryOutput(Output *primary)
|
2021-10-25 00:05:23 +00:00
|
|
|
{
|
|
|
|
if (primary == m_primaryOutput) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Q_ASSERT(kwinApp()->isTerminating() || primary->isEnabled());
|
|
|
|
m_primaryOutput = primary;
|
|
|
|
Q_EMIT primaryOutputChanged(primary);
|
|
|
|
}
|
|
|
|
|
2015-03-20 13:41:03 +00:00
|
|
|
}
|