Skip to main content

gpui_platform/
app.rs

1//! Application-level platform state shared by `gpui` and its platform backends.
2
3/// Thermal state of the system
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum ThermalState {
6    /// System has no thermal constraints
7    Nominal,
8    /// System is slightly constrained, reduce discretionary work
9    Fair,
10    /// System is moderately constrained, reduce CPU/GPU intensive work
11    Serious,
12    /// System is critically constrained, minimize all resource usage
13    Critical,
14}
15
16/// The application's lifecycle phase, as owned and reported by a mobile OS.
17///
18/// `Inactive` means visible but not receiving input (a system dialog on
19/// top), while `Background` means not visible at all, with process death
20/// possible at any time thereafter.
21///
22/// | Phase        | iOS                          | Android      |
23/// |--------------|------------------------------|--------------|
24/// | `Active`     | `didBecomeActive`            | `onResume`   |
25/// | `Inactive`   | `willResignActive`           | `onPause`    |
26/// | `Background` | `didEnterBackground`         | `onStop`     |
27/// | `Foreground` | `willEnterForeground`        | `onStart`    |
28#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
29pub enum AppLifecyclePhase {
30    /// Foreground and receiving input.
31    Active,
32    /// Foreground (visible) but not receiving input.
33    Inactive,
34    /// Not visible. The GPU surface may be destroyed while backgrounded and
35    /// the process may be killed without further notice.
36    Background,
37    /// Becoming visible again, before input is restored.
38    Foreground,
39}