Handle click commands in eventloop

This commit is contained in:
patrick96 2021-09-11 12:19:00 +02:00 committed by Patrick Ziegler
parent 88cd525dc8
commit c89fc7f73b
3 changed files with 29 additions and 20 deletions
include/components

View file

@ -1,6 +1,7 @@
#pragma once
#include <moodycamel/blockingconcurrentqueue.h>
#include <uv.h>
#include <thread>
@ -51,7 +52,7 @@ class controller
bool run(bool writeback, string snapshot_dst);
bool enqueue(event&& evt);
bool enqueue(string&& input_data);
bool trigger_action(string&& input_data);
void stop(bool reload);
@ -60,6 +61,7 @@ class controller
void conn_cb(int status, int events);
void ipc_cb(string buf);
void confwatch_handler(const char* fname, int events, int status);
void notifier_handler();
protected:
void read_events();
@ -95,6 +97,14 @@ class controller
std::unique_ptr<eventloop> eloop;
/**
* \brief Async handle to notify the eventloop
*
* This handle is used to notify the eventloop of changes which are not otherwise covered by other handles.
* E.g. click actions.
*/
std::unique_ptr<uv_async_t> m_notifier{nullptr};
/**
* \brief State flag
*/