diff options
author | David Robillard <d@drobilla.net> | 2008-11-27 01:45:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-27 01:45:38 +0000 |
commit | ca3bd4c24b7db71b774a560dc4089321d74fee4d (patch) | |
tree | e333db8312819e9077c8b81ffbbf4a101f2d32b9 /src/gui | |
parent | 9b9a6c9e3eb8da7eb1decd963a6c2f0e69b57ed4 (diff) | |
download | ingen-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/gui')
-rw-r--r-- | src/gui/App.cpp | 20 | ||||
-rw-r--r-- | src/gui/App.hpp | 6 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/ConnectWindow.hpp | 8 | ||||
-rw-r--r-- | src/gui/gui.cpp | 12 | ||||
-rw-r--r-- | src/gui/gui.hpp | 3 |
6 files changed, 39 insertions, 12 deletions
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(); } |