瀏覽代碼

libobs: Remove module UI functions

derrod 2 年之前
父節點
當前提交
5177a593af
共有 7 個文件被更改,包括 0 次插入259 次删除
  1. 0 1
      libobs/CMakeLists.txt
  2. 0 1
      libobs/cmake/legacy.cmake
  3. 0 2
      libobs/obs-internal.h
  4. 0 33
      libobs/obs-module.c
  5. 0 159
      libobs/obs-ui.h
  6. 0 62
      libobs/obs.c
  7. 0 1
      libobs/obs.h

+ 0 - 1
libobs/CMakeLists.txt

@@ -69,7 +69,6 @@ target_sources(
           obs-source-transition.c
           obs-source.c
           obs-source.h
-          obs-ui.h
           obs-video-gpu-encode.c
           obs-video.c
           obs-view.c

+ 0 - 1
libobs/cmake/legacy.cmake

@@ -68,7 +68,6 @@ target_sources(
           obs-source.h
           obs-source-deinterlace.c
           obs-source-transition.c
-          obs-ui.h
           obs-video.c
           obs-video-gpu-encode.c
           obs-view.c

+ 0 - 2
libobs/obs-internal.h

@@ -475,8 +475,6 @@ struct obs_core {
 	DARRAY(struct obs_output_info) output_types;
 	DARRAY(struct obs_encoder_info) encoder_types;
 	DARRAY(struct obs_service_info) service_types;
-	DARRAY(struct obs_modal_ui) modal_ui_callbacks;
-	DARRAY(struct obs_modeless_ui) modeless_ui_callbacks;
 
 	signal_handler_t *signals;
 	proc_handler_t *procs;

+ 0 - 33
libobs/obs-module.c

@@ -965,36 +965,3 @@ void obs_register_service_s(const struct obs_service_info *info, size_t size)
 error:
 	HANDLE_ERROR(size, obs_service_info, info);
 }
-
-void obs_register_modal_ui_s(const struct obs_modal_ui *info, size_t size)
-{
-#define CHECK_REQUIRED_VAL_(info, val, func) \
-	CHECK_REQUIRED_VAL(struct obs_modal_ui, info, val, func)
-	CHECK_REQUIRED_VAL_(info, task, obs_register_modal_ui);
-	CHECK_REQUIRED_VAL_(info, target, obs_register_modal_ui);
-	CHECK_REQUIRED_VAL_(info, exec, obs_register_modal_ui);
-#undef CHECK_REQUIRED_VAL_
-
-	REGISTER_OBS_DEF(size, obs_modal_ui, obs->modal_ui_callbacks, info);
-	return;
-
-error:
-	HANDLE_ERROR(size, obs_modal_ui, info);
-}
-
-void obs_register_modeless_ui_s(const struct obs_modeless_ui *info, size_t size)
-{
-#define CHECK_REQUIRED_VAL_(info, val, func) \
-	CHECK_REQUIRED_VAL(struct obs_modeless_ui, info, val, func)
-	CHECK_REQUIRED_VAL_(info, task, obs_register_modeless_ui);
-	CHECK_REQUIRED_VAL_(info, target, obs_register_modeless_ui);
-	CHECK_REQUIRED_VAL_(info, create, obs_register_modeless_ui);
-#undef CHECK_REQUIRED_VAL_
-
-	REGISTER_OBS_DEF(size, obs_modeless_ui, obs->modeless_ui_callbacks,
-			 info);
-	return;
-
-error:
-	HANDLE_ERROR(size, obs_modeless_ui, info);
-}

+ 0 - 159
libobs/obs-ui.h

@@ -1,159 +0,0 @@
-/******************************************************************************
-    Copyright (C) 2023 by Lain Bailey <[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
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-******************************************************************************/
-
-#pragma once
-
-#include "util/c99defs.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *   @file
- *
- *   Modules can specify custom user-interface-specific exports.  UI functions
- * can be within the same library as the actual core logic, or separated in to
- * different modules to split up UI logic and core module logic.
- *
- *   The reasoning for this is to allow for custom user interface of differing
- * toolkits or for automatically generated user interface, or to simply allow
- * separation of UI code from core code (which may often be in differing
- * languages).
- */
-
-/** Modal UI definition structure */
-struct obs_modal_ui {
-	const char *id;     /**< Identifier associated with this UI */
-	const char *task;   /**< Task of the UI */
-	const char *target; /**< UI target (UI toolkit or program name) */
-
-	/**
-	 * Callback to execute modal interface.
-	 *
-	 * The @b object variable points to the input/output/encoder/etc.  The
-	 * @b ui_data variable points to the UI parent or UI-specific data to
-	 * be used with the custom user interface.
-	 *
-	 * What @b ui_data points to differs depending on the target, and you
-	 * should use discretion and consistency when using this variable to
-	 * relay information to the UI function.  For example, it would be
-	 * ideal to have @b ui_data point to a parent, QWidget for Qt, or a
-	 * wxWindow for wxWidgets, etc., though it's up to the discretion of
-	 * the developer to define that value.  Because of the nature of void
-	 * pointers, discretion and consistency is advised.
-	 *
-	 * @param  object   Pointer/handle to the data associated with this
-	 *                  call.
-	 * @param  ui_data  UI data to pass associated with this specific
-	 *                  target, if any.
-	 * @return          @b true if user completed the task, or
-	 *                  @b false if user cancelled the task.
-	 */
-	bool (*exec)(void *object, void *ui_data);
-
-	void *type_data;
-	void (*free_type_data)(void *type_data);
-};
-
-/**
- * Registers a modal UI definition to the current obs context.  This should be
- * used in obs_module_load.
- *
- * @param  info  Pointer to the modal definition structure
- */
-EXPORT void obs_register_modal_ui(const struct obs_modal_ui *info);
-
-/* ------------------------------------------------------------------------- */
-
-/** Modeless UI definition structure */
-struct obs_modeless_ui {
-	const char *id;     /**< Identifier associated with this UI */
-	const char *task;   /**< Task of the UI */
-	const char *target; /**< UI target (UI toolkit or program name) */
-
-	/**
-	 * Callback to create modeless interface.
-	 *
-	 * This function is almost identical to the modal exec function,
-	 * except modeless UI calls return immediately, and typically are
-	 * supposed to return a pointer or handle to the specific UI object
-	 * that was created.  For example, a Qt object would ideally return a
-	 * pointer to a QWidget.  Again, discretion and consistency is advised
-	 * for the return value.
-	 *
-	 * @param   object  Pointer/handle to the data associated with this
-	 *                  call.
-	 * @param  ui_data  UI data to pass associated with this specific
-	 *                  target, if any.
-	 * @return          Pointer/handle to the modeless UI associated with
-	 *                  the specific target.
-	 */
-	void *(*create)(void *object, void *ui_data);
-
-	void *type_data;
-	void (*free_type_data)(void *type_data);
-};
-
-/**
- * Registers a modeless UI definition to the current obs context.  This should
- * be used in obs_module_load.
- *
- * @param  info  Pointer to the modal definition structure
- */
-EXPORT void obs_register_modeless_ui(const struct obs_modeless_ui *info);
-
-/* ------------------------------------------------------------------------- */
-
-#define OBS_UI_SUCCESS 0
-#define OBS_UI_CANCEL -1
-#define OBS_UI_NOTFOUND -2
-
-/**
- * Requests modal UI to be displayed.  Returns when user is complete.
- *
- * @param    name  Name of the input/output/etc type that UI was requested for
- * @param    task  Task of the user interface (usually "config")
- * @param  target  Desired target (i.e. "qt", "wx", "gtk3", "win32", etc)
- * @param    data  Pointer to the obs input/output/etc
- * @param ui_data  UI-specific data, usually a parent pointer/handle (if any)
- *
- * @return         OBS_UI_SUCCESS if the UI was successful,
- *                 OBS_UI_CANCEL if the UI was cancelled by the user, or
- *                 OBS_UI_NOTFOUND if the UI callback was not found
- */
-EXPORT int obs_exec_ui(const char *id, const char *task, const char *target,
-		       void *data, void *ui_data);
-
-/**
- * Requests modeless UI to be created.  Returns immediately.
- *
- * @param    name  Name of the input/output/etc type that UI was requested for
- * @param    task  Task of the user interface
- * @param  target  Desired target (i.e. "qt", "wx", "gtk3", "win32", etc)
- * @param    data  Pointer to the obs input/output/etc
- * @param ui_data  UI-specific data, usually a parent pointer/handle (if any)
- *
- * @return         Pointer/handle to the target-specific modeless object, or
- *                 NULL if not found or failed.
- */
-EXPORT void *obs_create_ui(const char *id, const char *task, const char *target,
-			   void *data, void *ui_data);
-
-#ifdef __cplusplus
-}
-#endif

+ 0 - 62
libobs/obs.c

@@ -1415,8 +1415,6 @@ void obs_shutdown(void)
 	FREE_REGISTERED_TYPES(obs_output_info, obs->output_types);
 	FREE_REGISTERED_TYPES(obs_encoder_info, obs->encoder_types);
 	FREE_REGISTERED_TYPES(obs_service_info, obs->service_types);
-	FREE_REGISTERED_TYPES(obs_modal_ui, obs->modal_ui_callbacks);
-	FREE_REGISTERED_TYPES(obs_modeless_ui, obs->modeless_ui_callbacks);
 
 #undef FREE_REGISTERED_TYPES
 
@@ -1807,66 +1805,6 @@ video_t *obs_get_video(void)
 	return obs->video.main_mix->video;
 }
 
-/* TODO: optimize this later so it's not just O(N) string lookups */
-static inline struct obs_modal_ui *
-get_modal_ui_callback(const char *id, const char *task, const char *target)
-{
-	for (size_t i = 0; i < obs->modal_ui_callbacks.num; i++) {
-		struct obs_modal_ui *callback =
-			obs->modal_ui_callbacks.array + i;
-
-		if (strcmp(callback->id, id) == 0 &&
-		    strcmp(callback->task, task) == 0 &&
-		    strcmp(callback->target, target) == 0)
-			return callback;
-	}
-
-	return NULL;
-}
-
-static inline struct obs_modeless_ui *
-get_modeless_ui_callback(const char *id, const char *task, const char *target)
-{
-	for (size_t i = 0; i < obs->modeless_ui_callbacks.num; i++) {
-		struct obs_modeless_ui *callback;
-		callback = obs->modeless_ui_callbacks.array + i;
-
-		if (strcmp(callback->id, id) == 0 &&
-		    strcmp(callback->task, task) == 0 &&
-		    strcmp(callback->target, target) == 0)
-			return callback;
-	}
-
-	return NULL;
-}
-
-int obs_exec_ui(const char *name, const char *task, const char *target,
-		void *data, void *ui_data)
-{
-	struct obs_modal_ui *callback;
-	int errorcode = OBS_UI_NOTFOUND;
-
-	if (!obs)
-		return errorcode;
-
-	callback = get_modal_ui_callback(name, task, target);
-	if (callback) {
-		bool success = callback->exec(data, ui_data);
-		errorcode = success ? OBS_UI_SUCCESS : OBS_UI_CANCEL;
-	}
-
-	return errorcode;
-}
-
-void *obs_create_ui(const char *name, const char *task, const char *target,
-		    void *data, void *ui_data)
-{
-	struct obs_modeless_ui *callback;
-
-	callback = get_modeless_ui_callback(name, task, target);
-	return callback ? callback->create(data, ui_data) : NULL;
-}
-
 obs_source_t *obs_get_output_source(uint32_t channel)
 {
 	return obs_view_get_source(&obs->data.main_view, channel);

+ 0 - 1
libobs/obs.h

@@ -32,7 +32,6 @@
 #include "obs-config.h"
 #include "obs-defs.h"
 #include "obs-data.h"
-#include "obs-ui.h"
 #include "obs-properties.h"
 #include "obs-interaction.h"