[gnome-settings-daemon] power: Improve battery warning debounce logic
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Improve battery warning debounce logic
- Date: Thu, 10 Feb 2022 17:16:54 +0000 (UTC)
commit 39c9fd0ff461d3c2800e60fdc907fbb99c16afd4
Author: Marti Raudsepp <marti juffo org>
Date: Thu Oct 21 20:58:18 2021 +0300
power: Improve battery warning debounce logic
Despite the debounce logic introduced in
60621b90bc3154dc905ed90780a7f19eb553ab26, GSD kept warning me of the
battery level every time my Logitech K600 keyboard (via Unifying
receiver) disconnects/reconnects.
Added another condition: when battery level drops to
`UP_DEVICE_LEVEL_NONE`, the previous entry in the hash table would not
be overwritten. This avoids duplicated warnings when transitioning
NONE->LOW->NONE->LOW.
plugins/power/gsd-power-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 7a9222cc..757986e3 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -484,7 +484,7 @@ engine_device_debounce_warn (GsdPowerManager *manager,
ret = FALSE;
}
- if (warning != UP_DEVICE_LEVEL_UNKNOWN)
+ if (warning != UP_DEVICE_LEVEL_UNKNOWN && warning != UP_DEVICE_LEVEL_NONE)
g_hash_table_insert (manager->devices_notified_ht,
g_strdup (serial),
GINT_TO_POINTER (warning));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]