Browse Source

Make some minor adjustments to module UI code

Made it so that enum_ui returns a const pointer to a structure rather
than require an actual structure.

Changed a few of the descriptions that I missed.
jp9000 11 years ago
parent
commit
8bb208a090
2 changed files with 11 additions and 10 deletions
  1. 6 6
      libobs/obs-module.c
  2. 5 4
      libobs/obs-ui.h

+ 6 - 6
libobs/obs-module.c

@@ -78,8 +78,8 @@ complete:
 
 static void module_load_ui_exports(struct obs_module *mod)
 {
-	bool (*enum_func)(size_t idx, struct obs_ui_info *info);
-	struct obs_ui_info ui_info;
+	bool (*enum_func)(size_t idx, const struct obs_ui_info **info);
+	const struct obs_ui_info *ui_info;
 	size_t i = 0;
 
 	enum_func = os_dlsym(mod->module, "enum_ui");
@@ -90,13 +90,13 @@ static void module_load_ui_exports(struct obs_module *mod)
 		struct ui_callback callback;
 		struct dstr name;
 
-		dstr_init_copy(&name, ui_info.name);
+		dstr_init_copy(&name, ui_info->name);
 		dstr_cat(&name, "_");
-		dstr_cat(&name, ui_info.task);
+		dstr_cat(&name, ui_info->task);
 		dstr_cat(&name, "_");
-		dstr_cat(&name, ui_info.target);
+		dstr_cat(&name, ui_info->target);
 
-		callback.ui_info = ui_info;
+		callback.ui_info = *ui_info;
 		callback.callback = os_dlsym(mod->module, name.array);
 
 		if (!callback.callback) {

+ 5 - 4
libobs/obs-ui.h

@@ -67,9 +67,10 @@ struct obs_ui_info {
  * ===========================================
  *   Primary Exports
  * ===========================================
- *   bool enum_ui(size_t idx, struct obs_ui_info *ui_info);
- *       idx: index of the enumeration
- *       export: full name of the actual UI export.
+ *   bool enum_ui(size_t idx, const struct obs_ui_info **ui_info);
+ *
+ *                idx: index of the enumeration
+ *            ui_info: pointer to the ui data for this enumeration
  *       Return value: false when no more available.
  *
  * ===========================================
@@ -121,7 +122,7 @@ struct obs_ui_info {
  *           task: Task of the user interface (i.e. "config", "config_panel")
  *         target: Desired target (i.e. "qt", "wx", "gtk3", "win32", etc)
  *           data: Pointer to the obs input/output/etc
- *         parent: Parent pointer for UI toolkit (if any)
+ *        ui_data: UI-specific data, usually a parent pointer/handle (if any)
  *
  *   Return value: OBS_UI_SUCCESS if the UI was successful
  *                 OBS_UI_CANCEL if the UI was cancelled by the user