24#include <QCoreApplication>
26#include <QtConcurrentRun>
28#include <qpa/qplatformaccessibility.h>
29#include <qpa/qplatformnativeinterface.h>
30#include <qpa/qplatformwindow.h>
31#include <qpa/qwindowsysteminterface.h>
33#include <QtGui/private/qgenericunixeventdispatcher_p.h>
34#include <QtGui/private/qgenericunixfontdatabase_p.h>
35#include <QtGui/private/qgenericunixthemes_p.h>
36#include <QtGui/private/qspiaccessiblebridge_p.h>
37#include <QtGui/private/qunixeventdispatcher_qpa_p.h>
47 , QPlatformIntegration()
48 , m_fontDb(new QGenericUnixFontDatabase())
49 , m_nativeInterface(new QPlatformNativeInterface())
50 , m_services(new QGenericUnixServices())
56 for (QPlatformScreen *platformScreen : std::as_const(m_screens)) {
57 QWindowSystemInterface::handleScreenRemoved(platformScreen);
60 QWindowSystemInterface::handleScreenRemoved(m_dummyScreen);
78 case BufferQueueingOpenGL:
81 case NonFullScreenWindows:
86 return QPlatformIntegration::hasCapability(cap);
93 QTimer::singleShot(0,
this, [
this] {
96 handleWorkspaceCreated();
102 QPlatformIntegration::initialize();
105 QWindowSystemInterface::handleScreenAdded(m_dummyScreen);
110 return new QUnixEventDispatcherQPA;
120 return new Window(window);
130 return m_fontDb.get();
135 return QGenericUnixTheme::createUnixTheme(name);
140 if (qEnvironmentVariableIsSet(
"KDE_FULL_SESSION")) {
141 return QStringList({QStringLiteral(
"kde")});
143 return QStringList({QLatin1String(QGenericUnixTheme::name)});
148 if (kwinApp()->outputBackend()->sceneEglGlobalShareContext() == EGL_NO_CONTEXT) {
149 qCWarning(KWIN_QPA) <<
"Attempting to create a QOpenGLContext before the scene is initialized";
152 EglDisplay *
const eglDisplay = kwinApp()->outputBackend()->sceneEglDisplayObject();
155 return platformContext;
162 if (!m_accessibility) {
163 m_accessibility.reset(
new QSpiAccessibleBridge());
165 return m_accessibility.get();
168void Integration::handleWorkspaceCreated()
171 this, &Integration::handleOutputEnabled);
173 this, &Integration::handleOutputDisabled);
176 for (
Output *output : outputs) {
177 handleOutputEnabled(output);
181void Integration::handleOutputEnabled(Output *output)
183 Screen *platformScreen =
new Screen(output,
this);
184 QWindowSystemInterface::handleScreenAdded(platformScreen);
185 m_screens.insert(output, platformScreen);
188 QWindowSystemInterface::handleScreenRemoved(m_dummyScreen);
189 m_dummyScreen =
nullptr;
193void Integration::handleOutputDisabled(Output *output)
195 Screen *platformScreen = m_screens.take(output);
196 if (!platformScreen) {
197 qCWarning(KWIN_QPA) <<
"Unknown output" << output;
201 if (m_screens.isEmpty()) {
202 m_dummyScreen =
new PlaceholderScreen();
203 QWindowSystemInterface::handleScreenAdded(m_dummyScreen);
206 QWindowSystemInterface::handleScreenRemoved(platformScreen);
211 return m_nativeInterface.get();
216 return m_services.get();
222#include "moc_integration.cpp"
QPlatformWindow * createPlatformWindow(QWindow *window) const override
QAbstractEventDispatcher * createEventDispatcher() const override
bool hasCapability(Capability cap) const override
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const override
QPlatformNativeInterface * nativeInterface() const override
QPlatformTheme * createPlatformTheme(const QString &name) const override
void initialize() override
QPlatformFontDatabase * fontDatabase() const override
QPlatformAccessibility * accessibility() const override
QPlatformServices * services() const override
QHash< Output *, Screen * > screens() const
QStringList themeNames() const override
QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const override
void outputAdded(KWin::Output *)
QList< Output * > outputs() const
void outputRemoved(KWin::Output *)