Eventloop cleanup (#2577)

* eventloop: Use eventloop namespace in cpp files

* changelog: Add missing deprecated hook message

* Make eventloop and ipc classes non-copyable and non-movable

* Remove functional.hpp

* eventloop: Don't close handles in error cases

Client should be responsible for closing handles.

* eventloop: Address invalidation of handle references
This commit is contained in:
Patrick Ziegler
2022-01-22 22:00:26 +01:00
committed by GitHub
parent 3356188056
commit c2f087225c
17 changed files with 86 additions and 80 deletions

View File

@ -32,11 +32,12 @@
POLYBAR_NS
using namespace signals::ui;
using namespace eventloop;
/**
* Create instance
*/
bar::make_type bar::make(eventloop::eventloop& loop, bool only_initialize_values) {
bar::make_type bar::make(loop& loop, bool only_initialize_values) {
auto action_ctxt = make_unique<tags::action_context>();
// clang-format off
@ -59,9 +60,9 @@ bar::make_type bar::make(eventloop::eventloop& loop, bool only_initialize_values
*
* TODO: Break out all tray handling
*/
bar::bar(connection& conn, signal_emitter& emitter, const config& config, const logger& logger,
eventloop::eventloop& loop, unique_ptr<screen>&& screen, unique_ptr<tray_manager>&& tray_manager,
unique_ptr<tags::dispatch>&& dispatch, unique_ptr<tags::action_context>&& action_ctxt, bool only_initialize_values)
bar::bar(connection& conn, signal_emitter& emitter, const config& config, const logger& logger, loop& loop,
unique_ptr<screen>&& screen, unique_ptr<tray_manager>&& tray_manager, unique_ptr<tags::dispatch>&& dispatch,
unique_ptr<tags::action_context>&& action_ctxt, bool only_initialize_values)
: m_connection(conn)
, m_sig(emitter)
, m_conf(config)
@ -737,7 +738,7 @@ void bar::handle(const evt::button_press& evt) {
* the configured interval and if in that time another click arrives, we
* need to trigger a double click.
*/
const auto check_double = [this](eventloop::TimerHandle& handle, mousebtn btn, int pos) {
const auto check_double = [this](TimerHandle& handle, mousebtn btn, int pos) {
if (!handle.is_active()) {
handle.start(m_opts.double_click_interval, 0, [=]() { trigger_click(btn, pos); });
} else {