From 901183a60a29cb78e8b3485d8fec0c8b9b64a251 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sat, 3 Sep 2022 22:34:00 +0200
Subject: [PATCH] tray: Fix tray not updating after (un)map_notify
The issue was that the event was for the wrapper window and that the
tray_client's move constructors didn't correctly copy over all data and
so when the m_clients vector grew, it corrupted the state of all
existing clients.
---
include/x11/tray_manager.hpp | 5 +++--
src/x11/tray_client.cpp | 13 +++++++++++--
src/x11/tray_manager.cpp | 31 +++++++++++++++++--------------
3 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index 0bf4dee9..1452804d 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -64,7 +64,8 @@ class tray_manager : public xpp::event::sink {
public:
- explicit tray_manager(connection& conn, signal_emitter& emitter, const logger& logger, const bar_settings& bar_opts, on_update on_update);
+ explicit tray_manager(connection& conn, signal_emitter& emitter, const logger& logger, const bar_settings& bar_opts,
+ on_update on_update);
~tray_manager();
@@ -108,7 +109,7 @@ class tray_manager : public xpp::event::sinkparent != client->embedder()) {
- m_log.trace("tray: Received reparent_notify for client, remove...");
+ m_log.info("tray: Received reparent_notify for client, remove...");
remove_client(*client);
}
}
@@ -680,7 +683,7 @@ void tray_manager::handle(const evt::destroy_notify& evt) {
m_log.info("Systray selection unmanaged... re-activating");
activate();
} else if (m_activated && is_embedded(evt->window)) {
- m_log.trace("tray: Received destroy_notify for client, remove...");
+ m_log.info("tray: Received destroy_notify for client, remove...");
remove_client(evt->window);
redraw_window();
}
@@ -694,7 +697,7 @@ void tray_manager::handle(const evt::map_notify& evt) {
m_log.trace("tray: Received map_notify");
m_log.trace("tray: Update container mapped flag");
redraw_window();
- } else if (is_embedded(evt->window)) { // TODO FIXME evt->window points to the wrapper window
+ } else if (is_embedded(evt->window)) {
m_log.trace("tray: Received map_notify");
m_log.trace("tray: Set client mapped");
auto client = find_client(evt->window);
@@ -710,7 +713,7 @@ void tray_manager::handle(const evt::map_notify& evt) {
* Event callback : XCB_UNMAP_NOTIFY
*/
void tray_manager::handle(const evt::unmap_notify& evt) {
- if (m_activated && is_embedded(evt->window)) { // TODO FIXME evt->window points to the wrapper window
+ if (m_activated && is_embedded(evt->window)) {
m_log.trace("tray: Received unmap_notify");
m_log.trace("tray: Set client unmapped");
auto client = find_client(evt->window);