diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 22:23:54 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 22:49:10 +0100 |
commit | 924775a79c07a4f5798fcefddb523b189e473080 (patch) | |
tree | 6a201df93b109d10cb5c5cab018ee89448c00e00 /src/Patchage.hpp | |
parent | 5128bfab7ddb9504abf17375e910e5bc94af291e (diff) | |
download | patchage-924775a79c07a4f5798fcefddb523b189e473080.tar.gz patchage-924775a79c07a4f5798fcefddb523b189e473080.tar.bz2 patchage-924775a79c07a4f5798fcefddb523b189e473080.zip |
Abstract out sending of events
This removes the details of how events are handled from drivers, so the owner
can set them up to do anything. For example, a driver could be run in the GUI
thread and have its events simply dispatched immediately, but here everything
is enqueued to the same queue which is drained later for simplicity.
Diffstat (limited to 'src/Patchage.hpp')
-rw-r--r-- | src/Patchage.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Patchage.hpp b/src/Patchage.hpp index daae7c7..b358f34 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -42,11 +42,14 @@ #include "ILog.hpp" #include "Legend.hpp" #include "Metadata.hpp" +#include "PatchageEvent.hpp" #include "TextViewLog.hpp" #include "Widget.hpp" #include "patchage_config.h" #include <memory> +#include <mutex> +#include <queue> #include <set> #include <string> @@ -116,6 +119,9 @@ protected: Gtk::TreeModelColumn<Glib::ustring> label; }; + void on_driver_event(const PatchageEvent& event); + void process_events(); + void connect_widgets(); void on_arrange(); @@ -154,6 +160,9 @@ protected: Glib::RefPtr<Gtk::Builder> _xml; + std::mutex _events_mutex; + std::queue<PatchageEvent> _driver_events; + #ifdef HAVE_ALSA AlsaDriver* _alsa_driver; void menu_alsa_connect(); |