From 9544130b9cc8905fbbee1816c2477c3f25b34905 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 7 Mar 2022 12:20:45 +0100
Subject: [PATCH] Fix screen messing up if client docking fails
The client window has to be added to the save set after it has been
reparented. Otherwise if the reparenting fails weird stuff happens
(windows in the save set have to be child windows of windows created by
the current connection).
---
src/x11/tray_manager.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index 10eb4fc2..7ba6f771 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -727,9 +727,6 @@ void tray_manager::process_docking_request(xcb_window_t win) {
m_log.trace("tray: Configure client size");
client.reconfigure(0, 0);
- m_log.trace("tray: Add client window to the save set");
- m_connection.change_save_set_checked(XCB_SET_MODE_INSERT, client.window());
-
// TODO properly support tray icon backgrounds
auto p = XCB_BACK_PIXMAP_NONE;
m_connection.change_window_attributes_checked(client.window(), XCB_CW_BACK_PIXMAP, &p);
@@ -737,6 +734,9 @@ void tray_manager::process_docking_request(xcb_window_t win) {
m_connection.reparent_window_checked(
client.window(), m_tray, calculate_client_x(client.window()), calculate_client_y());
+ m_log.trace("tray: Add client window to the save set");
+ m_connection.change_save_set_checked(XCB_SET_MODE_INSERT, client.window());
+
if (client.is_xembed_supported()) {
m_log.trace("tray: Send embbeded notification to client");
xembed::notify_embedded(m_connection, client.window(), m_tray, client.get_xembed().get_version());