Unverified Commit a2397da0 authored by Mirei124's avatar Mirei124 Committed by GitHub

Use rounding to prevent incorrect backlight percentage calculation (#236)

parent 81bf4bdb
...@@ -116,11 +116,11 @@ namespace SwayNotificationCenter.Widgets { ...@@ -116,11 +116,11 @@ namespace SwayNotificationCenter.Widgets {
} }
private int calc_percent (int val) { private int calc_percent (int val) {
return val * 100 / max; return (int) Math.round (val * 100.0 / max);
} }
private int calc_actual (float val) { private int calc_actual (float val) {
return (int) val * max / 100; return (int) Math.round (val * max / 100);
} }
public int get_max_value () { public int get_max_value () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment