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:
parent
a14b4cf61e
commit
99223ed1c8
|
@ -97,6 +97,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_scale_factor(&self, factor: f32) -> bool {
|
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));
|
self.scaling_factor.store(Some(factor));
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,12 @@ impl<E: IcedEditor> Editor for IcedEditorWrapper<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_scale_factor(&self, factor: f32) -> bool {
|
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));
|
self.scaling_factor.store(Some(factor));
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,12 @@ impl Editor for ViziaEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_scale_factor(&self, factor: f32) -> bool {
|
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
|
// 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
|
// used for HiDPI and also known to the host, and a user scale factor that the user can use
|
||||||
// to arbitrarily resize the GUI
|
// to arbitrarily resize the GUI
|
||||||
|
|
Loading…
Reference in a new issue