1
0
Fork 0

Prevent HiDPI scale changes after opening editor

Ableton Live does this and it caused mysterious issues where the window
could suddenly be larger than the window's contents when resizing on a
HiDPI setup.
This commit is contained in:
Robbert van der Helm 2023-02-27 01:02:52 +01:00
parent a14b4cf61e
commit 99223ed1c8
3 changed files with 18 additions and 0 deletions

View file

@ -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
}

View file

@ -97,6 +97,12 @@ impl<E: IcedEditor> Editor for IcedEditorWrapper<E> {
}
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
}

View file

@ -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