diff --git a/client/configuration.cpp b/client/configuration.cpp index 8f39d456..dbb90dcc 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -218,19 +218,24 @@ void configuration::set_feature(feature f, bool state) save(); } -configuration::configuration(xr::system & system, xr::session & session) +configuration::configuration(xr::system & system, xr::session & session) : + default_refresh_rate([&session]() { + const auto & rates = session.get_refresh_rates(); + float default_rate = rates.empty() ? 0 : rates[0]; + for (auto rate: rates) + { + if (rate >= max_default_rate) + break; + default_rate = rate; + } + return default_rate; + }()) { passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color; features[feature::hand_tracking] = system.hand_tracking_supported(); + preferred_refresh_rate = default_refresh_rate; const auto & rates = session.get_refresh_rates(); - for (auto rate: rates) - { - if (rate >= max_default_rate) - break; - preferred_refresh_rate = rate; - } - const float default_refresh_rate = preferred_refresh_rate; try { @@ -396,6 +401,11 @@ float configuration::get_stream_scale() const { if (stream_scale) return *stream_scale; + return get_default_stream_scale(); +} + +float configuration::get_default_stream_scale() const +{ if (check_feature(feature::eye_gaze)) return 0.3; return 0.5; diff --git a/client/configuration.h b/client/configuration.h index f1ed737c..c78021ed 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -139,6 +139,7 @@ public: void set_stream_scale(float); float get_stream_scale() const; + float get_default_stream_scale() const; uint32_t max_bitrate(bool extended) const { @@ -149,4 +150,6 @@ public: { return max_bitrate(extended_config); } + + const float default_refresh_rate = 0; }; diff --git a/client/render/ui_theme.cpp b/client/render/ui_theme.cpp index 09985e24..37abbe1c 100644 --- a/client/render/ui_theme.cpp +++ b/client/render/ui_theme.cpp @@ -187,7 +187,7 @@ void set_theme(const theme & t) float & background_alpha() { - static float alpha = 0.90f; // translucent panels by default + static float alpha = 0.75f; // translucent panels by default return alpha; } diff --git a/client/scenes/gui_settings.cpp b/client/scenes/gui_settings.cpp index 730bc0ad..a1e78c80 100644 --- a/client/scenes/gui_settings.cpp +++ b/client/scenes/gui_settings.cpp @@ -212,9 +212,11 @@ void settings_performance(const settings_context & ctx) const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{}; std::vector list; - if (ctx.instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME) and not ctx.session.get_refresh_rates().empty()) + if (const auto rates = ctx.session.get_refresh_rates(); not rates.empty()) { - const auto rates = ctx.session.get_refresh_rates(); + auto it = std::ranges::find(rates, config.default_refresh_rate); + int default_rate_index = it == rates.end() ? 0 : (it - rates.begin() + 1); + list.push_back({ .id = "##refresh", .label = _("Refresh rate"), @@ -245,7 +247,7 @@ void settings_performance(const settings_context & ctx) for (float r: rates) opts.push_back(fmt::format("{}", int(r))); return opts; }, - .default_int = 0, + .default_int = default_rate_index, }); } @@ -859,7 +861,7 @@ void settings_theme(const settings_context & ctx) ui::row_separator(); // Panel transparency, independent of the selected preset - static const int opacity_default = 90; + static const int opacity_default = 75; int opacity = int(ui::background_alpha() * 100); ui::setting_label(_cS("setting name", "Panel opacity"), _cS("setting description", "Opacity of the panel and card backgrounds"), control_w); if (ui::slider_int("##opacity", &opacity, 20, 100, "%d%%", {control_w, 0}, &opacity_default))