Blob Blame History Raw
From 72de0df09c2fb5b0d61b019753aa4522964113a5 Mon Sep 17 00:00:00 2001
From: Stefan Becker <chemobejk@gmail.com>
Date: Mon, 25 May 2015 17:46:49 +0300
Subject: [PATCH 2/2] xcb: set SM_CLIENT_ID property

SM_CLIENT_ID is required by kwin for proper session management.

Copy the code from the QT4 implementation to the appropriate place in
QT5.

Task-number: QTBUG-46310
---
 src/plugins/platforms/xcb/qxcbwindow.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index f8c2ff8..513f556 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -530,6 +530,16 @@ void QXcbWindow::create()
                                    atom(QXcbAtom::WM_CLIENT_LEADER), XCB_ATOM_WINDOW, 32,
                                    1, &leader));
 
+#ifndef QT_NO_SESSIONMANAGER
+    // If we are session managed, inform the window manager about it
+    QByteArray session = qApp->sessionId().toLatin1();
+    if (!session.isEmpty()) {
+        Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, leader,
+                                       atom(QXcbAtom::SM_CLIENT_ID), XCB_ATOM_STRING, 8,
+                                       session.length(), session.constData()));
+    }
+#endif
+
     /* Add XEMBED info; this operation doesn't initiate the embedding. */
     quint32 data[] = { XEMBED_VERSION, XEMBED_MAPPED };
     Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
-- 
2.4.0