Route VR mode through app preferences

This commit is contained in:
2026-06-04 14:22:39 +02:00
parent f8243566c4
commit 884a6d4940
8 changed files with 79 additions and 23 deletions

View File

@@ -53,6 +53,7 @@ public:
virtual void apply_ui_scale(const ScaleApplicationPlan& plan) = 0;
virtual void apply_viewport_scale(const ScaleApplicationPlan& plan) = 0;
virtual void apply_interface_direction(const InterfaceDirectionPlan& plan) = 0;
virtual bool apply_vr_mode_preference(const StoredBooleanPreferencePlan& plan) = 0;
virtual void apply_vr_controllers_preference(const StoredBooleanPreferencePlan& plan) = 0;
virtual void apply_timelapse_preference(const TimelapsePreferencePlan& plan) = 0;
virtual void apply_canvas_cursor_mode(const StoredIntegerPreferencePlan& plan) = 0;
@@ -120,6 +121,11 @@ public:
return { enabled };
}
[[nodiscard]] constexpr StoredBooleanPreferencePlan plan_vr_mode_preference(bool enabled) noexcept
{
return { enabled };
}
[[nodiscard]] constexpr StoredIntegerPreferencePlan plan_canvas_cursor_mode(int mode) noexcept
{
return { mode };
@@ -151,6 +157,16 @@ public:
return pp::foundation::Status::success();
}
[[nodiscard]] inline pp::foundation::Status execute_vr_mode_preference(
bool enabled,
AppPreferenceServices& services)
{
if (!services.apply_vr_mode_preference(plan_vr_mode_preference(enabled))) {
return pp::foundation::Status::invalid_argument("VR mode could not start");
}
return pp::foundation::Status::success();
}
[[nodiscard]] inline pp::foundation::Status execute_vr_controllers_preference(
bool enabled,
AppPreferenceServices& services)