Commit 6d6cab74 authored by Hanspeter Portner's avatar Hanspeter Portner

Merge commit '763fa6e8'

parents ba37f823 763fa6e8
......@@ -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");
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment