mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 13:51:13 +00:00
winit backend: preserve the value of the scale_factor set programmatically
This commit is contained in:
parent
56ead8689c
commit
14d251e63a
1 changed files with 11 additions and 4 deletions
|
@ -408,10 +408,17 @@ impl PlatformWindow for GLWindow {
|
|||
.with_title(window_title)
|
||||
.with_resizable(is_resizable);
|
||||
|
||||
let scale_factor_override = std::env::var("SLINT_SCALE_FACTOR")
|
||||
let scale_factor_override = runtime_window.scale_factor();
|
||||
// If the scale factor was already set programmatically, use that
|
||||
// else, use the SLINT_SCALE_FACTOR if set, otherwise use the one from winit
|
||||
let scale_factor_override = if scale_factor_override > 1. {
|
||||
Some(scale_factor_override as f64)
|
||||
} else {
|
||||
std::env::var("SLINT_SCALE_FACTOR")
|
||||
.ok()
|
||||
.and_then(|x| x.parse::<f64>().ok())
|
||||
.filter(|f| *f > 0.);
|
||||
.filter(|f| *f > 0.)
|
||||
};
|
||||
|
||||
let window_builder = if std::env::var("SLINT_FULLSCREEN").is_ok() {
|
||||
window_builder.with_fullscreen(Some(winit::window::Fullscreen::Borderless(None)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue