diff options
author | David Robillard <d@drobilla.net> | 2012-04-11 04:48:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-04-11 04:48:38 +0000 |
commit | f6263cffe3289c8d8c1566195fbf0f4d14ffdc27 (patch) | |
tree | 96c3ec5a8a28207b335d018e0468b0e8b3e7b0fc /src/x11_in_gtk2.c | |
parent | 1b3485bcd0fa09e44aff5457db1d399b611a7151 (diff) | |
download | suil-f6263cffe3289c8d8c1566195fbf0f4d14ffdc27.tar.gz suil-f6263cffe3289c8d8c1566195fbf0f4d14ffdc27.tar.bz2 suil-f6263cffe3289c8d8c1566195fbf0f4d14ffdc27.zip |
Add suil_host_set_touch_func.
Saner feature array manipulation.
Implement port index and subscribe/unsubscribe functions via new UI features.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4160 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/x11_in_gtk2.c')
-rw-r--r-- | src/x11_in_gtk2.c | 37 |
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; } |