From b6de9d5bcb3eb503dc2b1f9559d1e89f778d1d76 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Thu, 31 Mar 2011 12:15:39 +0200 Subject: Track compositingManagerRunning changes Use XFixes extension to track changes to the compositing manager in such a way that QX11Info::isCompositingManagerRunning() returns a valid result even if compositing has changed after the creation of the QApplication Many thanks to Fredrikh Hoglund for suggesting the correct approach Task-number: QTBUG-6044 Merge-request: 1133 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qapplication_x11.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 31f70c7..20542ea 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2281,6 +2281,13 @@ void qt_init(QApplicationPrivate *priv, int, // Attempt to determine the current running X11 Desktop Enviornment // Use dbus if/when we can, but fall back to using windowManagerName() for now +#ifndef QT_NO_XFIXES + if (X11->ptrXFixesSelectSelectionInput) + X11->ptrXFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0), + XFixesSetSelectionOwnerNotifyMask + | XFixesSelectionWindowDestroyNotifyMask + | XFixesSelectionClientCloseNotifyMask); +#endif // QT_NO_XFIXES X11->compositingManagerRunning = XGetSelectionOwner(X11->display, ATOM(_NET_WM_CM_S0)); X11->desktopEnvironment = DE_UNKNOWN; @@ -3216,6 +3223,8 @@ int QApplication::x11ProcessEvent(XEvent* event) XFixesSelectionNotifyEvent *req = reinterpret_cast(event); X11->time = req->selection_timestamp; + if (req->selection == ATOM(_NET_WM_CM_S0)) + X11->compositingManagerRunning = req->owner; } #endif -- cgit v0.12