summaryrefslogtreecommitdiff
path: root/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch
diff options
context:
space:
mode:
Diffstat (limited to 'kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch')
-rw-r--r--kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch b/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch
new file mode 100644
index 000000000000..77296074bfa7
--- /dev/null
+++ b/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch
@@ -0,0 +1,31 @@
+From 2f305a7134f27489203c3fd2e9ca81790f35ac3b Mon Sep 17 00:00:00 2001
+From: ivan tkachenko <me@ratijas.tk>
+Date: Mon, 17 Jan 2022 02:24:44 +0300
+Subject: [PATCH] [upower] Properly round up battery's capacity
+
+The same rounding is already used for charge percent just few lines
+above. Without it, for example, values that are close to 100%
+(e.g. 99.9825%) were rounded down to 99% instead of up to 100%.
+
+BUG: 448372
+FIXED-IN: 5.91
+---
+ src/solid/devices/backends/upower/upowerbattery.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/solid/devices/backends/upower/upowerbattery.cpp b/src/solid/devices/backends/upower/upowerbattery.cpp
+index 22b25d9..055856b 100644
+--- a/src/solid/devices/backends/upower/upowerbattery.cpp
++++ b/src/solid/devices/backends/upower/upowerbattery.cpp
+@@ -84,7 +84,7 @@ int Battery::chargePercent() const
+
+ int Battery::capacity() const
+ {
+- return m_device.data()->prop("Capacity").toDouble();
++ return qRound(m_device.data()->prop("Capacity").toDouble());
+ }
+
+ bool Battery::isRechargeable() const
+--
+GitLab
+