From 760a7fda81e9a0b046c5ccc58a907f225d6ddc69 Mon Sep 17 00:00:00 2001 From: Rui Nuno Capela Date: Mon, 28 Oct 2019 16:00:48 +0100 Subject: [PATCH] Prefer X11 Plugin UIs Let LV2 Plugin UI support (via SUIL) prefer and select a X11 UI whenever multiple UI type options are provided by LV2 plugins (eg. Vee-One's do present several but their native Qt5UI should never be raised by Ardour, on any chance:)). Signed-off-by: Rui Nuno Capela 0) { #ifdef HAVE_SUIL // Look for embeddable UI - LILV_FOREACH(uis, u, uis) { - const LilvUI* this_ui = lilv_uis_get(uis, u); - const LilvNode* this_ui_type = NULL; - if (lilv_ui_is_supported(this_ui, - suil_ui_supported, - _world.ui_GtkUI, - &this_ui_type)) { - // TODO: Multiple UI support - _impl->ui = this_ui; - _impl->ui_type = this_ui_type; + // TODO: Multiple UI support + const LilvUI* this_ui = NULL; + const LilvNode* this_ui_type = NULL; + // Always prefer X11 UIs... + LILV_FOREACH(uis, i, uis) { + const LilvUI* ui = lilv_uis_get(uis, i); + if (lilv_ui_is_a(ui, _world.ui_X11UI)) { + this_ui = ui; + this_ui_type = _world.ui_X11UI; break; } } + // then anything else... + if (this_ui_type == NULL) { + LILV_FOREACH(uis, i, uis) { + const LilvUI* ui = lilv_uis_get(uis, i); + if (lilv_ui_is_supported(ui, + suil_ui_supported, + _world.ui_GtkUI, + &this_ui_type)) { + this_ui = ui; + break; + } + } + } + // Found one that is supported by SUIL?... + if (this_ui_type != NULL) { + _impl->ui = this_ui; + _impl->ui_type = this_ui_type; + } #else // Look for Gtk native UI LILV_FOREACH(uis, i, uis) { @@ -3266,6 +3284,7 @@ LV2World::LV2World() time_Position = lilv_new_uri(world, LV2_TIME__Position); time_beatsPerMin = lilv_new_uri(world, LV2_TIME__beatsPerMinute); ui_GtkUI = lilv_new_uri(world, LV2_UI__GtkUI); + ui_X11UI = lilv_new_uri(world, LV2_UI__X11UI); ui_external = lilv_new_uri(world, "http://lv2plug.in/ns/extensions/ui#external"); ui_externalkx = lilv_new_uri(world, "http://kxstudio.sf.net/ns/lv2ext/external-ui#Widget"); units_unit = lilv_new_uri(world, LV2_UNITS__unit); @@ -3318,6 +3337,7 @@ LV2World::~LV2World() lilv_node_free(units_render); lilv_node_free(ui_externalkx); lilv_node_free(ui_external); + lilv_node_free(ui_X11UI); lilv_node_free(ui_GtkUI); lilv_node_free(time_beatsPerMin); lilv_node_free(time_Position);