summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-01-31 23:58:48 +0000
committerDavid Robillard <d@drobilla.net>2014-01-31 23:58:48 +0000
commitcc3359a6bea22c3d4584a5d57403e7d568e16fe7 (patch)
treeb0e57cf8c8227da9ef4be982db062b32f3a0cbdc /src/server/events
parenta659a13c531e991851e013db3d4223bf16a343b8 (diff)
downloadingen-cc3359a6bea22c3d4584a5d57403e7d568e16fe7.tar.gz
ingen-cc3359a6bea22c3d4584a5d57403e7d568e16fe7.tar.bz2
ingen-cc3359a6bea22c3d4584a5d57403e7d568e16fe7.zip
Subscribe to ports before instantiating plugin UIs (fix #954).
Respond to put/set/patch with the same type of event (not set=>delta). Don't feed back changes to originating client. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5326 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Delta.cpp23
-rw-r--r--src/server/events/Delta.hpp10
2 files changed, 25 insertions, 8 deletions
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 90baaa52..6fd14fd5 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -48,7 +48,7 @@ Delta::Delta(Engine& engine,
SPtr<Interface> client,
int32_t id,
SampleCount timestamp,
- bool create,
+ Type type,
Resource::Graph context,
const Raul::URI& subject,
const Properties& properties,
@@ -62,7 +62,7 @@ Delta::Delta(Engine& engine,
, _graph(NULL)
, _compiled_graph(NULL)
, _context(context)
- , _create(create)
+ , _type(type)
, _poly_lock(engine.store()->lock(), Glib::NOT_LOCK)
{
if (context != Resource::Graph::DEFAULT) {
@@ -113,7 +113,7 @@ Delta::pre_process()
? static_cast<Ingen::Resource*>(_engine.store()->get(Node::uri_to_path(_subject)))
: static_cast<Ingen::Resource*>(_engine.block_factory()->plugin(_subject));
- if (!_object && !is_client && (!is_graph_object || !_create)) {
+ if (!_object && !is_client && (!is_graph_object || _type != Type::PUT)) {
return Event::pre_process_done(Status::NOT_FOUND, _subject);
}
@@ -163,7 +163,7 @@ Delta::pre_process()
}
// Remove all added properties if this is a put
- if (_create && _object) {
+ if (_type == Type::PUT && _object) {
for (const auto& p : _properties) {
_object->remove_property(p.first, p.second);
}
@@ -381,11 +381,22 @@ Delta::post_process()
_create_event->post_process();
} else {
respond();
- if (_create) {
+ _engine.broadcaster()->set_ignore_client(_request_client);
+ switch (_type) {
+ case Type::SET:
+ _engine.broadcaster()->set_property(
+ _subject,
+ (*_properties.begin()).first,
+ (*_properties.begin()).second);
+ break;
+ case Type::PUT:
_engine.broadcaster()->put(_subject, _properties, _context);
- } else {
+ break;
+ case Type::PATCH:
_engine.broadcaster()->delta(_subject, _remove, _properties);
+ break;
}
+ _engine.broadcaster()->clear_ignore_client();
}
} else {
respond();
diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp
index 451b8e62..a8e8ed0b 100644
--- a/src/server/events/Delta.hpp
+++ b/src/server/events/Delta.hpp
@@ -69,11 +69,17 @@ class SetPortValue;
class Delta : public Event
{
public:
+ enum class Type {
+ SET,
+ PUT,
+ PATCH
+ };
+
Delta(Engine& engine,
SPtr<Interface> client,
int32_t id,
SampleCount timestamp,
- bool create,
+ Type type,
Resource::Graph context,
const Raul::URI& subject,
const Resource::Properties& properties,
@@ -109,7 +115,7 @@ private:
CompiledGraph* _compiled_graph;
Resource::Graph _context;
ControlBindings::Key _binding;
- bool _create;
+ Type _type;
SPtr<ControlBindings::Bindings> _old_bindings;