From dd4088910e1dadba7594ee3b452d2b9e97341147 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 12 Sep 2021 22:48:27 +0200
Subject: [PATCH] Deprecate throttle-output and throttle-output-for
The eventloop no longer uses them. libuv will coalesces multiple
uv_async_send if they happen one after another and this also leads to
coalescing of updates.
---
CHANGELOG.md | 8 +++++++-
include/components/config.hpp | 2 ++
src/components/config.cpp | 6 ++++++
src/components/controller.cpp | 14 +++++---------
src/components/eventloop.cpp | 2 ++
5 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e61388b..c050b135 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,8 +51,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
repository.
- The `POLYBAR_FLAGS` cmake variable can be used to pass extra C++ compiler flags.
+### Deprecated
+- `[settings]`: `throttle-output` and `throttle-output-for` have been removed.
+ The new event loop already does a similar thing where it coalesces update
+ triggers if they happen directly after one another, leading to only a single
+ bar update.
+
### Added
-- `internal/memory`: New tokens `%used%`, `%free%`, `%total%`, `%swap_total%`,
+- `internal/memory`: New tokens `%used%`, `%free%`, `%total%`, `%swap_total%`,
`%swap_free%`, and `%swap_used%` that automatically switch between MiB and GiB
when below or above 1GiB.
([`2472`](https://github.com/polybar/polybar/issues/2472))
diff --git a/include/components/config.hpp b/include/components/config.hpp
index 77447b46..b052f567 100644
--- a/include/components/config.hpp
+++ b/include/components/config.hpp
@@ -182,6 +182,8 @@ class config {
return default_value;
}
+ void ignore_key(const string& section, const string& key) const;
+
/**
* Attempt to load value using the deprecated key name. If successful show a
* warning message. If it fails load the value using the new key and given
diff --git a/src/components/config.cpp b/src/components/config.cpp
index 5be2c223..49657356 100644
--- a/src/components/config.cpp
+++ b/src/components/config.cpp
@@ -56,6 +56,12 @@ void config::set_included(file_list included) {
m_included = move(included);
}
+void config::ignore_key(const string& section, const string& key) const {
+ if (has(section, key)) {
+ m_log.warn("The config parameter '%s.%s' is deprecated, it will be removed in the future. Please remove it from your config", section, key);
+ }
+}
+
/**
* Print a deprecation warning if the given parameter is set
*/
diff --git a/src/components/controller.cpp b/src/components/controller.cpp
index a19cbb5e..29fd232c 100644
--- a/src/components/controller.cpp
+++ b/src/components/controller.cpp
@@ -47,15 +47,11 @@ controller::controller(connection& conn, signal_emitter& emitter, const logger&
, m_conf(config)
, m_bar(forward(bar))
, m_ipc(forward(ipc)) {
- 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");
- }
-
- // TODO deprecate both
- m_conf.deprecated("settings", "eventqueue-swallow", "throttle-output", 0);
- m_conf.deprecated("settings", "eventqueue-swallow-time", "throttle-output-for", 0);
+ m_conf.ignore_key("settings", "throttle-input-for");
+ m_conf.ignore_key("settings", "throttle-output");
+ m_conf.ignore_key("settings", "throttle-output-for");
+ m_conf.ignore_key("settings", "eventqueue-swallow");
+ m_conf.ignore_key("settings", "eventqueue-swallow-time");
m_log.trace("controller: Setup user-defined modules");
size_t created_modules{0};
diff --git a/src/components/eventloop.cpp b/src/components/eventloop.cpp
index 7817a221..6003aa76 100644
--- a/src/components/eventloop.cpp
+++ b/src/components/eventloop.cpp
@@ -1,5 +1,7 @@
#include "components/eventloop.hpp"
+#include
+
POLYBAR_NS
/**