summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-14 21:49:20 -0400
committerDavid Robillard <d@drobilla.net>2016-10-14 21:49:20 -0400
commit883b9b94bae3e3ba1164d09ca398b2b1f856b35a (patch)
treeaff4461f64c920fc2c254e2bcd4fb6f9d99b5ba7 /src
parent843d59675dbb4baecbc09712e5c020dfcc5f09df (diff)
downloadingen-883b9b94bae3e3ba1164d09ca398b2b1f856b35a.tar.gz
ingen-883b9b94bae3e3ba1164d09ca398b2b1f856b35a.tar.bz2
ingen-883b9b94bae3e3ba1164d09ca398b2b1f856b35a.zip
Fix initial display of embedded GUIs
Diffstat (limited to 'src')
-rw-r--r--src/gui/NodeModule.cpp25
-rw-r--r--src/gui/NodeModule.hpp2
2 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index f368d15f..56fc0e42 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -57,6 +57,7 @@ NodeModule::NodeModule(GraphCanvas& canvas,
, _block(block)
, _gui_widget(NULL)
, _gui_window(NULL)
+ , _initialised(false)
{
block->signal_new_port().connect(
sigc::mem_fun(this, &NodeModule::new_port_view));
@@ -85,6 +86,15 @@ NodeModule::NodeModule(GraphCanvas& canvas,
for (const auto& p : block->properties()) {
property_changed(p.first, p.second);
}
+
+ if (_block->has_property(app().uris().ingen_uiEmbedded,
+ app().uris().forge.make(true))) {
+ // Schedule idle callback to embed GUI once ports arrive
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(*this, &NodeModule::idle_init), 25, G_PRIORITY_DEFAULT_IDLE);
+ } else {
+ _initialised = true;
+ }
}
NodeModule::~NodeModule()
@@ -94,6 +104,19 @@ NodeModule::~NodeModule()
}
bool
+NodeModule::idle_init()
+{
+ if (_block->ports().size() == 0) {
+ return true; // Need to embed GUI, but ports haven't shown up yet
+ }
+
+ // Ports have arrived, embed GUI and deregister this callback
+ embed_gui(true);
+ _initialised = true;
+ return false;
+}
+
+bool
NodeModule::show_menu(GdkEventButton* ev)
{
WidgetFactory::get_widget_derived("object_menu", _menu);
@@ -442,7 +465,7 @@ NodeModule::property_changed(const Raul::URI& key, const Atom& value)
} else if (value.type() == uris.forge.Bool) {
if (key == uris.ingen_polyphonic) {
set_stacked(value.get<int32_t>());
- } else if (key == uris.ingen_uiEmbedded) {
+ } else if (key == uris.ingen_uiEmbedded && _initialised) {
if (value.get<int32_t>() && !_gui_widget) {
embed_gui(true);
} else if (!value.get<int32_t>() && _gui_widget) {
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index 2d9a3333..86103a03 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -69,6 +69,7 @@ protected:
virtual bool on_double_click(GdkEventButton* ev);
+ bool idle_init();
bool on_event(GdkEvent* ev);
void on_embed_gui_toggled(bool embed);
@@ -94,6 +95,7 @@ protected:
SPtr<Client::PluginUI> _plugin_ui;
Gtk::Widget* _gui_widget;
Gtk::Window* _gui_window; ///< iff popped up
+ bool _initialised;
};
} // namespace GUI