File indexing completed on 2024-11-10 04:56:39
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #include "outputbackend.h" 0011 0012 #include "inputbackend.h" 0013 #include "opengl/egldisplay.h" 0014 #include "output.h" 0015 #include "outputconfiguration.h" 0016 #include "platformsupport/scenes/opengl/openglbackend.h" 0017 #include "platformsupport/scenes/qpainter/qpainterbackend.h" 0018 0019 namespace KWin 0020 { 0021 0022 OutputBackend::OutputBackend(QObject *parent) 0023 : QObject(parent) 0024 { 0025 } 0026 0027 OutputBackend::~OutputBackend() 0028 { 0029 } 0030 0031 std::unique_ptr<InputBackend> OutputBackend::createInputBackend() 0032 { 0033 return nullptr; 0034 } 0035 0036 std::unique_ptr<OpenGLBackend> OutputBackend::createOpenGLBackend() 0037 { 0038 return nullptr; 0039 } 0040 0041 std::unique_ptr<QPainterBackend> OutputBackend::createQPainterBackend() 0042 { 0043 return nullptr; 0044 } 0045 0046 bool OutputBackend::applyOutputChanges(const OutputConfiguration &config) 0047 { 0048 const auto availableOutputs = outputs(); 0049 QList<Output *> toBeEnabledOutputs; 0050 QList<Output *> toBeDisabledOutputs; 0051 for (const auto &output : availableOutputs) { 0052 if (const auto changeset = config.constChangeSet(output)) { 0053 if (changeset->enabled) { 0054 toBeEnabledOutputs << output; 0055 } else { 0056 toBeDisabledOutputs << output; 0057 } 0058 } 0059 } 0060 for (const auto &output : toBeEnabledOutputs) { 0061 output->applyChanges(config); 0062 } 0063 for (const auto &output : toBeDisabledOutputs) { 0064 output->applyChanges(config); 0065 } 0066 return true; 0067 } 0068 0069 Output *OutputBackend::findOutput(const QString &name) const 0070 { 0071 const auto candidates = outputs(); 0072 for (Output *candidate : candidates) { 0073 if (candidate->name() == name) { 0074 return candidate; 0075 } 0076 } 0077 return nullptr; 0078 } 0079 0080 Output *OutputBackend::createVirtualOutput(const QString &name, const QSize &size, double scale) 0081 { 0082 return nullptr; 0083 } 0084 0085 void OutputBackend::removeVirtualOutput(Output *output) 0086 { 0087 Q_ASSERT(!output); 0088 } 0089 0090 QString OutputBackend::supportInformation() const 0091 { 0092 return QStringLiteral("Name: %1\n").arg(metaObject()->className()); 0093 } 0094 0095 ::EGLContext OutputBackend::sceneEglGlobalShareContext() const 0096 { 0097 return m_globalShareContext; 0098 } 0099 0100 void OutputBackend::setSceneEglGlobalShareContext(::EGLContext context) 0101 { 0102 m_globalShareContext = context; 0103 } 0104 0105 Session *OutputBackend::session() const 0106 { 0107 return nullptr; 0108 } 0109 0110 } // namespace KWin 0111 0112 #include "moc_outputbackend.cpp"