summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-27 01:45:38 +0000
committerDavid Robillard <d@drobilla.net>2008-11-27 01:45:38 +0000
commitca3bd4c24b7db71b774a560dc4089321d74fee4d (patch)
treee333db8312819e9077c8b81ffbbf4a101f2d32b9 /src
parent9b9a6c9e3eb8da7eb1decd963a6c2f0e69b57ed4 (diff)
downloadingen-ca3bd4c24b7db71b774a560dc4089321d74fee4d.tar.gz
ingen-ca3bd4c24b7db71b774a560dc4089321d74fee4d.tar.bz2
ingen-ca3bd4c24b7db71b774a560dc4089321d74fee4d.zip
Fix orphan etc. errors for 'ingen -egl' (fix ticket #201).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1784 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/client/ClientStore.cpp5
-rw-r--r--src/gui/App.cpp20
-rw-r--r--src/gui/App.hpp6
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/ConnectWindow.hpp8
-rw-r--r--src/gui/gui.cpp12
-rw-r--r--src/gui/gui.hpp3
-rw-r--r--src/ingen/main.cpp39
8 files changed, 63 insertions, 32 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index cf1109cf..36156db8 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -530,7 +530,7 @@ ClientStore::set_variable(const string& subject_path, const string& predicate, c
subject->set_variable(predicate, value);
} else {
add_variable_orphan(subject_path, predicate, value);
- cerr << "WARNING: variable for unknown object " << subject_path << endl;
+ cerr << "WARNING: variable '" << predicate << "' for unknown object " << subject_path << endl;
}
}
@@ -546,8 +546,7 @@ ClientStore::set_property(const string& subject_path, const string& predicate, c
if (obj)
obj->set_property(predicate, value);
else
- cerr << "WARNING: property for unknown object " << subject_path
- << ". Refresh!" << endl;
+ cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_path << endl;
} else {
if (subject_path.find(":") != string::npos
&& predicate == "rdf:type" && value.type() == Atom::URI) {
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 565a976e..4b6abc4a 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -62,6 +62,7 @@ namespace GUI {
class Port;
+Gtk::Main* App::_main = 0;
/// Singleton instance
App* App::_instance = 0;
@@ -95,10 +96,10 @@ App::~App()
}
void
-App::run(int argc, char** argv, Ingen::Shared::World* world)
+App::init(int argc, char** argv, Ingen::Shared::World* world)
{
Gnome::Canvas::init();
- Gtk::Main main(argc, argv);
+ _main = new Gtk::Main(argc, argv);
if (!_instance)
_instance = new App(world);
@@ -135,9 +136,20 @@ App::run(int argc, char** argv, Ingen::Shared::World* world)
Gtk::RC::parse_string(rc_style);
App::instance().connect_window()->start(world);
-
- main.run();
+ // Run main iterations here until we're attached to the engine
+ // (otherwise with 'ingen -egl' we'll get a bunch of notifications about load immediately
+ // before even knowing about the root patch or plugins)
+ while (!App::instance().connect_window()->attached())
+ _main->iteration();
+}
+
+
+void
+App::run()
+{
+ assert(_main);
+ _main->run();
cout << "Gtk exiting." << endl;
}
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index d3399f63..5cc5b930 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -111,7 +111,8 @@ public:
static inline App& instance() { assert(_instance); return *_instance; }
- static void run(int argc, char** argv, Ingen::Shared::World* world);
+ static void init(int argc, char** argv, Ingen::Shared::World* world);
+ static void run();
Ingen::Shared::World* world() { return _world; }
@@ -138,7 +139,8 @@ protected:
static void* icon_destroyed(void* data);
- static App* _instance;
+ static Gtk::Main* _main;
+ static App* _instance;
SharedPtr<Client::SigClientInterface> _client;
SharedPtr<Raul::Deletable> _handle;
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index c0dead39..4e65a618 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -60,6 +60,7 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::
, _mode(CONNECT_REMOTE)
, _ping_id(-1)
, _attached(false)
+ , _finished_connecting(false)
, _widgets_loaded(false)
, _connect_stage(0)
, _new_engine(NULL)
@@ -461,6 +462,7 @@ ConnectWindow::gtk_callback()
if (_widgets_loaded)
_progress_label->set_text("Connected to engine");
_connect_stage = 0; // set ourselves up for next time (if there is one)
+ _finished_connecting = true;
return false; // deregister this callback
}
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index 06283c70..d78bcd39 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -55,6 +55,8 @@ public:
void start(Ingen::Shared::World* world);
void on_response(int32_t id) { _attached = true; }
+ bool attached() const { return _finished_connecting; }
+
private:
enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL };
@@ -78,9 +80,9 @@ private:
Mode _mode;
int32_t _ping_id;
bool _attached;
-
- bool _widgets_loaded;
- int _connect_stage;
+ bool _finished_connecting;
+ bool _widgets_loaded;
+ int _connect_stage;
SharedPtr<Glib::Module> _engine_module;
SharedPtr<Glib::Module> _engine_jack_module;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 10af6d9b..984651f4 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -24,9 +24,17 @@ namespace Ingen {
namespace GUI {
-void run(int argc, char** argv, Ingen::Shared::World* world)
+void
+init(int argc, char** argv, Ingen::Shared::World* world)
{
- App::run(argc, argv, world);
+ App::init(argc, argv, world);
+}
+
+
+void
+run()
+{
+ App::run();
}
diff --git a/src/gui/gui.hpp b/src/gui/gui.hpp
index ab1be8ab..b6f12add 100644
--- a/src/gui/gui.hpp
+++ b/src/gui/gui.hpp
@@ -33,7 +33,8 @@ namespace GUI {
extern "C" {
- void run(int argc, char** argv, Ingen::Shared::World* world);
+ void init(int argc, char** argv, Ingen::Shared::World* world);
+ void run();
}
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 176bba29..3917f008 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -220,6 +220,24 @@ main(int argc, char** argv)
}
world->engine = engine_interface;
+
+ void (*gui_run)() = NULL;
+
+ /* Load GUI */
+ bool run_gui = false;
+ if (args.gui_given) {
+ gui_module = Ingen::Shared::load_module("ingen_gui");
+ void (*init)(int, char**, Ingen::Shared::World*);
+
+ bool found = gui_module->get_symbol("init", (void*&)init);
+ found = found && gui_module->get_symbol("run", (void*&)gui_run);
+ if (found) {
+ run_gui = true;
+ init(argc, argv, world);
+ } else {
+ cerr << "Unable to find hooks in GUI module, GUI not loaded." << endl;
+ }
+ }
/* Load a patch */
if (args.load_given && engine_interface) {
@@ -250,7 +268,6 @@ main(int argc, char** argv)
Glib::get_current_dir(), args.load_arg));
}
-
engine_interface->load_plugins();
parser->parse_document(world, engine_interface.get(), uri, engine_base, uri);
@@ -260,21 +277,9 @@ main(int argc, char** argv)
}
}
-
- /* Run GUI */
- bool ran_gui = false;
- if (args.gui_given) {
- gui_module = Ingen::Shared::load_module("ingen_gui");
- void (*run)(int, char**, Ingen::Shared::World*);
- bool found = gui_module->get_symbol("run", (void*&)run);
-
- if (found) {
- ran_gui = true;
- run(argc, argv, world);
- } else {
- cerr << "Unable to find GUI module, GUI not loaded." << endl;
- }
- }
+ /* Run GUI (if applicable) */
+ if (run_gui)
+ gui_run();
/* Run a script */
if (args.run_given) {
@@ -298,7 +303,7 @@ main(int argc, char** argv)
#endif
/* Listen to OSC and do our own main thing. */
- } else if (engine && !ran_gui) {
+ } else if (engine && !run_gui) {
signal(SIGINT, catch_int);
signal(SIGTERM, catch_int);
engine->main();