From 557ebeb616e03d5e4a8049862bbbd1f02c6f020b Mon Sep 17 00:00:00 2001 From: Shawn Wallace Date: Sun, 29 Jun 2025 16:24:45 -0400 Subject: [PATCH] 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 --- src/xstate/settings.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xstate/settings.rs b/src/xstate/settings.rs index 4c3426b..ceac700 100644 --- a/src/xstate/settings.rs +++ b/src/xstate/settings.rs @@ -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,