From 577d0b21297c2b5aa87dafa864e3d7aba1a61366 Mon Sep 17 00:00:00 2001 From: Socapex Date: Tue, 17 Feb 2015 12:54:45 -0500 Subject: [PATCH] libobs: Replace item_move_* signals These signals introduce unnecessary complexity. Instead of emitting a signal for a specific move direction, just signal that the scene has been reordered, that way the target just refreshes the list. --- libobs/obs-scene.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 27e1b60dc..3f5887240 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -1,5 +1,6 @@ /****************************************************************************** - Copyright (C) 2013 by Hugh Bailey + Copyright (C) 2013-2015 by Hugh Bailey + Philippe Groarke This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,10 +23,7 @@ static const char *obs_scene_signals[] = { "void item_add(ptr scene, ptr item)", "void item_remove(ptr scene, ptr item)", - "void item_move_up(ptr scene, ptr item)", - "void item_move_down(ptr scene, ptr item)", - "void item_move_top(ptr scene, ptr item)", - "void item_move_bottom(ptr scene, ptr item)", + "void reorder(ptr scene)", "void item_select(ptr scene, ptr item)", "void item_deselect(ptr scene, ptr item)", "void item_transform(ptr scene, ptr item)", @@ -725,21 +723,14 @@ void obs_sceneitem_set_alignment(obs_sceneitem_t *item, uint32_t alignment) } } -static inline void signal_move_dir(struct obs_scene_item *item, - enum obs_order_movement movement) +static inline void signal_reorder(struct obs_scene_item *item) { const char *command = NULL; struct calldata params = {0}; - switch (movement) { - case OBS_ORDER_MOVE_UP: command = "item_move_up"; break; - case OBS_ORDER_MOVE_DOWN: command = "item_move_down"; break; - case OBS_ORDER_MOVE_TOP: command = "item_move_top"; break; - case OBS_ORDER_MOVE_BOTTOM: command = "item_move_bottom"; break; - } + command = "reorder"; calldata_set_ptr(¶ms, "scene", item->parent); - calldata_set_ptr(¶ms, "item", item); signal_handler_signal(item->parent->source->context.signals, command, ¶ms); @@ -784,7 +775,7 @@ void obs_sceneitem_set_order(obs_sceneitem_t *item, attach_sceneitem(scene, item, NULL); } - signal_move_dir(item, movement); + signal_reorder(item); pthread_mutex_unlock(&scene->mutex); obs_scene_release(scene);