summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-06 03:19:57 +0000
committerDavid Robillard <d@drobilla.net>2011-03-06 03:19:57 +0000
commit711b26e71b0dcc160616fa015793a0e57acc8a8c (patch)
tree66c7ad66d37246df15e6003d736a5174a90db26f /src
parente779b2aeea2a9f9594cdb2a26c2bfd43868fe785 (diff)
downloadlilv-711b26e71b0dcc160616fa015793a0e57acc8a8c.tar.gz
lilv-711b26e71b0dcc160616fa015793a0e57acc8a8c.tar.bz2
lilv-711b26e71b0dcc160616fa015793a0e57acc8a8c.zip
Add a UI host descriptor to allow for a graceful transition to a more powerful UI extension.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3044 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/pluginuiinstance.c41
-rw-r--r--src/slv2_internal.h8
2 files changed, 43 insertions, 6 deletions
diff --git a/src/pluginuiinstance.c b/src/pluginuiinstance.c
index c851c8f..e805961 100644
--- a/src/pluginuiinstance.c
+++ b/src/pluginuiinstance.c
@@ -45,17 +45,46 @@ slv2_ui_instantiate(SLV2Plugin plugin,
LV2UI_Controller controller,
const LV2_Feature* const* features)
{
- return slv2_ui_instance_new(
- plugin, ui, NULL, write_function, controller, features);
+ SLV2UIHost ui_host = slv2_ui_host_new(
+ controller, write_function, NULL, NULL, NULL);
+
+ SLV2UIInstance ret = slv2_ui_instance_new(
+ plugin, ui, NULL, ui_host, features);
+
+ slv2_ui_host_free(ui_host);
+ return ret;
}
SLV2_API
+SLV2UIHost
+slv2_ui_host_new(LV2UI_Controller controller,
+ LV2UI_Write_Function write_function,
+ SLV2PortIndexFunction port_index_function,
+ SLV2PortSubscribeFunction port_subscribe_function,
+ SLV2PortUnsubscribeFunction port_unsubscribe_function)
+{
+ SLV2UIHost ret = malloc(sizeof(struct _SLV2UIHost));
+ ret->controller = controller;
+ ret->write_function = write_function;
+ ret->port_index_function = port_index_function;
+ ret->port_subscribe_function = port_subscribe_function;
+ ret->port_unsubscribe_function = port_unsubscribe_function;
+ return ret;
+}
+
+SLV2_API
+void
+slv2_ui_host_free(SLV2UIHost ui_host)
+{
+ free(ui_host);
+}
+
+SLV2_API
SLV2UIInstance
slv2_ui_instance_new(SLV2Plugin plugin,
SLV2UI ui,
SLV2Value widget_type_uri,
- LV2UI_Write_Function write_function,
- LV2UI_Controller controller,
+ SLV2UIHost ui_host,
const LV2_Feature* const* features)
{
#ifdef HAVE_SUIL
@@ -79,8 +108,8 @@ slv2_ui_instance_new(SLV2Plugin plugin,
lib_path,
slv2_value_as_uri(ui_type),
slv2_value_as_uri(widget_type_uri),
- write_function,
- controller,
+ ui_host->write_function,
+ ui_host->controller,
features);
if (!suil_instance) {
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 1313bd3..7e3693a 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -158,6 +158,14 @@ struct _SLV2UIInstance {
SuilInstance instance;
};
+struct _SLV2UIHost {
+ LV2UI_Controller controller;
+ LV2UI_Write_Function write_function;
+ SLV2PortIndexFunction port_index_function;
+ SLV2PortSubscribeFunction port_subscribe_function;
+ SLV2PortUnsubscribeFunction port_unsubscribe_function;
+};
+
/* ********* Plugin Class ********* */
struct _SLV2PluginClass {