From 175b0cbc83a5e9cda9ae9fc8c939df5c9cd8a3ff Mon Sep 17 00:00:00 2001 From: gxalpha Date: Sat, 25 May 2024 13:43:59 +0200 Subject: [PATCH] UI: Update edit menu on source filter changes Currently, when adding a filter to a source and then right-clicking it or using the menu bar edit menu, it's not possible to copy the source's filters. This is because the edit menu does not update on filter changes. Listening to the new global filters add/remove signal and updating the edit menu will enable the copy option if a filter get added or disable the option if the last filter gets removed. --- UI/window-basic-main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 061ed71d5..515797990 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -1866,6 +1866,18 @@ void OBSBasic::InitOBSCallbacks() OBSBasic::SourceAudioDeactivated, this); signalHandlers.emplace_back(obs_get_signal_handler(), "source_rename", OBSBasic::SourceRenamed, this); + signalHandlers.emplace_back( + obs_get_signal_handler(), "source_filter_add", + [](void *data, calldata_t *) { + static_cast(data)->UpdateEditMenu(); + }, + this); + signalHandlers.emplace_back( + obs_get_signal_handler(), "source_filter_remove", + [](void *data, calldata_t *) { + static_cast(data)->UpdateEditMenu(); + }, + this); } void OBSBasic::InitPrimitives()