qpa: Provide a QPlatformNativeInterface

Under Gnome/Unity/XFCE, but not Plasma(!), QFontconfigDatabase queries
the platform native interface for certain font settings
(e.g. antialiasingEnabled). Without a QPNI this would crash KWin
as soon as it tried to query for fonts.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2468>
This commit is contained in:
Kai Uwe Broulik 2022-05-25 13:06:47 +02:00 committed by Merge Service
parent f2be602266
commit b018dd3204
2 changed files with 9 additions and 1 deletions

View file

@ -23,6 +23,7 @@
#include <QCoreApplication>
#include <QtConcurrentRun>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qwindowsysteminterface.h>
@ -47,6 +48,7 @@ Integration::Integration()
: QObject()
, QPlatformIntegration()
, m_fontDb(new QGenericUnixFontDatabase())
, m_nativeInterface(new QPlatformNativeInterface())
, m_services(new QGenericUnixServices())
{
}
@ -198,6 +200,11 @@ void Integration::handleOutputDisabled(Output *output)
QWindowSystemInterface::handleScreenRemoved(platformScreen);
}
QPlatformNativeInterface *Integration::nativeInterface() const
{
return m_nativeInterface.data();
}
QPlatformServices *Integration::services() const
{
return m_services.data();

View file

@ -46,6 +46,7 @@ public:
QStringList themeNames() const override;
QPlatformTheme *createPlatformTheme(const QString &name) const override;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
QPlatformNativeInterface *nativeInterface() const override;
QPlatformServices *services() const override;
void initialize() override;
@ -58,7 +59,7 @@ private Q_SLOTS:
private:
QScopedPointer<QPlatformFontDatabase> m_fontDb;
QPlatformNativeInterface *m_nativeInterface;
QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
QPlatformPlaceholderScreen *m_dummyScreen = nullptr;
QHash<Output *, Screen *> m_screens;
QScopedPointer<QGenericUnixServices> m_services;