xstate/settings: Clamp scale to >=1

Avoids crashing, and GTK apps also seem to generally dislike
when the reported DPI is less than the default.

Fixes #181
This commit is contained in:
Shawn Wallace 2025-06-29 16:24:45 -04:00
parent ef24bce5d9
commit 557ebeb616

View file

@ -164,6 +164,7 @@ impl Settings {
fn set_scale(&mut self, scale: f64) {
self.serial += 1;
let scale = scale.max(1.0);
let setting = IntSetting {
value: (scale * DEFAULT_DPI as f64 * DPI_SCALE_FACTOR as f64).round() as i32,
last_change_serial: self.serial,