Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
environment.hpp File Reference

Unified environment API: display, safe-area, keyboard, orientation, color scheme, foreground/background, memory pressure. More...

#include <atomic>
#include <cstdint>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include <TargetConditionals.h>

Go to the source code of this file.

Classes

struct  pulp::platform::SafeAreaInsets
 Safe-area insets in CSS-pixel space (already divided by content_scale). More...
struct  pulp::platform::KeyboardInset
 Soft-keyboard inset (mobile only). More...
struct  pulp::platform::DisplayInfo
 Logical display geometry. More...
struct  pulp::platform::EnvironmentChange
 Bitmask of fields that changed in the snapshot delivered to a listener. More...
struct  pulp::platform::EnvironmentState
 Snapshot of the full environment state. More...
class  pulp::platform::Environment
 In-process notifier. More...
class  pulp::platform::Environment::Token
 RAII subscription. Drop to unsubscribe. More...

Namespaces

namespace  pulp
namespace  pulp::platform
 Device capability vocabulary: one tier ladder, one thermal ladder, and the projection from observed inputs onto them.

Enumerations

enum class  pulp::platform::ColorScheme : uint8_t { pulp::platform::light , pulp::platform::dark , pulp::platform::unknown }
 Light/dark color scheme reported by the OS. More...
enum class  pulp::platform::LifecycleState : uint8_t { pulp::platform::foreground , pulp::platform::inactive , pulp::platform::background , pulp::platform::unknown }
 Coarse foreground/background lifecycle state. More...
enum class  pulp::platform::Orientation : uint8_t {
  pulp::platform::portrait , pulp::platform::portrait_upside_down , pulp::platform::landscape_left , pulp::platform::landscape_right ,
  pulp::platform::flat , pulp::platform::unknown
}
 Device orientation. More...
enum class  pulp::platform::MemoryPressure : uint8_t { pulp::platform::normal , pulp::platform::moderate , pulp::platform::critical }
 Memory pressure level. More...

Functions

void pulp::platform::start_environment_observer_mac ()
void pulp::platform::start_environment_observer ()

Detailed Description

Unified environment API: display, safe-area, keyboard, orientation, color scheme, foreground/background, memory pressure.

Each platform populates the fields it can observe; unsupported fields retain their default. Listeners receive a snapshot of the new state

  • a bitmask of which fields changed since the last notification.

Thread model: Environment is meant to be read from any thread (the snapshot accessor returns a value copy). Listeners are invoked on the thread that delivered the platform event — typically the main UI thread — but no global locking is held during dispatch, so listener bodies that touch shared state must apply their own synchronization.

This header defines the contract and an in-process notifier. Platform adapters live under core/platform/platform/{android,ios,mac,win,linux}/ and call Environment::dispatcher().publish(...) when their respective OS callbacks fire (Android Configuration.onConfigurationChanged, iOS UITraitCollection, macOS NSApplicationDidChangeScreenParameters, Windows WM_DPICHANGED/WM_SETTINGCHANGE, Linux XSettings + Wayland fractional scale).