Răsfoiți Sursa

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.
Socapex 11 ani în urmă
părinte
comite
577d0b2129
1 a modificat fișierele cu 6 adăugiri și 15 ștergeri
  1. 6 15
      libobs/obs-scene.c

+ 6 - 15
libobs/obs-scene.c

@@ -1,5 +1,6 @@
 /******************************************************************************
-    Copyright (C) 2013 by Hugh Bailey <[email protected]>
+    Copyright (C) 2013-2015 by Hugh Bailey <[email protected]>
+                               Philippe Groarke <[email protected]>
 
     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);