refactor(boundary): affirmative instead of subtractive

This commit is contained in:
Nova
2026-09-29 21:52:44 +02:00
committed by xytovl
parent 66b095d164
commit 25e0316792
6 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -1479,7 +1479,7 @@ void application::initialize()
config.emplace(xr_system_id, xr_session, application::get_config_path() / "client.json");
default_config.emplace(xr_system_id, xr_session);
xr_session.set_boundary_hidden(config->hide_boundary);
xr_session.set_passthrough_boundary_enabled(config->passthrough_boundary_enabled);
#ifdef __ANDROID__
set_usb_networking(config->usb_network);
+1 -1
View File
@@ -327,7 +327,7 @@ const std::vector<config_field> & configuration::config_fields()
scalar("theme_font_scale", &configuration::theme_font_scale),
scalar("theme_background_alpha", &configuration::theme_background_alpha),
scalar("passthrough_enabled", &configuration::passthrough_enabled),
scalar("hide_boundary", &configuration::hide_boundary),
scalar("passthrough_boundary_enabled", &configuration::passthrough_boundary_enabled),
scalar("mic_unprocessed_audio", &configuration::mic_unprocessed_audio),
scalar("forward_keyboard", &configuration::forward_keyboard),
scalar("forward_mouse", &configuration::forward_mouse),
+2 -2
View File
@@ -72,8 +72,8 @@ public:
uint8_t bit_depth = 10;
bool passthrough_enabled = false;
// XR_META_boundary_visibility, the runtime only honours it while passthrough is shown
bool hide_boundary = true;
// XR_META_boundary_visibility, the boundary is always shown outside passthrough
bool passthrough_boundary_enabled = false;
bool mic_unprocessed_audio = false;
// Input forwarding, per device. Off by default; only effective if the server permits it.
+6 -6
View File
@@ -767,13 +767,13 @@ void settings_system(const settings_context & ctx)
if (ctx.session.boundary_visibility_supported())
{
list.push_back({
.id = "##hide_boundary",
.label = _C("setting name", "Hide boundary in passthrough"),
.description = _("Lets you walk outside the boundary while passthrough is shown. The boundary always comes back in VR."),
.id = "##passthrough_boundary",
.label = _C("setting name", "Enable boundary in passthrough"),
.description = _("Shows the boundary while passthrough is on. Disable to walk freely outside of it. The boundary is always shown in VR."),
.ui = ui_kind::toggle,
.get_bool = [&config] { return config.hide_boundary; },
.set_bool = [&ctx, &config](bool v) { config.hide_boundary = v; config.save(); ctx.session.set_boundary_hidden(v); },
.default_bool = default_config.hide_boundary,
.get_bool = [&config] { return config.passthrough_boundary_enabled; },
.set_bool = [&ctx, &config](bool v) { config.passthrough_boundary_enabled = v; config.save(); ctx.session.set_passthrough_boundary_enabled(v); },
.default_bool = default_config.passthrough_boundary_enabled,
});
}
+6 -6
View File
@@ -385,15 +385,15 @@ void xr::session::disable_passthrough()
passthrough.emplace<std::monostate>();
}
void xr::session::set_boundary_hidden(bool hidden)
void xr::session::set_passthrough_boundary_enabled(bool enabled)
{
boundary_hidden = hidden;
passthrough_boundary_enabled = enabled;
boundary_request_failed = false;
}
void xr::session::on_boundary_visibility_changed(XrBoundaryVisibilityMETA v)
{
boundary_visibility = v;
runtime_boundary_visibility = v;
}
// the runtime only allows suppression while passthrough is shown and restores
@@ -403,15 +403,15 @@ void xr::session::update_boundary_visibility()
if (not xrRequestBoundaryVisibilityMETA)
return;
auto v = boundary_hidden and not std::holds_alternative<std::monostate>(passthrough)
auto v = not passthrough_boundary_enabled and not std::holds_alternative<std::monostate>(passthrough)
? XR_BOUNDARY_VISIBILITY_SUPPRESSED_META
: XR_BOUNDARY_VISIBILITY_NOT_SUPPRESSED_META;
if (v == boundary_visibility)
if (v == runtime_boundary_visibility)
return;
if (auto res = xrRequestBoundaryVisibilityMETA(id, v); res == XR_SUCCESS)
{
boundary_visibility = v;
runtime_boundary_visibility = v;
boundary_request_failed = false;
}
else if (not boundary_request_failed)
+3 -3
View File
@@ -49,8 +49,8 @@ class session : public utils::handle<XrSession, xrDestroySession>
PFN_xrPerfSettingsSetPerformanceLevelEXT xrPerfSettingsSetPerformanceLevelEXT = nullptr;
PFN_xrRequestBoundaryVisibilityMETA xrRequestBoundaryVisibilityMETA = nullptr;
XrBoundaryVisibilityMETA boundary_visibility = XR_BOUNDARY_VISIBILITY_NOT_SUPPRESSED_META;
bool boundary_hidden = false;
XrBoundaryVisibilityMETA runtime_boundary_visibility = XR_BOUNDARY_VISIBILITY_NOT_SUPPRESSED_META;
bool passthrough_boundary_enabled = true;
bool boundary_request_failed = false;
void update_boundary_visibility();
@@ -111,7 +111,7 @@ public:
{
return xrRequestBoundaryVisibilityMETA;
}
void set_boundary_hidden(bool);
void set_passthrough_boundary_enabled(bool);
void on_boundary_visibility_changed(XrBoundaryVisibilityMETA);
};
} // namespace xr