diff options
author | David Robillard <d@drobilla.net> | 2018-01-21 20:52:32 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-22 00:20:19 +0100 |
commit | d9c5d89d230b204a90cca4dee4165ba6ebdf00fd (patch) | |
tree | bfef33474927a6c22f723fcc849d8df801f618e9 /src/gui/App.cpp | |
parent | 7150b9bc10511e17abdd6e528fd1317522f64eae (diff) | |
download | ingen-d9c5d89d230b204a90cca4dee4165ba6ebdf00fd.tar.gz ingen-d9c5d89d230b204a90cca4dee4165ba6ebdf00fd.tar.bz2 ingen-d9c5d89d230b204a90cca4dee4165ba6ebdf00fd.zip |
Only enqueue messages when the engine is remote
When the engine is local, messages are emitted in the Gtk thread and applied
immediately. This should make the GUI more responsive.
Diffstat (limited to 'src/gui/App.cpp')
-rw-r--r-- | src/gui/App.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index a8128d8d..de587a7d 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -28,6 +28,7 @@ #include "ingen/EngineBase.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" +#include "ingen/QueuedInterface.hpp" #include "ingen/StreamWriter.hpp" #include "ingen/World.hpp" #include "ingen/client/ClientStore.hpp" @@ -157,7 +158,7 @@ App::run() } void -App::attach(SPtr<SigClientInterface> client) +App::attach(SPtr<Ingen::Interface> client) { assert(!_client); assert(!_store); @@ -168,7 +169,7 @@ App::attach(SPtr<SigClientInterface> client) } _client = client; - _store = SPtr<ClientStore>(new ClientStore(_world->uris(), _world->log(), client)); + _store = SPtr<ClientStore>(new ClientStore(_world->uris(), _world->log(), sig_client())); _loader = SPtr<ThreadedLoader>(new ThreadedLoader(*this, _world->interface())); if (!_world->store()) { _world->set_store(_store); @@ -181,12 +182,12 @@ App::attach(SPtr<SigClientInterface> client) stderr, ColorContext::Color::CYAN)); - client->signal_message().connect( + sig_client()->signal_message().connect( sigc::mem_fun(*_dumper.get(), &StreamWriter::message)); } _graph_tree_window->init(*this, *_store); - _client->signal_message().connect(sigc::mem_fun(this, &App::message)); + sig_client()->signal_message().connect(sigc::mem_fun(this, &App::message)); } void @@ -212,6 +213,16 @@ App::request_plugins_if_necessary() } } +SPtr<SigClientInterface> +App::sig_client() +{ + SPtr<QueuedInterface> qi = dynamic_ptr_cast<QueuedInterface>(_client); + if (qi) { + return dynamic_ptr_cast<SigClientInterface>(qi->sink()); + } + return dynamic_ptr_cast<SigClientInterface>(_client); +} + SPtr<Serialiser> App::serialiser() { @@ -264,7 +275,7 @@ App::set_property(const URI& subject, went as planned here and fire the signal ourselves as if the server feedback came back immediately. */ if (key != uris().ingen_activity) { - _client->signal_message().emit(SetProperty{0, subject, key, value, ctx}); + sig_client()->signal_message().emit(SetProperty{0, subject, key, value, ctx}); } } @@ -365,8 +376,6 @@ App::activity_port_destroyed(Port* port) if (i != _activity_ports.end()) { _activity_ports.erase(i); } - - return; } bool @@ -412,16 +421,16 @@ App::gtk_main_iteration() _messages_window->flush(); } + _enable_signal = false; if (_world->engine()) { if (!_world->engine()->main_iteration()) { Gtk::Main::quit(); return false; } } else { - _enable_signal = false; - _client->emit_signals(); - _enable_signal = true; + dynamic_ptr_cast<QueuedInterface>(_client)->emit(); } + _enable_signal = true; return true; } |