Skip to content

Commit

Permalink
fix parsing of scaling values as percentages
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed May 1, 2024
1 parent c1b7bff commit d382473
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xpra/util/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ def parse_scaling_value(v) -> tuple[int, int] | None:
if not v:
return None
if v.endswith("%"):
return float(v[:1]).as_integer_ratio()
num = int(v[:-1])
denom = 100
for div in (2, 5):
while (num % div) == 0 and (denom % div) == 0:
num = num // div
denom = denom // div
return num, denom
values = v.replace("/", ":").replace(",", ":").split(":", 1)
values = [int(x) for x in values]
for x in values:
Expand Down

0 comments on commit d382473

Please sign in to comment.