From 924775a79c07a4f5798fcefddb523b189e473080 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 22:23:54 +0100 Subject: 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. --- src/Patchage.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Patchage.hpp') 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 +#include +#include #include #include @@ -116,6 +119,9 @@ protected: Gtk::TreeModelColumn label; }; + void on_driver_event(const PatchageEvent& event); + void process_events(); + void connect_widgets(); void on_arrange(); @@ -154,6 +160,9 @@ protected: Glib::RefPtr _xml; + std::mutex _events_mutex; + std::queue _driver_events; + #ifdef HAVE_ALSA AlsaDriver* _alsa_driver; void menu_alsa_connect(); -- cgit v1.2.1