summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-19 11:07:43 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-20 16:52:29 +0000
commit67cc8fea106c35c7ca75bf476667d07b3bbf3257 (patch)
tree79d66af5c48d0f3cb2760c109aa2a739c9b76c20 /src/plugins/platforms/xcb/qxcbconnection.h
parentcdccd0222bbed1954d5d7fe0da9d2308c202f3b1 (diff)
XCB: Do not create instance of QPlatformIntegration for invalid displays
Extract a static factory for QXcbConnection objects and pass potential connection errors to qxcbmain.cpp, which will then return 0. Task-number: QTBUG-68859 Change-Id: I9c0faf82462a78a576360c19bef251ad1d034d84 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 0b31e9c3e7..c88100e580 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -377,9 +377,16 @@ class Q_XCB_EXPORT QXcbConnection : public QObject
{
Q_OBJECT
public:
- QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName = 0);
+ explicit QXcbConnection(xcb_connection_t *c, int primaryScreenNumber,
+ QXcbNativeInterface *nativeInterface, bool canGrabServer,
+ xcb_visualid_t defaultVisualId, const QByteArray &displayName,
+ void *xlibDisplay = nullptr);
+
~QXcbConnection();
+ static QXcbConnection *create(QXcbNativeInterface *nativeInterface, bool canGrabServer,
+ xcb_visualid_t defaultVisualId, const char *displayName = nullptr);
+
QXcbConnection *connection() const { return const_cast<QXcbConnection *>(this); }
bool isConnected() const;
@@ -639,21 +646,21 @@ private:
static bool xi2GetValuatorValueIfSet(const void *event, int valuatorNum, double *value);
#endif
- xcb_connection_t *m_connection = nullptr;
+ xcb_connection_t *const m_connection;
const xcb_setup_t *m_setup = nullptr;
const bool m_canGrabServer;
const xcb_visualid_t m_defaultVisualId;
QList<QXcbVirtualDesktop *> m_virtualDesktops;
QList<QXcbScreen *> m_screens;
- int m_primaryScreenNumber = 0;
+ const int m_primaryScreenNumber;
xcb_atom_t m_allAtoms[QXcbAtom::NAtoms];
xcb_timestamp_t m_time = XCB_CURRENT_TIME;
xcb_timestamp_t m_netWmUserTime = XCB_CURRENT_TIME;
- QByteArray m_displayName;
+ const QByteArray m_displayName;
QXcbKeyboard *m_keyboard = nullptr;
#ifndef QT_NO_CLIPBOARD
@@ -666,7 +673,7 @@ private:
QXcbNativeInterface *m_nativeInterface = nullptr;
#if QT_CONFIG(xcb_xlib)
- void *m_xlib_display = nullptr;
+ void *const m_xlib_display;
#endif
QXcbEventReader *m_reader = nullptr;