summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Drivers.cpp2
-rw-r--r--src/Event.hpp5
-rw-r--r--src/Patchage.cpp2
-rw-r--r--src/event_to_string.cpp2
-rw-r--r--src/handle_event.cpp2
5 files changed, 11 insertions, 2 deletions
diff --git a/src/Drivers.cpp b/src/Drivers.cpp
index 94ab6f9..4f57f34 100644
--- a/src/Drivers.cpp
+++ b/src/Drivers.cpp
@@ -41,6 +41,8 @@ Drivers::Drivers(ILog& log, Driver::EventSink emit_event)
void
Drivers::refresh()
{
+ _emit_event(event::Cleared{});
+
if (_alsa_driver) {
_alsa_driver->refresh(_emit_event);
}
diff --git a/src/Event.hpp b/src/Event.hpp
index 378f35eb..233d1a1 100644
--- a/src/Event.hpp
+++ b/src/Event.hpp
@@ -28,6 +28,8 @@
namespace patchage {
namespace event {
+struct Cleared {};
+
struct ClientCreated {
ClientID id;
ClientInfo info;
@@ -67,7 +69,8 @@ struct PortsDisconnected {
} // namespace event
/// An event from drivers that represents a change to the system
-using Event = boost::variant<event::ClientCreated,
+using Event = boost::variant<event::Cleared,
+ event::ClientCreated,
event::ClientDestroyed,
event::DriverAttached,
event::DriverDetached,
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 5045691..7387b36 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -473,7 +473,7 @@ Patchage::refresh()
};
if (_canvas) {
- _canvas->clear();
+ sink(event::Cleared{});
if (_drivers.jack()) {
_drivers.jack()->refresh(sink);
diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp
index 4b23875..c8a6c42 100644
--- a/src/event_to_string.cpp
+++ b/src/event_to_string.cpp
@@ -56,6 +56,8 @@ struct EventPrinter {
PATCHAGE_UNREACHABLE();
}
+ std::string operator()(const event::Cleared&) { return "Cleared"; }
+
std::string operator()(const event::DriverAttached& event)
{
return fmt::format("Attached to {}", (*this)(event.type));
diff --git a/src/handle_event.cpp b/src/handle_event.cpp
index fa11ec3..65f4705 100644
--- a/src/handle_event.cpp
+++ b/src/handle_event.cpp
@@ -48,6 +48,8 @@ public:
: _patchage{patchage}
{}
+ void operator()(const event::Cleared&) { _patchage.canvas()->clear(); }
+
void operator()(const event::DriverAttached& event)
{
_patchage.driver_attached(event.type);