From f6263cffe3289c8d8c1566195fbf0f4d14ffdc27 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Apr 2012 04:48:38 +0000 Subject: 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 --- src/x11_in_qt4.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'src/x11_in_qt4.cpp') diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp index ced3dcd..d5ae534 100644 --- a/src/x11_in_qt4.cpp +++ b/src/x11_in_qt4.cpp @@ -46,40 +46,27 @@ wrapper_resize(LV2UI_Feature_Handle handle, int width, int height) 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 = (SuilWrapperFreeFunc)free; - unsigned n_features = 0; - for (; features[n_features]; ++n_features) {} - QX11EmbedWidget* const ew = new QX11EmbedWidget(); - wrapper->impl = ew; - - 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)ew->winId(); - - wrapper->features[n_features] = parent_feature; - wrapper->features[n_features + 1] = NULL; - wrapper->features[n_features + 2] = NULL; + wrapper->impl = ew; wrapper->resize.handle = ew; 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)ew->winId()); + + suil_add_feature(features, n_features++, LV2_UI__resize, + &wrapper->resize); return wrapper; } -- cgit v1.2.1