浏览代码

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.
gxalpha 1 年之前
父节点
当前提交
175b0cbc83
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      UI/window-basic-main.cpp

+ 12 - 0
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<OBSBasic *>(data)->UpdateEditMenu();
+		},
+		this);
+	signalHandlers.emplace_back(
+		obs_get_signal_handler(), "source_filter_remove",
+		[](void *data, calldata_t *) {
+			static_cast<OBSBasic *>(data)->UpdateEditMenu();
+		},
+		this);
 }
 
 void OBSBasic::InitPrimitives()