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:
parent
ef24bce5d9
commit
557ebeb616
1 changed files with 1 additions and 0 deletions
|
|
@ -164,6 +164,7 @@ impl Settings {
|
||||||
fn set_scale(&mut self, scale: f64) {
|
fn set_scale(&mut self, scale: f64) {
|
||||||
self.serial += 1;
|
self.serial += 1;
|
||||||
|
|
||||||
|
let scale = scale.max(1.0);
|
||||||
let setting = IntSetting {
|
let setting = IntSetting {
|
||||||
value: (scale * DEFAULT_DPI as f64 * DPI_SCALE_FACTOR as f64).round() as i32,
|
value: (scale * DEFAULT_DPI as f64 * DPI_SCALE_FACTOR as f64).round() as i32,
|
||||||
last_change_serial: self.serial,
|
last_change_serial: self.serial,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue