deskflow/deskflow

Port improved event queue from downstream fork

Aberta

#8.557 aberto em 1 de mai. de 2025

 (4 comentários) (0 reação) (0 responsável)C++ (4.581 forks)batch import
good first issue

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 of TMethodEventJob. Pretty sure he also made Event struct internal to the event queue, but my memory is fuzzy.

Deskflow:

https://github.com/deskflow/deskflow/blob/20dcc2ea9d71aa3ef836d7b1173726862f4e2983/src/lib/client/ServerProxy.cpp#L58-L61

Input Leap:

    m_events->add_handler(EventType::STREAM_INPUT_READY, m_stream->get_event_target(),
                          [this](const auto& e){ handle_data(); });

https://github.com/input-leap/input-leap/blob/3b4a6c9f494223a2b74b43a97cc80bb181e3a3d4/src/lib/client/ServerProxy.cpp#L64-L65

[!NOTE] Our code style is different upstream; we do not use snake_case for functions or SCREAMING_SNAKE_CASE for enum named values. Instead, we use camelCase for function names and PascalCase for enum named values.

Footnotes

  1. 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

Guia do colaborador