From 3cfa01233cd4a66f387cf9f2200de1275f84cf45 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 9 Oct 2022 17:47:39 +0200
Subject: [PATCH] tray: Fix infinite update loop
tray_client::clear_window is called on expose events for the wrapper
window, thus it must not produce expose events for itself again.
---
src/x11/tray_client.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/x11/tray_client.cpp b/src/x11/tray_client.cpp
index 09a4ec71..b3f3757b 100644
--- a/src/x11/tray_client.cpp
+++ b/src/x11/tray_client.cpp
@@ -130,7 +130,8 @@ unsigned int tray_client::height() const {
}
void tray_client::clear_window() const {
- m_connection.clear_area_checked(1, embedder(), 0, 0, width(), height());
+ // Do not produce Expose events for the embedder because that triggers an infinite loop.
+ m_connection.clear_area_checked(0, embedder(), 0, 0, width(), height());
m_connection.clear_area_checked(1, client(), 0, 0, width(), height());
}
@@ -340,7 +341,7 @@ void tray_client::update_bg() const {
void tray_client::observe_background() {
xcb_rectangle_t rect{0, 0, static_cast(m_size.w), static_cast(m_size.h)};
- m_bg_slice = m_background_manager.observe(rect, m_wrapper);
+ m_bg_slice = m_background_manager.observe(rect, embedder());
update_bg();
}