diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2016-02-29 14:30:14 -0800 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-03-22 15:05:34 +0000 |
commit | fbf5e9403e15655bd479e4cc6b26bf1451e5b8c5 (patch) | |
tree | 6f4130cff9c5b948809d7e4ab5985c657aff5e57 /src/x11extras/qx11info_x11.cpp | |
parent | 2bc54e9a5b7464a2839b408c79f190bf54011a97 (diff) | |
download | qtx11extras-fbf5e9403e15655bd479e4cc6b26bf1451e5b8c5.tar.gz |
Add QX11Info::isCompositingManagerRunning() function
Task-number: QTBUG-41195
Change-Id: Id4b385478dad85dd02c484fe9c44666bae46268b
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/x11extras/qx11info_x11.cpp')
-rw-r--r-- | src/x11extras/qx11info_x11.cpp | 25 |
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 |