diff --git a/nih_plug_egui/src/editor.rs b/nih_plug_egui/src/editor.rs index 9647e606..1e627c3b 100644 --- a/nih_plug_egui/src/editor.rs +++ b/nih_plug_egui/src/editor.rs @@ -97,6 +97,12 @@ where } fn set_scale_factor(&self, factor: f32) -> bool { + // If the editor is currently open then the host must not change the current HiDPI scale as + // we don't have a way to handle that. Ableton Live does this. + if self.egui_state.is_open() { + return false; + } + self.scaling_factor.store(Some(factor)); true } diff --git a/nih_plug_iced/src/editor.rs b/nih_plug_iced/src/editor.rs index 249724e4..0724cbd4 100644 --- a/nih_plug_iced/src/editor.rs +++ b/nih_plug_iced/src/editor.rs @@ -97,6 +97,12 @@ impl Editor for IcedEditorWrapper { } fn set_scale_factor(&self, factor: f32) -> bool { + // If the editor is currently open then the host must not change the current HiDPI scale as + // we don't have a way to handle that. Ableton Live does this. + if self.iced_state.is_open() { + return false; + } + self.scaling_factor.store(Some(factor)); true } diff --git a/nih_plug_vizia/src/editor.rs b/nih_plug_vizia/src/editor.rs index f1b9aa04..63ed4fa1 100644 --- a/nih_plug_vizia/src/editor.rs +++ b/nih_plug_vizia/src/editor.rs @@ -121,6 +121,12 @@ impl Editor for ViziaEditor { } fn set_scale_factor(&self, factor: f32) -> bool { + // If the editor is currently open then the host must not change the current HiDPI scale as + // we don't have a way to handle that. Ableton Live does this. + if self.vizia_state.is_open() { + return false; + } + // We're making things a bit more complicated by having both a system scale factor, which is // used for HiDPI and also known to the host, and a user scale factor that the user can use // to arbitrarily resize the GUI