1
0
Fork 0

Don't use baseview system scaling on Windows/Linux

Until the UI frameworks make it possible to get the size or scale for
the window, this would cause the window contents to be scaled
incorrectly if the host does not set a scale factor.
This commit is contained in:
Robbert van der Helm 2022-04-27 18:33:08 +02:00
parent b3d2b79284
commit ae31e416c2
3 changed files with 21 additions and 0 deletions

View file

@ -44,7 +44,13 @@ where
user_state: Arc::new(RwLock::new(user_state)), user_state: Arc::new(RwLock::new(user_state)),
update: Arc::new(update), update: Arc::new(update),
// TODO: We can't get the size of the window when baseview does its own scaling, so if the
// host does not set a scale factor on Windows or Linux we should just use a factor of
// 1. That may make the GUI tiny but it also prevents it from getting cut off.
#[cfg(target_os = "macos")]
scaling_factor: AtomicCell::new(None), scaling_factor: AtomicCell::new(None),
#[cfg(not(target_os = "macos"))]
scaling_factor: AtomicCell::new(Some(1.0)),
})) }))
} }

View file

@ -132,7 +132,13 @@ pub fn create_iced_editor<E: IcedEditor>(
iced_state, iced_state,
initialization_flags, initialization_flags,
// TODO: We can't get the size of the window when baseview does its own scaling, so if the
// host does not set a scale factor on Windows or Linux we should just use a factor of
// 1. That may make the GUI tiny but it also prevents it from getting cut off.
#[cfg(target_os = "macos")]
scaling_factor: AtomicCell::new(None), scaling_factor: AtomicCell::new(None),
#[cfg(not(target_os = "macos"))]
scaling_factor: AtomicCell::new(Some(1.0)),
parameter_updates_sender, parameter_updates_sender,
parameter_updates_receiver: Arc::new(parameter_updates_receiver), parameter_updates_receiver: Arc::new(parameter_updates_receiver),

View file

@ -34,7 +34,13 @@ where
app: Arc::new(app), app: Arc::new(app),
apply_theming: true, apply_theming: true,
// TODO: We can't get the size of the window when baseview does its own scaling, so if the
// host does not set a scale factor on Windows or Linux we should just use a factor of
// 1. That may make the GUI tiny but it also prevents it from getting cut off.
#[cfg(target_os = "macos")]
scaling_factor: AtomicCell::new(None), scaling_factor: AtomicCell::new(None),
#[cfg(not(target_os = "macos"))]
scaling_factor: AtomicCell::new(Some(1.0)),
})) }))
} }
@ -54,7 +60,10 @@ where
app: Arc::new(app), app: Arc::new(app),
apply_theming: false, apply_theming: false,
#[cfg(target_os = "macos")]
scaling_factor: AtomicCell::new(None), scaling_factor: AtomicCell::new(None),
#[cfg(not(target_os = "macos"))]
scaling_factor: AtomicCell::new(Some(1.0)),
})) }))
} }