aboutsummaryrefslogtreecommitdiff
path: root/sandbox_ui.lv2
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-12 09:22:03 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-12 09:22:03 +0200
commitf0e252173a38da0f29566ad5650e6cd844925060 (patch)
treee6a2286a4066ee2ac4e42e03ff22e214030aa785 /sandbox_ui.lv2
parentdd75357abfc92e9256ed8a15770097a3acfa6a94 (diff)
parent763fa6e8445aa004ac727779e60115a6f1c0092a (diff)
downloadsherlock.lv2-f0e252173a38da0f29566ad5650e6cd844925060.tar.xz
Merge commit '763fa6e8445aa004ac727779e60115a6f1c0092a'
Diffstat (limited to 'sandbox_ui.lv2')
-rw-r--r--sandbox_ui.lv2/sandbox_efl.c9
-rw-r--r--sandbox_ui.lv2/sandbox_slave.c55
-rw-r--r--sandbox_ui.lv2/sandbox_slave.h10
3 files changed, 28 insertions, 46 deletions
diff --git a/sandbox_ui.lv2/sandbox_efl.c b/sandbox_ui.lv2/sandbox_efl.c
index 90211de..59344a0 100644
--- a/sandbox_ui.lv2/sandbox_efl.c
+++ b/sandbox_ui.lv2/sandbox_efl.c
@@ -22,6 +22,8 @@
#include <sandbox_slave.h>
+#include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
+
#include <Elementary.h>
typedef struct _app_t app_t;
@@ -86,7 +88,12 @@ _init(sandbox_slave_t *sb, void *data)
evas_object_show(app->bg);
elm_win_resize_object_add(app->win, app->bg);
- if( sandbox_slave_instantiate(sb, (void *)app->win, (void *)&app->widget)
+ const LV2_Feature parent_feature = {
+ .URI = LV2_UI__parent,
+ .data = app->win
+ };
+
+ if( !sandbox_slave_instantiate(sb, &parent_feature, &app->widget)
|| !app->widget)
{
fprintf(stderr, "sandbox_slave_instantiate failed\n");
diff --git a/sandbox_ui.lv2/sandbox_slave.c b/sandbox_ui.lv2/sandbox_slave.c
index 9e1e665..cbfe9a7 100644
--- a/sandbox_ui.lv2/sandbox_slave.c
+++ b/sandbox_ui.lv2/sandbox_slave.c
@@ -44,9 +44,6 @@ struct _sandbox_slave_t {
LV2UI_Port_Subscribe port_subscribe;
LV2UI_Resize host_resize;
- const LV2UI_Resize *client_resize;
-
- const LV2UI_Idle_Interface *idle_iface;
LilvWorld *world;
LilvNode *bundle_node;
@@ -180,15 +177,6 @@ _sandbox_recv_cb(LV2UI_Handle handle, uint32_t index, uint32_t size,
sb->desc->port_event(sb->handle, index, size, protocol, buf);
}
-static inline int
-_sandbox_resize(sandbox_slave_t *sb, int w, int h)
-{
- if(sb->client_resize)
- return sb->client_resize->ui_resize(sb->data, w, h);
-
- return 0;
-}
-
sandbox_slave_t *
sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver, void *data)
{
@@ -364,12 +352,6 @@ sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver, v
goto fail;
}
- if(sb->desc->extension_data)
- {
- sb->idle_iface = sb->desc->extension_data(LV2_UI__idleInterface);
- sb->client_resize= sb->desc->extension_data(LV2_UI__resize);
- }
-
if(_sandbox_io_init(&sb->io, &sb->map, &sb->unmap, sb->socket_path, false))
{
fprintf(stderr, "_sandbox_io_init failed\n");
@@ -432,8 +414,8 @@ sandbox_slave_free(sandbox_slave_t *sb)
free(sb);
}
-int
-sandbox_slave_instantiate(sandbox_slave_t *sb, void *parent, void *widget)
+void *
+sandbox_slave_instantiate(sandbox_slave_t *sb, const LV2_Feature *parent_feature, void *widget)
{
LV2_Options_Option options [] = {
[0] = {
@@ -458,10 +440,6 @@ sandbox_slave_instantiate(sandbox_slave_t *sb, void *parent, void *widget)
.URI = LV2_URID__unmap,
.data = &sb->unmap
};
- const LV2_Feature parent_feature = {
- .URI = LV2_UI__parent,
- .data = parent
- };
const LV2_Feature log_feature = {
.URI = LV2_LOG__log,
.data = &sb->log
@@ -474,29 +452,24 @@ sandbox_slave_instantiate(sandbox_slave_t *sb, void *parent, void *widget)
.URI = LV2_UI__portSubscribe,
.data = &sb->port_subscribe
};
- const LV2_Feature idle_feature = {
- .URI = LV2_UI__idleInterface,
- .data = NULL
+ const LV2_Feature options_feature = {
+ .URI = LV2_OPTIONS__options,
+ .data = options
};
const LV2_Feature resize_feature = {
.URI = LV2_UI__resize,
.data = &sb->host_resize
};
- const LV2_Feature options_feature = {
- .URI = LV2_OPTIONS__options,
- .data = options
- };
const LV2_Feature *const features [] = {
&map_feature,
&unmap_feature,
- &parent_feature,
&log_feature,
&port_map_feature,
&port_subscribe_feature,
- &idle_feature,
&options_feature,
- sb->host_resize.ui_resize ? &resize_feature : NULL,
+ sb->host_resize.ui_resize ? &resize_feature : parent_feature,
+ sb->host_resize.ui_resize && parent_feature ? parent_feature : NULL,
NULL
};
@@ -507,9 +480,9 @@ sandbox_slave_instantiate(sandbox_slave_t *sb, void *parent, void *widget)
}
if(sb->handle)
- return 0; // success
+ return sb->handle; // success
- return -1;
+ return NULL;
}
void
@@ -528,13 +501,13 @@ sandbox_slave_flush(sandbox_slave_t *sb)
return false;
}
-int
-sandbox_slave_idle(sandbox_slave_t *sb)
+const void *
+sandbox_slave_extension_data(sandbox_slave_t *sb, const char *URI)
{
- if(sb && sb->idle_iface)
- return sb->idle_iface->idle(sb->handle);
+ if(sb && sb->desc && sb->desc->extension_data)
+ return sb->desc->extension_data(URI);
- return 0;
+ return NULL;
}
void
diff --git a/sandbox_ui.lv2/sandbox_slave.h b/sandbox_ui.lv2/sandbox_slave.h
index 321919a..dcd78bb 100644
--- a/sandbox_ui.lv2/sandbox_slave.h
+++ b/sandbox_ui.lv2/sandbox_slave.h
@@ -18,6 +18,8 @@
#ifndef _SANDBOX_SLAVE_H
#define _SANDBOX_SLAVE_H
+#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -43,8 +45,8 @@ sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver, v
void
sandbox_slave_free(sandbox_slave_t *sb);
-int
-sandbox_slave_instantiate(sandbox_slave_t *sb, void *parent, void *widget);
+void *
+sandbox_slave_instantiate(sandbox_slave_t *sb, const LV2_Feature *parent_feature, void *widget);
void
sandbox_slave_recv(sandbox_slave_t *sb);
@@ -52,8 +54,8 @@ sandbox_slave_recv(sandbox_slave_t *sb);
bool
sandbox_slave_flush(sandbox_slave_t *sb);
-int
-sandbox_slave_idle(sandbox_slave_t *sb);
+const void *
+sandbox_slave_extension_data(sandbox_slave_t *sb, const char *URI);
void
sandbox_slave_run(sandbox_slave_t *sb);