diff --git a/templates/lv2/data/manifest.ttl.in b/templates/lv2/data/manifest.ttl.in index 7ebeef5..3b4838b 100644 --- a/templates/lv2/data/manifest.ttl.in +++ b/templates/lv2/data/manifest.ttl.in @@ -125,6 +125,16 @@ {{=it.tibia.lv2.ttlURI(it.lv2.ui.uri)}} a ui:@UI_TYPE@ ; ui:binary <{{=it.product.bundleName}}@DLL_SUFFIX@> ; + lv2:extensionData ui:resize ; +{{?!it.product.ui.userResizable}} + lv2:optionalFeature ui:noUserResize ; # doesn't work as lv2:requiredFeature, don't ask me why +{{?!it.product.ui.selfResizable}} + lv2:optionalFeature ui:fixedSize ; +{{?}} +{{?}} +{{?it.product.ui.selfResizable}} + lv2:optionalFeature ui:resize ; +{{?}} lv2:requiredFeature ui:idleInterface ; lv2:extensionData ui:idleInterface . {{?}} diff --git a/templates/lv2/src/data.h b/templates/lv2/src/data.h index 158f1e7..2c49854 100644 --- a/templates/lv2/src/data.h +++ b/templates/lv2/src/data.h @@ -67,4 +67,5 @@ static uint32_t param_out_index[DATA_PRODUCT_CONTROL_OUTPUTS_N] = { {{?it.lv2.ui}} #define DATA_LV2_UI_URI "{{=it.tibia.CGetUTF8StringLiteral(it.tibia.lv2.expandURI(it.lv2.ui.uri))}}" +#define DATA_UI_USER_RESIZABLE {{=it.product.ui.userResizable ? 1 : 0}} {{?}} diff --git a/templates/lv2/src/lv2.c b/templates/lv2/src/lv2.c index f2c1fca..d23b010 100644 --- a/templates/lv2/src/lv2.c +++ b/templates/lv2/src/lv2.c @@ -308,6 +308,8 @@ static LV2UI_Handle ui_instantiate(const LV2UI_Descriptor * descriptor, const ch if (!strcmp(features[i]->URI, LV2_UI__parent)) { has_parent = 1; parent = features[i]->data; + } else if (!strcmp(features[i]->URI, LV2_UI__resize)) { + // TODO... } plugin_ui *instance = plugin_ui_create(has_parent, parent); @@ -332,10 +334,23 @@ static int ui_idle(LV2UI_Handle handle) { return 0; } +static int ui_resize(LV2UI_Feature_Handle handle, int width, int height) { +#if DATA_UI_USER_RESIZABLE + //TODO + //return plugin_ui_resize((plugin_ui *)handle, width, height); + return 0; +#else + return -1; +#endif +} + static const void * ui_extension_data(const char * uri) { static const LV2UI_Idle_Interface idle = { ui_idle }; + static const LV2UI_Resize resize = { NULL, ui_resize }; if (!strcmp(uri, LV2_UI__idleInterface)) return &idle; + else if (!strcmp(uri, LV2_UI__resize)) + return &resize; return NULL; } diff --git a/test/plugin.h b/test/plugin.h index ae5469b..f68c72a 100644 --- a/test/plugin.h +++ b/test/plugin.h @@ -151,14 +151,13 @@ static plugin_ui *plugin_ui_create(char has_parent, void *parent) { instance->world = puglNewWorld(PUGL_MODULE, 0); instance->view = puglNewView(instance->world); puglSetSizeHint(instance->view, PUGL_DEFAULT_SIZE, 600, 400); - puglSetViewHint(instance->view, PUGL_RESIZABLE, 0); + puglSetViewHint(instance->view, PUGL_RESIZABLE, PUGL_TRUE); puglSetBackend(instance->view, puglCairoBackend()); PuglRect frame = { 0, 0, 600, 400 }; puglSetFrame(instance->view, frame); puglSetEventFunc(instance->view, plugin_ui_on_event); - if (has_parent) { + if (has_parent) puglSetParentWindow(instance->view, (PuglNativeView)parent); - } if (puglRealize(instance->view)) { puglFreeView(instance->view); puglFreeWorld(instance->world); diff --git a/test/product.json b/test/product.json index 761c0af..e4a500b 100644 --- a/test/product.json +++ b/test/product.json @@ -125,6 +125,10 @@ "unit": "", "map": "linear" } - ] + ], + "ui": { + "userResizable": true, + "selfResizable": false + } } }