summaryrefslogtreecommitdiff
path: root/src/x11extras/qx11info_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/x11extras/qx11info_x11.cpp')
-rw-r--r--src/x11extras/qx11info_x11.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp
index e5aa678..a201547 100644
--- a/src/x11extras/qx11info_x11.cpp
+++ b/src/x11extras/qx11info_x11.cpp
@@ -376,4 +376,29 @@ xcb_connection_t *QX11Info::connection()
return reinterpret_cast<xcb_connection_t *>(connection);
}
+/*!
+ \since 5.7
+
+ Returns true if there is a compositing manager running for the connection
+ attached to \a screen.
+
+ If \l -1, the application primary screen is used.
+*/
+bool QX11Info::isCompositingManagerRunning(int screen)
+{
+ if (!qApp)
+ return false;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return false;
+
+ QScreen *scr = screen == -1 ? QGuiApplication::primaryScreen() : findScreenForVirtualDesktop(screen);
+ if (!scr) {
+ qWarning() << "isCompositingManagerRunning: Could not find screen number" << screen;
+ return false;
+ }
+
+ return native->nativeResourceForScreen(QByteArray("compositingEnabled"), scr);
+}
+
QT_END_NAMESPACE