libobs, UI: Implement item_locked event

Similar to item_visible, this event fires whenever a scene item is
locked or unlocked. This allows the UI and libobs to remain in sync
regarding scene elements' statuses.
This commit is contained in:
Chris Angelico
2019-05-24 21:34:41 +10:00
committed by jp9000
parent dd607b422f
commit 2fe641b8a4
5 changed files with 46 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ static const char *obs_scene_signals[] = {
"void item_select(ptr scene, ptr item)",
"void item_deselect(ptr scene, ptr item)",
"void item_transform(ptr scene, ptr item)",
"void item_locked(ptr scene, ptr item, bool locked)",
NULL
};
@@ -2118,6 +2119,9 @@ bool obs_sceneitem_locked(const obs_sceneitem_t *item)
bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool lock)
{
struct calldata cd;
uint8_t stack[256];
if (!item)
return false;
@@ -2129,6 +2133,12 @@ bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool lock)
item->locked = lock;
calldata_init_fixed(&cd, stack, sizeof(stack));
calldata_set_ptr(&cd, "item", item);
calldata_set_bool(&cd, "locked", lock);
signal_parent(item->parent, "item_locked", &cd);
return true;
}