refactor: Deprecate throttle-input-for setting (#2117)

If an input is enqueued as a response to an input, the new input will be
swallowed because it will likely be enqueued less than 30ms after the
original event.
This is not something that is an issue right now but it is required to
finish #1907 where, in order to close the menu after a click, the menu
module gets an exec action that closes the menu and adds a command to
the event queue.

The setting also isn't too useful since it will just break polybar input
handling if inputs arrive too fast instead of (possibly) slowing down
the bar.
This commit is contained in:
Patrick Ziegler 2020-05-30 22:45:36 +02:00 committed by GitHub
parent 5cd7295a41
commit ba0a156bbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -131,16 +131,6 @@ class controller
*/
std::chrono::milliseconds m_swallow_update{10};
/**
* \brief Time to throttle input events
*/
std::chrono::milliseconds m_swallow_input{30};
/**
* \brief Time of last handled input event
*/
std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> m_lastinput;
/**
* \brief Input data
*/

View File

@ -58,7 +58,11 @@ controller::controller(connection& conn, signal_emitter& emitter, const logger&
, m_bar(forward<decltype(bar)>(bar))
, m_ipc(forward<decltype(ipc)>(ipc))
, m_confwatch(forward<decltype(confwatch)>(confwatch)) {
m_swallow_input = m_conf.get("settings", "throttle-input-for", m_swallow_input);
if (m_conf.has("settings", "throttle-input-for")) {
m_log.warn("The config parameter 'settings.throttle-input-for' is deprecated, it will be removed in the future. Please remove it from your config");
}
m_swallow_limit = m_conf.deprecated("settings", "eventqueue-swallow", "throttle-output", m_swallow_limit);
m_swallow_update = m_conf.deprecated("settings", "eventqueue-swallow-time", "throttle-output-for", m_swallow_update);
@ -201,8 +205,6 @@ bool controller::enqueue(event&& evt) {
bool controller::enqueue(string&& input_data) {
if (!m_inputdata.empty()) {
m_log.trace("controller: Swallowing input event (pending data)");
} else if (chrono::system_clock::now() - m_swallow_input < m_lastinput) {
m_log.trace("controller: Swallowing input event (throttled)");
} else {
m_inputdata = forward<string>(input_data);
return enqueue(make_input_evt());
@ -390,7 +392,6 @@ void controller::process_eventqueue() {
void controller::process_inputdata() {
if (!m_inputdata.empty()) {
string cmd = m_inputdata;
m_lastinput = chrono::time_point_cast<decltype(m_swallow_input)>(chrono::system_clock::now());
m_inputdata.clear();
for (auto&& handler : m_inputhandlers) {