docs
Loading...
Searching...
No Matches
Settings

#include <AppCore/App.h>

Overview

App-specific settings.

Public Attributes

String developer_name = "MyCompany"
 The name of the developer of this app.
String app_name = "MyApp"
 The name of this app, used with developer_name to build the per-app folders (see developer_name).
String file_system_path = "./assets/"
 The root folder for file:/// URLs.
bool force_cpu_renderer = false
 Whether or not to always use the CPU renderer.
double device_scale_override = 0.0
 Override the device scale factor for all windows.
bool auto_font_profile = true
 Whether or not to pick the font-appearance preset from the operating system, so text matches the platform's native look (FontProfile::WindowsLike on Windows and Linux, FontProfile::MacOSLike on macOS).
bool auto_font_families = true
 Whether or not to pick the default font families (serif, sans-serif, monospace, etc.) from the operating system, so generic CSS families resolve to the same fonts as the platform's browsers (eg, Menlo for monospace on macOS, Consolas on Windows).
bool match_native_editing_behavior = true
 Whether or not text editing in the Views this app creates should follow the host OS's native conventions (eg, non-directional selections on macOS).
double idle_threshold = 0.5
 The minimum duration of user inactivity (in seconds) before idle detection begins.
double sustained_idle_time = 2.0
 The time (in seconds) the app must remain continuously idle before AppListener::OnIdle() fires, and the interval between repeated calls after that.
double idle_utilization_threshold = 0.5
 The thread CPU utilization (0.0-1.0) below which the app is considered idle.
bool enable_profiler = false
 Whether or not to enable the built-in trace file profiler.
uint32_t headless_paint_fps = 0
 The paint rate (in frames per second) for windows created with WindowFlags::Hidden.
bool full_speed_loop = false
 Whether or not to run the app's update loop at full speed, without sleeping between updates.
bool sync_animations_to_present = true
 Whether or not to time animations for the moment each frame appears on screen.
RefPtr< Bitmap > app_icon
 The application icon, as a 32-bit BGRA bitmap with straight (unpremultiplied) alpha.

Member Data Documentation

◆ app_icon

RefPtr<Bitmap> app_icon

The application icon, as a 32-bit BGRA bitmap with straight (unpremultiplied) alpha.

On macOS this is the Dock icon. On Windows and Linux it's the default icon for windows that haven't set their own with Window::SetIcon(). Leave it null to keep the platform default.

◆ app_name

String app_name = "MyApp"

The name of this app, used with developer_name to build the per-app folders (see developer_name).

◆ auto_font_families

bool auto_font_families = true

Whether or not to pick the default font families (serif, sans-serif, monospace, etc.) from the operating system, so generic CSS families resolve to the same fonts as the platform's browsers (eg, Menlo for monospace on macOS, Consolas on Windows).

This applies to Views created without an explicit ViewConfig. A config you pass to Container::AddPanel() keeps its own font families– start from Window::default_view_config() to inherit them. Set this to false to keep the platform-neutral families everywhere.

◆ auto_font_profile

bool auto_font_profile = true

Whether or not to pick the font-appearance preset from the operating system, so text matches the platform's native look (FontProfile::WindowsLike on Windows and Linux, FontProfile::MacOSLike on macOS).

This only applies while Config::font_profile is FontProfile::Default– a profile you set yourself always wins. Set this to false to keep the Default profile's platform-neutral appearance everywhere.

◆ developer_name

String developer_name = "MyCompany"

The name of the developer of this app.

Together with app_name, this generates the per-app folders where the library keeps the log file (ultralight.log), profiler traces, and session data (cookies, cached resources, databases). A Config::cache_path you set yourself takes over the session data. The log and traces stay in the diagnostics folder either way.

Note
The folders are:

◆ device_scale_override

double device_scale_override = 0.0

Override the device scale factor for all windows.

When this is 0 or less (the default), the device scale is auto-detected from the monitor's DPI. Set a positive value (eg, 1.0, 1.5, 2.0) to use that scale for every window instead.

◆ enable_profiler

bool enable_profiler = false

Whether or not to enable the built-in trace file profiler.

When enabled, the library writes a Perfetto trace file that can be opened in https://ui.perfetto.dev to visualize Ultralight's internal performance.

Traces are written to a profiler_traces folder inside the app's diagnostics directory, alongside the log file (see developer_name for where that is). Read App::profiler_trace_path() for the exact file. This folder is the app's own, not the Config::cache_path you may have set.

Note
A profiler you set with Platform::set_profiler() before App::Create() is kept and this flag is ignored, with a warning in the log.
Note
If no trace file can be written, the log says so and nothing else changes. App::is_profiler_active() reads false.
Precondition
Requires the Pro edition or higher (the Profiler platform interface is not available in the Free or Plus editions).

◆ file_system_path

String file_system_path = "./assets/"

The root folder for file:/// URLs.

You should set this to the relative path where all of your app data is (eg, file:///page.html loads page.html from this folder).

Note
The path is relative to:
  • Windows: the executable's folder
  • Linux: the executable's folder
  • macOS: YourApp.app/Contents/Resources/

◆ force_cpu_renderer

bool force_cpu_renderer = false

Whether or not to always use the CPU renderer.

By default the library uses the GPU renderer when it finds a compatible GPU.

◆ full_speed_loop

bool full_speed_loop = false

Whether or not to run the app's update loop at full speed, without sleeping between updates.

By default the loop sleeps between updates, which keeps CPU usage low but paces how quickly page work (resource loading, script, layout) advances. Enable this to update continuously instead, so that work completes as fast as the CPU allows. Display refresh and hidden-window painting are still paced (see headless_paint_fps) and painting stays invalidation-driven, so animation timing is unchanged.

Warning
The loop thread busy-waits, so a single instance can fully occupy one CPU core. This is meant for batch / offscreen workloads that render many pages back to back, not interactive apps.

◆ headless_paint_fps

uint32_t headless_paint_fps = 0

The paint rate (in frames per second) for windows created with WindowFlags::Hidden.

Hidden windows receive no paint events from the OS, so by default they're never painted. Set this to a positive value to paint them at a fixed rate instead, which is what offscreen and headless capture need. The rate is independent of any monitor's refresh rate, so time-based content advances the same on every host.

◆ idle_threshold

double idle_threshold = 0.5

The minimum duration of user inactivity (in seconds) before idle detection begins.

◆ idle_utilization_threshold

double idle_utilization_threshold = 0.5

The thread CPU utilization (0.0-1.0) below which the app is considered idle.

◆ match_native_editing_behavior

bool match_native_editing_behavior = true

Whether or not text editing in the Views this app creates should follow the host OS's native conventions (eg, non-directional selections on macOS).

This applies to Views created without an explicit ViewConfig. A config you pass to Container::AddPanel() uses its own ViewConfig::match_native_editing_behavior instead. Set this to false for editing behavior that is identical on every platform.

◆ sustained_idle_time

double sustained_idle_time = 2.0

The time (in seconds) the app must remain continuously idle before AppListener::OnIdle() fires, and the interval between repeated calls after that.

◆ sync_animations_to_present

bool sync_animations_to_present = true

Whether or not to time animations for the moment each frame appears on screen.

A frame appears one or more display refreshes after the refresh that started it. With this on (the default), window.requestAnimationFrame() timestamps, CSS animations, and smooth scrolling use the time the frame will appear, which avoids lag while scrolling. Set this to false to use the time of the refresh instead.

Note
With this on, window.requestAnimationFrame() timestamps run ahead of performance.now() by the display's presentation delay (one to a few refreshes), so pages that compare the two will see the difference.
Note
This applies on macOS and Windows, once the library has measured the display's timing (a moment after rendering starts).

The documentation for this struct was generated from the following file: