From fbedc3d133d627b8ff4f8c9fe5744739bf8dd0b3 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Sun, 19 Sep 2021 18:30:41 +0300 Subject: [PATCH] fix(tray): fix visibility of Passive items `show_all` call from `Tray::update` attempts to walk the widget tree and make every widget visible. Since we control individual tray item visibility based on `Status` SNI property, we don't want that to happen. Modify `Tray::update` to control the visibility of a whole tray module only and ensure that the children of `Item` are still visible when necessary. --- src/modules/sni/item.cpp | 1 + src/modules/sni/tray.cpp | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index d9748ed..b504c8d 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -62,6 +62,7 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf event_box.signal_button_press_event().connect(sigc::mem_fun(*this, &Item::handleClick)); event_box.signal_scroll_event().connect(sigc::mem_fun(*this, &Item::handleScroll)); // initial visibility + event_box.show_all(); event_box.set_visible(show_passive_); cancellable_ = Gio::Cancellable::create(); diff --git a/src/modules/sni/tray.cpp b/src/modules/sni/tray.cpp index e73c9eb..70b0d37 100644 --- a/src/modules/sni/tray.cpp +++ b/src/modules/sni/tray.cpp @@ -35,11 +35,8 @@ void Tray::onRemove(std::unique_ptr& item) { } auto Tray::update() -> void { - if (box_.get_children().empty()) { - box_.hide(); - } else { - box_.show_all(); - } + // Show tray only when items are availale + box_.set_visible(!box_.get_children().empty()); // Call parent update AModule::update(); }