RatbagdResolution: clamp values instead of returning an error

We cannot return error codes, but requesting a resync is overkill.
Instead, let's be nice and clamp these values.
This commit is contained in:
Jente Hidskes
2017-09-11 20:22:00 +02:00
committed by Peter Hutterer
parent 26e7237010
commit a2b3c32124

View File

@@ -282,8 +282,10 @@ ratbagd_resolution_set_report_rate(sd_bus *bus,
return r;
/* basic sanity check */
if (rate > 5000 || rate % 100)
return 0;
if (rate > 5000)
rate = 5000;
else if (rate % 100)
rate = rate - (rate % 100);
r = ratbag_resolution_set_report_rate(resolution->lib_resolution,
rate);