Fixed cases where the module would be hidden when it should be visible

This commit is contained in:
Erik Reider 2023-10-26 23:37:10 +02:00
parent f7224d8459
commit e73ea8d608
2 changed files with 14 additions and 7 deletions

View File

@ -30,6 +30,7 @@ class Privacy : public AModule {
PrivacyItem privacy_item_audio_input; PrivacyItem privacy_item_audio_input;
PrivacyItem privacy_item_audio_output; PrivacyItem privacy_item_audio_output;
std::mutex mutex_;
sigc::connection visibility_conn; sigc::connection visibility_conn;
// Config // Config

View File

@ -67,6 +67,7 @@ Privacy::Privacy(const std::string& id, const Json::Value& config, const std::st
} }
void Privacy::onPrivacyNodesChanged() { void Privacy::onPrivacyNodesChanged() {
mutex_.lock();
nodes_audio_out.clear(); nodes_audio_out.clear();
nodes_audio_in.clear(); nodes_audio_in.clear();
nodes_screenshare.clear(); nodes_screenshare.clear();
@ -100,6 +101,7 @@ void Privacy::onPrivacyNodesChanged() {
} }
} }
mutex_.unlock();
dp.emit(); dp.emit();
} }
@ -121,9 +123,13 @@ auto Privacy::update() -> void {
if (is_visible) { if (is_visible) {
event_box_.set_visible(true); event_box_.set_visible(true);
} else { } else {
visibility_conn = Glib::signal_timeout().connect(sigc::track_obj( visibility_conn = Glib::signal_timeout().connect(
sigc::track_obj(
[this] { [this] {
event_box_.set_visible(false); bool screenshare = !nodes_screenshare.empty();
bool audio_in = !nodes_audio_in.empty();
bool audio_out = !nodes_audio_out.empty();
event_box_.set_visible(screenshare || audio_in || audio_out);
return false; return false;
}, },
*this), *this),