From f5203eeada83bbe8e316a5188e24636af3e83b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 3 Aug 2021 23:09:27 +0200 Subject: Add native interface for X11 application, exposing display and connection The major use-case of the now private QX11Info from Qt X11 Extras was getting hold of the Xlib display and XCB connection, for example in KDE: https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=QX11Info A new native interface for QGuiApplication has now been added that exposes these two properties, e.g.: if (auto *x11App = app.nativeInterface()) qDebug() << x11App->display() << x11App->connection(); To avoid type clashes one of the enum values of QXcbNativeInterface's ResourceType had to be renamed. Pick-to: 6.2 Task-number: QTBUG-93633 Change-Id: I2e366a2bb88bd3965ac6172ad000ae32209f43e7 Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbnativeinterface.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbnativeinterface.h') diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 4656f46be5..5508d57679 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -45,6 +45,8 @@ #include +#include + #include "qxcbexport.h" #include "qxcbconnection.h" @@ -54,11 +56,12 @@ class QXcbScreen; class QXcbNativeInterfaceHandler; class Q_XCB_EXPORT QXcbNativeInterface : public QPlatformNativeInterface + , public QNativeInterface::QX11Application { Q_OBJECT public: enum ResourceType { - Display, + XDisplay, Connection, Screen, AppTime, @@ -109,9 +112,11 @@ public: void *startupId(); void *x11Screen(); void *rootWindow(); - void *display(); + + Display *display() const override; + xcb_connection_t *connection() const override; + void *atspiBus(); - void *connection(); static void setStartupId(const char *); static void setAppTime(QScreen *screen, xcb_timestamp_t time); static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); -- cgit v1.2.3