summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacopo De Simoi <desimoi@mat.uniroma2.it>2011-03-31 10:15:39 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-03-31 10:15:39 (GMT)
commitb6de9d5bcb3eb503dc2b1f9559d1e89f778d1d76 (patch)
tree4aa5d41527a0b45db144649736914abb7efa5384
parent8616c85eaa69fac5b15aa9a3d416f9c8b0098c17 (diff)
downloadQt-b6de9d5bcb3eb503dc2b1f9559d1e89f778d1d76.zip
Qt-b6de9d5bcb3eb503dc2b1f9559d1e89f778d1d76.tar.gz
Qt-b6de9d5bcb3eb503dc2b1f9559d1e89f778d1d76.tar.bz2
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 <denis.dzyubenko@nokia.com>
-rw-r--r--src/gui/kernel/qapplication_x11.cpp9
1 files changed, 9 insertions, 0 deletions
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<XFixesSelectionNotifyEvent *>(event);
X11->time = req->selection_timestamp;
+ if (req->selection == ATOM(_NET_WM_CM_S0))
+ X11->compositingManagerRunning = req->owner;
}
#endif