aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-07-10 12:55:45 +0200
committerDavid Robillard <d@drobilla.net>2016-08-31 23:51:31 -0400
commit0a0037a11e453ad4de7a15c1031670ceb5667db2 (patch)
treef6642a5e7519b4b188724d57eeb1fcaee1562a76 /src
parent7e3af735cea4fdefcd4483b1c92b2762ad6672dc (diff)
downloadjalv-0a0037a11e453ad4de7a15c1031670ceb5667db2.tar.gz
jalv-0a0037a11e453ad4de7a15c1031670ceb5667db2.tar.bz2
jalv-0a0037a11e453ad4de7a15c1031670ceb5667db2.zip
Discover presence of UI before jack_activate
jalv.has_ui should be set before jack_activate. If not, patch:Get message may be without effect and parameter replies never be sent from within jack process callback, as the latter may run before the corresponding UI logic (e.g. with jalv.has_ui still being false).
Diffstat (limited to 'src')
-rw-r--r--src/jalv.c3
-rw-r--r--src/jalv_console.c8
-rw-r--r--src/jalv_gtk.c7
-rw-r--r--src/jalv_gtkmm2.cpp7
-rw-r--r--src/jalv_internal.h3
-rw-r--r--src/jalv_qt.cpp7
6 files changed, 30 insertions, 5 deletions
diff --git a/src/jalv.c b/src/jalv.c
index c4eb073..02fecf3 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1410,6 +1410,9 @@ main(int argc, char** argv)
/* Activate plugin */
lilv_instance_activate(jalv.instance);
+ /* Discover UI */
+ jalv.has_ui = jalv_discover_ui(&jalv);
+
/* Activate Jack */
jack_activate(jalv.jack_client);
jalv.sample_rate = jack_get_sample_rate(jalv.jack_client);
diff --git a/src/jalv_console.c b/src/jalv_console.c
index e72ff7a..d3f3389 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -157,11 +157,15 @@ jalv_process_command(Jalv* jalv, const char* cmd)
}
}
+bool
+jalv_discover_ui(Jalv* jalv)
+{
+ return jalv->opts.show_ui;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
- jalv->has_ui = jalv->opts.show_ui;
-
const LV2UI_Idle_Interface* idle_iface = NULL;
const LV2UI_Show_Interface* show_iface = NULL;
if (jalv->ui && jalv->opts.show_ui) {
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index a2e9680..b6bd9e4 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -1262,12 +1262,17 @@ build_menu(Jalv* jalv, GtkWidget* window, GtkWidget* vbox)
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0);
}
+bool
+jalv_discover_ui(Jalv* jalv)
+{
+ return TRUE;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
jalv->window = window;
- jalv->has_ui = TRUE;
g_signal_connect(window, "destroy",
G_CALLBACK(on_window_destroy), jalv);
diff --git a/src/jalv_gtkmm2.cpp b/src/jalv_gtkmm2.cpp
index 30ccb7b..93389e7 100644
--- a/src/jalv_gtkmm2.cpp
+++ b/src/jalv_gtkmm2.cpp
@@ -57,11 +57,16 @@ jalv_ui_port_event(Jalv* jalv,
{
}
+bool
+jalv_discover_ui(Jalv* jalv)
+{
+ return true;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
Gtk::Window* window = new Gtk::Window();
- jalv->has_ui = true;
if (jalv->ui) {
jalv_ui_instantiate(jalv, jalv_native_ui_type(jalv), NULL);
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index bda4016..82fef4a 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -316,6 +316,9 @@ jalv_port_by_symbol(Jalv* jalv, const char* sym);
const char*
jalv_native_ui_type(Jalv* jalv);
+bool
+jalv_discover_ui(Jalv* jalv);
+
int
jalv_open_ui(Jalv* jalv);
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index 003b548..178db16 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -673,6 +673,12 @@ build_control_widget(Jalv* jalv)
return grid;
}
+bool
+jalv_discover_ui(Jalv* jalv)
+{
+ return true;
+}
+
int
jalv_open_ui(Jalv* jalv)
{
@@ -685,7 +691,6 @@ jalv_open_ui(Jalv* jalv)
quit_action->setShortcuts(QKeySequence::Quit);
quit_action->setStatusTip("Quit Jalv");
file_menu->addAction(quit_action);
- jalv->has_ui = true;
jalv_load_presets(jalv, add_preset_to_menu, presets_menu);