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.
master
Socapex 2015-02-17 12:54:45 -05:00 committed by jp9000
parent c6008316e2
commit 577d0b2129
1 changed files with 6 additions and 15 deletions

View File

@ -1,5 +1,6 @@
/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
Copyright (C) 2013-2015 by Hugh Bailey <obs.jim@gmail.com>
Philippe Groarke <philippe.groarke@gmail.com>
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(&params, "scene", item->parent);
calldata_set_ptr(&params, "item", item);
signal_handler_signal(item->parent->source->context.signals,
command, &params);
@ -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);