1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/0001-Hack-together-a-way-to-get-fallback-from-xcb-working.patch

78 lines
2.7 KiB
Diff

From 58426659165f3da4458ff370efe056ac17406422 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 14 Jun 2018 10:02:38 +0200
Subject: [PATCH] Hack together a way to get fallback from xcb working
QTBUG-68859
---
src/plugins/platforms/xcb/qxcbintegration.cpp | 7 ++++++-
src/plugins/platforms/xcb/qxcbintegration.h | 1 +
src/plugins/platforms/xcb/qxcbmain.cpp | 13 ++++++++++---
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 471287eb44..eb0607c6b6 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -206,7 +206,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
if (m_connections.isEmpty()) {
qCritical("Could not connect to any X display.");
- exit(1);
+ return;
}
m_fontDatabase.reset(new QGenericUnixFontDatabase());
@@ -219,6 +219,11 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
#endif
}
+bool QXcbIntegration::connected() const
+{
+ return !m_connections.isEmpty();
+}
+
QXcbIntegration::~QXcbIntegration()
{
qDeleteAll(m_connections);
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 186b6c5ddd..6fa2b1f25f 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -60,6 +60,7 @@ class Q_XCB_EXPORT QXcbIntegration : public QPlatformIntegration
public:
QXcbIntegration(const QStringList &parameters, int &argc, char **argv);
~QXcbIntegration();
+ bool connected() const;
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override;
QPlatformWindow *createPlatformWindow(QWindow *window) const override;
diff --git a/src/plugins/platforms/xcb/qxcbmain.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp
index f8cb9a9269..f48366655c 100644
--- a/src/plugins/platforms/xcb/qxcbmain.cpp
+++ b/src/plugins/platforms/xcb/qxcbmain.cpp
@@ -52,10 +52,17 @@ public:
QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv)
{
- if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive))
- return new QXcbIntegration(parameters, argc, argv);
+ if (system.compare(QLatin1String("xcb"), Qt::CaseInsensitive))
+ return 0;
- return 0;
+ QXcbIntegration *p = new QXcbIntegration(parameters, argc, argv);
+
+ if(!p->connected()) {
+ delete p;
+ p = nullptr;
+ }
+
+ return p;
}
QT_END_NAMESPACE
--
2.17.1