Rename environment variables

This commit is contained in:
Tobias Hunger 2022-02-02 13:35:07 +01:00
parent cc3994b58d
commit 1a0a495bc5
No known key found for this signature in database
GPG key ID: 60874021D2F23F91
18 changed files with 34 additions and 34 deletions

View file

@ -6,21 +6,21 @@ On this page we're presenting different techniques and tools we've built into Si
Animations in the user interface need to be carefully designed to have the correct duration and changes in element positioning or size need to follow a suitable curve.
In order to inspect the animations in your application, you can can set the `SIXTYFPS_SLOW_ANIMATIONS` environment variable before running the program. The variable accepts an unsigned integer value that is interpreted as a factor to globally slow down the steps of all animations, without having to make any changes to the `.slint` markup and recompiling. For example `SIXTYFPS_SLOW_ANIMATIONS=4` will slow down animations by a factor of four.
In order to inspect the animations in your application, you can can set the `SLINT_SLOW_ANIMATIONS` environment variable before running the program. The variable accepts an unsigned integer value that is interpreted as a factor to globally slow down the steps of all animations, without having to make any changes to the `.slint` markup and recompiling. For example `SLINT_SLOW_ANIMATIONS=4` will slow down animations by a factor of four.
## User Interface Scaling
The use of logical pixel lengths throughout `.slint` files allows SixtyFPS to dynamically compute the correct size of physical pixels, depending on the device-pixel ratio of the screen that is reported by the windowing system. If you want to get an impression of how the individual elements look like when rendered on a screen with a different device-pixel ratio, then you can set the `SIXTYFPS_SCALE_FACTOR` environment variable before running the program. The variable accepts a floating pointer number that is used to convert logical pixel lengths to physical pixel lengths by multiplication. For example `SIXTYFPS_SCALE_FACTOR=2` will render the user interface in a way where every logical pixel will have twice the width and height.
The use of logical pixel lengths throughout `.slint` files allows SixtyFPS to dynamically compute the correct size of physical pixels, depending on the device-pixel ratio of the screen that is reported by the windowing system. If you want to get an impression of how the individual elements look like when rendered on a screen with a different device-pixel ratio, then you can set the `SLINT_SCALE_FACTOR` environment variable before running the program. The variable accepts a floating pointer number that is used to convert logical pixel lengths to physical pixel lengths by multiplication. For example `SLINT_SCALE_FACTOR=2` will render the user interface in a way where every logical pixel will have twice the width and height.
*Note*: At the moment this overriding environment variable is only supported when using the OpenGL rendering backend.
## Performance Debugging
SixtyFPS tries its best to use hardware-acceleration to ensure that rendering the user interface uses a minimal amount of CPU resources and animations appear smooth. However depending on the complexity of the user interface, the quality of the graphics drivers or the power of the graphics acceleration in your system, you may hit limits and experience a slow down. You can set the `SIXTYFPS_DEBUG_PERFORMANCE` environment variable running the program to inspect at what rate your application is rendering frames to the screen. The variable accepts a few comma-separated options that affect how the frame rate inspection is performed and reported:
SixtyFPS tries its best to use hardware-acceleration to ensure that rendering the user interface uses a minimal amount of CPU resources and animations appear smooth. However depending on the complexity of the user interface, the quality of the graphics drivers or the power of the graphics acceleration in your system, you may hit limits and experience a slow down. You can set the `SLINT_DEBUG_PERFORMANCE` environment variable running the program to inspect at what rate your application is rendering frames to the screen. The variable accepts a few comma-separated options that affect how the frame rate inspection is performed and reported:
* `refresh_lazy`: The frame rate is measured only when an actual frame is rendered, for example due to a running animation, user interface or some state change that results in a visual difference in the user interface. When nothing changes, the reported frame rate will be low. This can be useful to verify that no unnecessary repainting happens when there are no visual changes. For example a user interface that shows a text input field with a cursor that blinks once a second, the reported frames per second should be two.
* `refresh_full_speed`: The user interface is continuously refreshed, even if nothing is changed. This will result in a higher load on the system, but can be useful to identify any bottlenecks that prevent you from achieving smooth animations.
* `console`: The measured frame per second rate is printed to stderr on the console.
* `overlay`: The measured frame per second rate is as an overlay text label on top of the user interface in each window.
These options are combined. At least the method of frame rate measuring and one reporting method must be specified. For example `SIXTYFPS_DEBUG_PERFORMANCE=refresh_full_speed,overlay` will repeatedly re-render the entire user interface in each window and print the achieved frame rate in the top-left corner. `SIXTYFPS_DEBUG_PERFORMANCE=refresh_lazy,console,overlay` will measure the frame rate only when something in the user interface changes and the measured value will be printed to stderr as well as rendered as an overlay text label.
These options are combined. At least the method of frame rate measuring and one reporting method must be specified. For example `SLINT_DEBUG_PERFORMANCE=refresh_full_speed,overlay` will repeatedly re-render the entire user interface in each window and print the achieved frame rate in the top-left corner. `SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay` will measure the frame rate only when something in the user interface changes and the measured value will be printed to stderr as well as rendered as an overlay text label.

View file

@ -63,19 +63,19 @@ Foo := Rectangle {
The rust driver will compile each snippet of code and put it in a `sixtyfps!` macro in its own module
In addition, if there are ```` ```rust ```` blocks in a comment, they are extracted into a `#[test]`
function in the same module. This is usefull to test the rust api.
This is all compiled in a while program, so the `SIXTYFPS_TEST_FILTER` environment variable can be
This is all compiled in a while program, so the `SLINT_TEST_FILTER` environment variable can be
set while building to only build the test that matches the filter.
Example: to test all the layout test:
```
SIXTYFPS_TEST_FILTER=layout cargo test -p test-driver-rust
SLINT_TEST_FILTER=layout cargo test -p test-driver-rust
```
Instead of putting everything in a sixtyfps! macro, it is possible to tell the driver to do the
compilation in the build.rs, with the builod-time feature:
```
SIXTYFPS_TEST_FILTER=layout cargo test -p test-driver-rust --features build-time
SLINT_TEST_FILTER=layout cargo test -p test-driver-rust --features build-time
```
### C++ driver

View file

@ -513,7 +513,7 @@ fn process_window_event(
runtime_window.process_mouse_input(ev);
}
WindowEvent::ScaleFactorChanged { scale_factor, new_inner_size: size } => {
if std::env::var("SIXTYFPS_SCALE_FACTOR").is_err() {
if std::env::var("SLINT_SCALE_FACTOR").is_err() {
let size = size.to_logical(scale_factor);
runtime_window.set_window_item_geometry(size.width, size.height);
runtime_window.set_scale_factor(scale_factor as f32);

View file

@ -338,12 +338,12 @@ impl PlatformWindow for GLWindow {
.with_title(window_title)
.with_resizable(is_resizable);
let scale_factor_override = std::env::var("SIXTYFPS_SCALE_FACTOR")
let scale_factor_override = std::env::var("SLINT_SCALE_FACTOR")
.ok()
.and_then(|x| x.parse::<f64>().ok())
.filter(|f| *f > 0.);
let window_builder = if std::env::var("SIXTYFPS_FULLSCREEN").is_ok() {
let window_builder = if std::env::var("SLINT_FULLSCREEN").is_ok() {
window_builder.with_fullscreen(Some(winit::window::Fullscreen::Borderless(None)))
} else {
let layout_info_h = component.as_ref().layout_info(Orientation::Horizontal);

View file

@ -108,7 +108,7 @@ mod the_backend {
impl PlatformWindow for McuWindow {
fn show(self: Rc<Self>) {
self.self_weak.upgrade().unwrap().set_scale_factor(
option_env!("SIXTYFPS_SCALE_FACTOR").and_then(|x| x.parse().ok()).unwrap_or(1.),
option_env!("SLINT_SCALE_FACTOR").and_then(|x| x.parse().ok()).unwrap_or(1.),
);
WINDOWS.with(|x| *x.borrow_mut() = Some(self))
}

View file

@ -99,7 +99,7 @@ impl PlatformWindow for SimulatorWindow {
platform_window.set_decorations(!window_item.no_frame());
};
if std::env::var("SIXTYFPS_FULLSCREEN").is_ok() {
if std::env::var("SLINT_FULLSCREEN").is_ok() {
platform_window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(None)))
} else {
let layout_info_h = component.as_ref().layout_info(Orientation::Horizontal);

View file

@ -14,7 +14,7 @@ only be used with `version = "=x.y.z"` in Cargo.toml.
The purpose of this crate is to select the default backend for [SixtyFPS](https://sixtyfps.io)
The backend can either be a runtime or a build time decision. The runtime decision is decided
by the `SIXTYFPS_BACKEND` environment variable. The built time default depends on the platform.
by the `SLINT_BACKEND` environment variable. The built time default depends on the platform.
In order for the crate to be available at runtime, they need to be added as feature
*/
@ -39,7 +39,7 @@ cfg_if::cfg_if! {
))] {
pub fn backend() -> &'static dyn slint_core_internal::backend::Backend {
slint_core_internal::backend::instance_or_init(|| {
let backend_config = std::env::var("SIXTYFPS_BACKEND").unwrap_or_default();
let backend_config = std::env::var("SLINT_BACKEND").unwrap_or_default();
#[cfg(feature = "slint-backend-qt-internal")]
if backend_config == "Qt" {

View file

@ -38,7 +38,7 @@ fn widget_library() -> &'static [(&'static str, &'static BuiltinDirectory<'stati
writeln!(file, "]\n}}")?;
println!("cargo:rustc-env=SIXTYFPS_WIDGETS_LIBRARY={}", output_file_path.display());
println!("cargo:rustc-env=SLINT_WIDGETS_LIBRARY={}", output_file_path.display());
Ok(())
}

View file

@ -33,7 +33,7 @@ pub fn load_file<'a>(path: &'a std::path::Path) -> Option<VirtualFile<'static>>
}
mod builtin_library {
include!(env!("SIXTYFPS_WIDGETS_LIBRARY"));
include!(env!("SLINT_WIDGETS_LIBRARY"));
pub type BuiltinDirectory<'a> = [&'a BuiltinFile<'a>];

View file

@ -89,12 +89,12 @@ impl CompilerConfiguration {
}
};
let inline_all_elements = match std::env::var("SIXTYFPS_INLINING") {
Ok(var) => {
var.parse::<bool>().unwrap_or_else(|_|{
panic!("SIXTYFPS_INLINING has incorrect value. Must be either unset, 'true' or 'false'")
})
}
let inline_all_elements = match std::env::var("SLINT_INLINING") {
Ok(var) => var.parse::<bool>().unwrap_or_else(|_| {
panic!(
"SLINT_INLINING has incorrect value. Must be either unset, 'true' or 'false'"
)
}),
// Currently, the interpreter needs the inlining to be on.
Err(_) => output_format == crate::generator::OutputFormat::Interpreter,
};

View file

@ -67,7 +67,7 @@ fn embed_image(
if let Some(file) = crate::fileaccess::load_file(std::path::Path::new(path)) {
let mut kind = EmbeddedResourcesKind::RawData;
#[cfg(not(target_arch = "wasm32"))]
if std::env::var("SIXTYFPS_PROCESS_IMAGES").is_ok() {
if std::env::var("SLINT_PROCESS_IMAGES").is_ok() {
match load_image(file) {
Ok(img) => kind = EmbeddedResourcesKind::TextureData(generate_texture(img)),
Err(err) => {

View file

@ -327,7 +327,7 @@ pub fn update_animations() {
#[allow(unused_mut)]
let mut duration = Instant::duration_since_start().as_millis() as u64;
#[cfg(feature = "std")]
if let Ok(val) = std::env::var("SIXTYFPS_SLOW_ANIMATIONS") {
if let Ok(val) = std::env::var("SLINT_SLOW_ANIMATIONS") {
let factor = val.parse().unwrap_or(2);
duration /= factor;
};

View file

@ -39,14 +39,14 @@ pub struct FPSCounter {
}
impl FPSCounter {
/// Returns a new instance of the counter if requested by the user (via `SIXTYFPS_DEBUG_PERFORMANCE` environment variable).
/// Returns a new instance of the counter if requested by the user (via `SLINT_DEBUG_PERFORMANCE` environment variable).
/// The environment variable holds a comma separated list of options:
/// * `refresh_lazy`: selects the lazy refresh mode, where measurements are only taken when a frame is rendered (due to user input or animations)
/// * `refresh_full_speed`: frames are continuously rendered
/// * `console`: the measurement is printed to the console
/// * `overlay`: the measurement is drawn as overlay on top of the scene
pub fn new() -> Option<Rc<Self>> {
let options = match std::env::var("SIXTYFPS_DEBUG_PERFORMANCE") {
let options = match std::env::var("SLINT_DEBUG_PERFORMANCE") {
Ok(var) => var,
_ => return None,
};
@ -55,7 +55,7 @@ impl FPSCounter {
let refresh_mode = match RefreshMode::try_from(&options) {
Ok(mode) => mode,
Err(_) => {
eprintln!("Missing refresh mode in SIXTYFPS_DEBUG_PERFORMANCE. Please specify either refresh_full_speed or refresh_lazy");
eprintln!("Missing refresh mode in SLINT_DEBUG_PERFORMANCE. Please specify either refresh_full_speed or refresh_lazy");
return None;
}
};
@ -64,7 +64,7 @@ impl FPSCounter {
let output_overlay = options.contains(&"overlay");
if !output_console && !output_overlay {
eprintln!("Missing output mode in SIXTYFPS_DEBUG_PERFORMANCE. Please specify either console or overlay (or both)");
eprintln!("Missing output mode in SLINT_DEBUG_PERFORMANCE. Please specify either console or overlay (or both)");
return None;
}

View file

@ -25,8 +25,8 @@ pub fn collect_test_cases() -> std::io::Result<Vec<TestCase>> {
let case_root_dir: std::path::PathBuf =
[env!("CARGO_MANIFEST_DIR"), "..", "..", "cases"].iter().collect();
println!("cargo:rerun-if-env-changed=SIXTYFPS_TEST_FILTER");
let filter = std::env::var("SIXTYFPS_TEST_FILTER").ok();
println!("cargo:rerun-if-env-changed=SLINT_TEST_FILTER");
let filter = std::env::var("SLINT_TEST_FILTER").ok();
for entry in walkdir::WalkDir::new(case_root_dir.clone()).follow_links(true) {
let entry = entry?;

View file

@ -23,7 +23,7 @@ pub fn test(testcase: &test_driver_lib::TestCase) -> Result<(), Box<dyn Error>>
None => {
slint_interpreter::print_diagnostics(&compiler.diagnostics());
match std::env::var("SIXTYFPS_INTERPRETER_ERROR_WHITELIST") {
match std::env::var("SLINT_INTERPRETER_ERROR_WHITELIST") {
Ok(wl) if !wl.is_empty() => {
let errors = compiler
.diagnostics()

View file

@ -113,7 +113,7 @@ impl<'a> DocumentCache<'a> {
fn main() {
let args: Cli = Cli::parse();
if !args.backend.is_empty() {
std::env::set_var("SIXTYFPS_BACKEND", &args.backend);
std::env::set_var("SLINT_BACKEND", &args.backend);
}
let lsp_thread = std::thread::spawn(|| {

View file

@ -71,7 +71,7 @@ fn main() -> Result<()> {
}
if let Some(backend) = &args.backend {
std::env::set_var("SIXTYFPS_BACKEND", backend);
std::env::set_var("SLINT_BACKEND", backend);
}
let fswatcher = if args.auto_reload { Some(start_fswatch_thread(args.clone())?) } else { None };

View file

@ -43,7 +43,7 @@ function lspPlatform(): Platform | null {
if (typeof vscode.env.remoteName !== "undefined") {
remote_env_options = {
"DISPLAY": ":0",
"SIXTYFPS_FULLSCREEN": "1"
"SLINT_FULLSCREEN": "1"
};
}
if (process.arch === "x64") {