summaryrefslogtreecommitdiffstats
path: root/src/x11_in_gtk2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/x11_in_gtk2.c')
-rw-r--r--src/x11_in_gtk2.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c
index 372de22..99308e7 100644
--- a/src/x11_in_gtk2.c
+++ b/src/x11_in_gtk2.c
@@ -98,48 +98,33 @@ wrapper_wrap(SuilWrapper* wrapper,
static void
wrapper_free(SuilWrapper* wrapper)
{
- free(wrapper->features);
free(wrapper);
}
SUIL_API
SuilWrapper*
-suil_wrapper_new(SuilHost* host,
- const char* host_type_uri,
- const char* ui_type_uri,
- const LV2_Feature* const* features)
+suil_wrapper_new(SuilHost* host,
+ const char* host_type_uri,
+ const char* ui_type_uri,
+ LV2_Feature*** features,
+ unsigned n_features)
{
SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
- unsigned n_features = 0;
- for (; features[n_features]; ++n_features) {}
-
SuilX11Wrapper* const wrap = SUIL_X11_WRAPPER(
g_object_new(SUIL_TYPE_X11_WRAPPER, NULL));
- wrapper->impl = wrap;
-
- wrapper->features = (LV2_Feature**)malloc(
- sizeof(LV2_Feature*) * (n_features + 3));
- memcpy(wrapper->features, features, sizeof(LV2_Feature*) * n_features);
-
- LV2_Feature* parent_feature = (LV2_Feature*)malloc(sizeof(LV2_Feature));
- parent_feature->URI = NS_UI "parent";
- parent_feature->data = (void*)(intptr_t)gtk_plug_get_id(wrap->plug);
-
- wrapper->features[n_features] = parent_feature;
- wrapper->features[n_features + 1] = NULL;
- wrapper->features[n_features + 2] = NULL;
-
+ wrapper->impl = wrap;
wrapper->resize.handle = wrap;
wrapper->resize.ui_resize = wrapper_resize;
- LV2_Feature* resize_feature = (LV2_Feature*)malloc(sizeof(LV2_Feature));
- resize_feature->URI = LV2_UI__resize;
- resize_feature->data = &wrapper->resize;
- wrapper->features[n_features + 1] = resize_feature;
+ suil_add_feature(features, n_features++, LV2_UI__parent,
+ (void*)(intptr_t)gtk_plug_get_id(wrap->plug));
+
+ suil_add_feature(features, n_features++, LV2_UI__resize,
+ &wrapper->resize);
return wrapper;
}