Port improved event queue from downstream fork
#8.557 aberto em 1 de mai. de 2025
Métricas do repositório
- Stars
- (25.788 estrelas)
- Métricas de merge de PR
- (Mesclagem média 5d 20h) (35 fundiu PRs em 30d)
Description
Feature Request
In a downstream fork of Deskflow called Input Leap, the events queue was improved by @p12tic. The improved event queue uses enum class (see downstream EventTypes.h) instead of int data1 for event types. This makes it easier to work with and easier to add new events.
We should port these changes upstream to Deskflow so that the event queue is nicer to work with.
Edit: We should also port the other improvements:
fixes #8557
Seems that @p12tic went a bit further than changing the ints to enums. Arguably, this goes beyond scope of #8557 in its current wording, but we should also use
std::function, lambdas, etc instead ofTMethodEventJob. Pretty sure he also madeEventstruct internal to the event queue, but my memory is fuzzy.Deskflow:
Input Leap:
m_events->add_handler(EventType::STREAM_INPUT_READY, m_stream->get_event_target(), [this](const auto& e){ handle_data(); });
[!NOTE] Our code style is different upstream; we do not use
snake_casefor functions orSCREAMING_SNAKE_CASEfor enum named values. Instead, we usecamelCasefor function names andPascalCasefor enum named values.
Footnotes
-
Each time we register an event, it increments a "type" integer counter: https://github.com/deskflow/deskflow/blob/35f0e9e6e44c940a41df0438d5eaacf95ec4fb2d/src/lib/base/EventQueue.cpp#L120 ↩