Popup fixes and improvements

This commit is contained in:
ahsanswr
2026-07-26 17:24:36 +02:00
committed by Guillaume Meunier
parent e4b4bfa66d
commit 9352db046a
6 changed files with 201 additions and 85 deletions
+17 -17
View File
@@ -32,9 +32,9 @@ static theme dark_default()
theme t;
t.name = "Dark";
t.accent = rgb(59, 130, 246);
t.accent_hovered = rgb(82, 146, 247);
t.accent_active = rgb(43, 110, 222);
t.accent = rgb(30, 115, 255);
t.accent_hovered = rgb(64, 140, 255);
t.accent_active = rgb(18, 95, 228);
t.on_accent = rgb(255, 255, 255);
t.background = rgb(10, 11, 13);
@@ -128,14 +128,14 @@ static theme light()
{
theme t = dark_default();
t.name = "Light";
t.background = rgb(221, 224, 230);
t.card = rgb(255, 255, 255);
t.card_hovered = rgb(246, 247, 250);
t.control = rgb(212, 216, 224);
t.control_hovered = rgb(199, 204, 213);
t.control_active = rgb(184, 190, 201);
t.text = rgb(22, 24, 30);
t.text_muted = rgb(108, 114, 126);
t.background = rgb(188, 193, 202);
t.card = rgb(252, 252, 253);
t.card_hovered = rgb(242, 243, 246);
t.control = rgb(206, 210, 219);
t.control_hovered = rgb(193, 198, 208);
t.control_active = rgb(178, 184, 196);
t.text = rgb(14, 16, 20);
t.text_muted = rgb(66, 72, 84);
t.border = rgb(176, 182, 194);
return t;
}
@@ -148,12 +148,12 @@ std::vector<theme> presets()
std::vector<accent_swatch> accent_swatches()
{
return {
{"Blue", rgb(59, 130, 246), rgb(82, 146, 247), rgb(43, 110, 222)},
{"Violet", rgb(139, 92, 246), rgb(157, 116, 247), rgb(120, 72, 226)},
{"Emerald", rgb(16, 185, 129), rgb(34, 200, 145), rgb(8, 160, 110)},
{"Amber", rgb(245, 158, 11), rgb(248, 173, 40), rgb(220, 138, 6)},
{"Rose", rgb(244, 63, 94), rgb(247, 90, 117), rgb(222, 48, 78)},
{"Cyan", rgb(6, 182, 212), rgb(34, 197, 224), rgb(6, 158, 184)},
{"Blue", rgb(30, 115, 255), rgb(64, 140, 255), rgb(18, 95, 228)},
{"Violet", rgb(132, 72, 255), rgb(152, 98, 255), rgb(112, 52, 232)},
{"Emerald", rgb(0, 200, 132), rgb(28, 214, 150), rgb(0, 172, 112)},
{"Amber", rgb(255, 160, 0), rgb(255, 176, 36), rgb(228, 140, 0)},
{"Rose", rgb(255, 40, 82), rgb(255, 74, 108), rgb(230, 28, 68)},
{"Cyan", rgb(0, 190, 225), rgb(34, 205, 236), rgb(0, 168, 200)},
};
}
+3 -1
View File
@@ -84,7 +84,8 @@ constexpr float font_title = 1.7; // page header, x base font size
constexpr float font_description = 0.82; // muted secondary text, x base font size
constexpr ImVec2 button_padding = {26, 14};
constexpr ImVec2 card_padding = {28, 22};
constexpr ImVec2 card_padding = {28, 22}; // regular cards (settings, etc.)
constexpr ImVec2 list_card_padding = {18, 18}; // cards holding a list of rows (server list)
// Shared height of every full-width control (slider, segmented, combo, input)
// so they line up in a setting row, in multiples of ImGui::GetFrameHeight()
@@ -106,6 +107,7 @@ constexpr float combo_modal_min_width = 460; // popup never narrower than this
constexpr ImVec2 combo_padding = {16, 0}; // horizontal inner padding of box and rows
constexpr float list_row_box = 52; // leading icon/thumbnail size in a list row
constexpr float list_row_box_large = 80; // min thumbnail size for full-height list rows
constexpr float list_row_pad = 12; // inner padding of a list row, both axes
constexpr ImVec2 chip_padding = {12, 6}; // inner padding of a chip/badge
constexpr float chip_pill_padding_x = 18; // roomier horizontal padding for height-override pill chips (top bar)
+135 -32
View File
@@ -27,6 +27,8 @@
#include "IconsFontAwesome6.h"
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <unordered_map>
@@ -94,12 +96,12 @@ struct card_frame
float width;
float content_max_x_backup;
float work_max_x_backup;
ImVec2 padding;
};
std::vector<card_frame> card_stack;
std::unordered_map<ImGuiID, float> card_heights;
} // namespace
bool begin_card(const char * id, const ImVec2 &)
bool begin_card_impl(const char * id, ImVec2 padding)
{
ImGuiWindow * window = ImGui::GetCurrentWindow();
const theme & t = current();
@@ -109,7 +111,8 @@ bool begin_card(const char * id, const ImVec2 &)
window->DC.CursorPos,
ImGui::GetContentRegionAvail().x,
window->ContentRegionRect.Max.x,
window->WorkRect.Max.x});
window->WorkRect.Max.x,
padding});
const card_frame & cf = card_stack.back();
if (const float h = card_heights[gid]; h > 0)
@@ -121,13 +124,24 @@ bool begin_card(const char * id, const ImVec2 &)
}
ImGui::PushID(id);
window->ContentRegionRect.Max.x -= metrics::card_padding.x;
window->WorkRect.Max.x -= metrics::card_padding.x;
ImGui::Indent(metrics::card_padding.x);
ImGui::SetCursorScreenPos({ImGui::GetCursorScreenPos().x, cf.origin.y + metrics::card_padding.y});
window->ContentRegionRect.Max.x -= padding.x;
window->WorkRect.Max.x -= padding.x;
ImGui::Indent(padding.x);
ImGui::SetCursorScreenPos({ImGui::GetCursorScreenPos().x, cf.origin.y + padding.y});
ImGui::BeginGroup();
return true;
}
} // namespace
bool begin_card(const char * id, const ImVec2 &)
{
return begin_card_impl(id, metrics::card_padding);
}
bool begin_list_card(const char * id)
{
return begin_card_impl(id, metrics::list_card_padding);
}
void end_card()
{
@@ -136,12 +150,12 @@ void end_card()
card_stack.pop_back();
ImGui::EndGroup();
ImGui::Unindent(metrics::card_padding.x);
ImGui::Unindent(cf.padding.x);
window->ContentRegionRect.Max.x = cf.content_max_x_backup;
window->WorkRect.Max.x = cf.work_max_x_backup;
ImGui::PopID();
const float height = ImGui::GetItemRectMax().y + metrics::card_padding.y - cf.origin.y;
const float height = ImGui::GetItemRectMax().y + cf.padding.y - cf.origin.y;
card_heights[cf.id] = height;
// reserve the full card extent so layout and scrolling account for it
@@ -152,7 +166,9 @@ void end_card()
void row_separator()
{
const theme & t = current();
ImGui::PushStyleColor(ImGuiCol_Separator, t.border);
ImVec4 edge = t.border;
edge.w *= t.background_alpha; // match the panel/card opacity
ImGui::PushStyleColor(ImGuiCol_Separator, edge);
ImGui::Separator();
ImGui::PopStyleColor();
}
@@ -391,6 +407,70 @@ bool icon_button(const char * icon, const ImVec2 & size_arg, bool active, const
return pressed;
}
bool cancel_progress_button(const char * id, float fraction, const ImVec2 & size_arg, const std::string & tooltip)
{
ImGuiWindow * window = ImGui::GetCurrentWindow();
if (window->SkipItems)
return false;
ImGuiContext & g = *GImGui;
const theme & t = current();
const float side = ImGui::GetFrameHeight() * metrics::control_height;
const ImVec2 size = size_arg.x > 0 ? size_arg : ImVec2{side, side};
const ImVec2 pos = window->DC.CursorPos;
const ImRect bb(pos, pos + size);
ImGui::ItemSize(bb, g.Style.FramePadding.y);
const ImGuiID gid = window->GetID(id);
if (not ImGui::ItemAdd(bb, gid))
return false;
bool hovered, held;
const bool pressed = ImGui::ButtonBehavior(bb, gid, &hovered, &held);
hover_haptic();
if (hovered)
show_tooltip(tooltip);
ImDrawList * draw = window->DrawList;
const ImVec2 center = bb.GetCenter();
const float thickness = ImMax(2.f, size.y * 0.09f);
const float radius = ImMin(size.x, size.y) * 0.5f - thickness;
// faint full ring as the track
draw->PathArcTo(center, radius, 0, 2 * IM_PI, 48);
draw->PathStroke(t.col(t.control), ImDrawFlags_None, thickness);
const ImU32 accent = t.col(t.accent);
if (fraction >= 0)
{
// determinate arc, clockwise from the top
const float a0 = -IM_PI * 0.5f;
draw->PathArcTo(center, radius, a0, a0 + ImClamp(fraction, 0.f, 1.f) * 2 * IM_PI, 48);
draw->PathStroke(accent, ImDrawFlags_None, thickness);
}
else
{
// indeterminate: a rotating quarter arc
const float a0 = (float)g.Time * 3.5f;
draw->PathArcTo(center, radius, a0, a0 + IM_PI * 0.5f, 24);
draw->PathStroke(accent, ImDrawFlags_None, thickness);
}
// stop glyph in the centre, brightening on hover to read as a cancel target
const float glyph_size = size.y * metrics::icon_button_glyph * 0.7f;
ImGui::PushFont(nullptr, glyph_size);
const ImU32 col = t.col(hovered or held ? t.text : t.text_muted);
unsigned int codepoint = 0;
ImTextCharFromUtf8(&codepoint, ICON_FA_STOP, nullptr);
const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph((ImWchar)codepoint);
if (glyph)
draw->AddText({center.x - (glyph->X0 + glyph->X1) * 0.5f, center.y - (glyph->Y0 + glyph->Y1) * 0.5f}, col, ICON_FA_STOP);
ImGui::PopFont();
return pressed;
}
// Horizontal space a trailing reset slot consumes, gap included
float reset_slot_width()
{
@@ -891,21 +971,35 @@ bool nav_item(const char * icon, const std::string & label, bool selected)
hover_haptic();
ImDrawList * draw = window->DrawList;
// Subtle accent tint at a fixed alpha so the highlight reads the same in every
// theme, instead of the per-theme control surface whose contrast varies.
ImVec4 bg = t.accent;
bg.w = selected ? 0.16f : (hovered ? 0.08f : 0);
if (bg.w > 0)
draw->AddRectFilled(bb.Min, bb.Max, t.col(bg), t.rounding);
const float lum = t.background.x * 0.299f + t.background.y * 0.587f + t.background.z * 0.114f;
if (selected)
{
// Pure accent fill for the active tab.
draw->AddRectFilled(bb.Min, bb.Max, t.col(t.accent), t.rounding);
}
else if (hovered)
{
// Subtle lighten on dark themes, darken on light ones. The framebuffer
// blends in linear light, so a fixed alpha would look far stronger on a
// dark surface than a light one. Solve for the alpha that yields a constant
// *perceived* (gamma-space) step instead.
const float step = lum < 0.5f ? 0.10f : 0.06f; // perceptual lightness delta; stronger on dark
auto to_linear = [](float c) { return c <= 0.04045f ? c / 12.92f : std::pow((c + 0.055f) / 1.055f, 2.4f); };
const float overlay = lum < 0.5f ? 1.f : 0.f; // lighten vs darken
const float ys = to_linear(lum);
const float yt = to_linear(std::clamp(lum + (overlay - lum) / std::abs(overlay - lum) * step, 0.f, 1.f));
const float a = (yt - ys) / (overlay - ys);
draw->AddRectFilled(bb.Min, bb.Max, t.col({overlay, overlay, overlay, a}), t.rounding);
}
const float pad = metrics::combo_padding.x;
const float icon_w = ImGui::GetFontSize() * 1.5f; // icon column
const ImVec2 its = ImGui::CalcTextSize(icon);
draw->AddText({bb.Min.x + pad + (icon_w - its.x) * 0.5f, bb.Min.y + (h - its.y) * 0.5f}, t.col(selected ? t.accent : t.text_muted), icon);
draw->AddText({bb.Min.x + pad + (icon_w - its.x) * 0.5f, bb.Min.y + (h - its.y) * 0.5f}, t.col(selected ? t.on_accent : t.text_muted), icon);
const ImVec2 ls = ImGui::CalcTextSize(label.c_str());
draw->AddText({bb.Min.x + pad + icon_w + pad * 0.5f, bb.Min.y + (h - ls.y) * 0.5f}, t.col(t.text), label.c_str());
draw->AddText({bb.Min.x + pad + icon_w + pad * 0.5f, bb.Min.y + (h - ls.y) * 0.5f}, t.col(selected ? t.on_accent : t.text), label.c_str());
return pressed;
}
@@ -1070,7 +1164,7 @@ namespace
std::vector<ImVec2> list_row_after; // cursor to restore at end_list_row
}
list_row_result begin_list_row(const char * id, const char * icon, ImTextureID image, const std::string & title, const std::string & subtitle, bool selected, float trailing_width, float height)
list_row_result begin_list_row(const char * id, const char * icon, ImTextureID image, const std::string & title, const std::string & subtitle, bool selected, float trailing_width, float height, bool large_thumb, bool interactive)
{
ImGuiWindow * window = ImGui::GetCurrentWindow();
const theme & t = current();
@@ -1078,7 +1172,7 @@ list_row_result begin_list_row(const char * id, const char * icon, ImTextureID i
// measure title + (possibly multi-line) subtitle so the row can auto-size
const float pad = metrics::list_row_pad;
const float box = metrics::list_row_box;
const float box = large_thumb ? metrics::list_row_box_large : metrics::list_row_box;
const ImVec2 ts = ImGui::CalcTextSize(title.c_str());
ImVec2 sub_sz{0, 0};
if (not subtitle.empty())
@@ -1092,23 +1186,32 @@ list_row_result begin_list_row(const char * id, const char * icon, ImTextureID i
const ImVec2 p0 = window->DC.CursorPos;
const float avail = ImGui::GetContentRegionAvail().x;
// the click area excludes the trailing controls so they receive their own clicks
ImGui::SetNextItemAllowOverlap();
const bool clicked = ImGui::InvisibleButton(id, {ImMax(avail - trailing_width, 1.f), row_h});
const bool hovered = ImGui::IsItemHovered();
hover_haptic();
// non-interactive rows (the body does nothing, only trailing controls act) just reserve
// layout space -- no click area and no hover highlight on the row itself
bool clicked = false;
if (interactive)
{
// the click area excludes the trailing controls so they receive their own clicks
ImGui::SetNextItemAllowOverlap();
clicked = ImGui::InvisibleButton(id, {ImMax(avail - trailing_width, 1.f), row_h});
hover_haptic();
}
else
ImGui::Dummy({avail, row_h});
const bool hovered = interactive and ImGui::IsItemHovered();
list_row_after.push_back(window->DC.CursorPos);
ImDrawList * draw = window->DrawList;
const ImRect bb(p0, p0 + ImVec2(avail, row_h));
if (selected)
draw->AddRectFilled(bb.Min, bb.Max, t.col({t.accent.x, t.accent.y, t.accent.z, 0.16f}), t.card_rounding);
else if (hovered)
// No tinted background for the selected row -- callers indicate the active item with a
// chip instead. Still show the hover highlight.
if (hovered)
draw->AddRectFilled(bb.Min, bb.Max, t.col(t.control), t.card_rounding);
// leading thumbnail or icon box
const ImVec2 box_min = {p0.x + pad, p0.y + (row_h - box) * 0.5f};
const ImVec2 box_max = box_min + ImVec2(box, box);
// leading thumbnail or icon box; large_thumb spans the full row height
const float thumb = large_thumb ? row_h - 2 * pad : box;
const ImVec2 box_min = {p0.x + pad, p0.y + (row_h - thumb) * 0.5f};
const ImVec2 box_max = box_min + ImVec2(thumb, thumb);
if (image)
draw->AddImageRounded(image, box_min, box_max, {0, 0}, {1, 1}, IM_COL32_WHITE, t.rounding);
else
@@ -1117,7 +1220,7 @@ list_row_result begin_list_row(const char * id, const char * icon, ImTextureID i
if (icon and icon[0])
{
const ImVec2 is = ImGui::CalcTextSize(icon);
draw->AddText(box_min + (ImVec2(box, box) - is) * 0.5f, t.col(selected ? t.on_accent : t.text_muted), icon);
draw->AddText(box_min + (ImVec2(thumb, thumb) - is) * 0.5f, t.col(selected ? t.on_accent : t.text_muted), icon);
}
}
+12 -1
View File
@@ -42,6 +42,8 @@ void page_header(const std::string & title, const std::string & subtitle = {});
// Rounded panel, pair with end_card
bool begin_card(const char * id, const ImVec2 & size = {0, 0});
// Same, but with tighter padding for cards that hold a list of rows
bool begin_list_card(const char * id);
void end_card();
// Full-width divider between rows of a card
@@ -71,6 +73,11 @@ bool button(const char * icon, const std::string & label, button_style style = b
// tooltip, if not empty, is shown while hovered
bool icon_button(const char * icon, const ImVec2 & size = {0, 0}, bool active = false, const std::string & tooltip = {});
// Circular download-progress indicator with a cancel (stop) glyph in the centre.
// fraction in [0,1] draws a determinate ring; < 0 draws an indeterminate spinner.
// Returns true when clicked (i.e. cancel requested). Sized like icon_button by default.
bool cancel_progress_button(const char * id, float fraction, const ImVec2 & size = {0, 0}, const std::string & tooltip = {});
bool toggle(const char * id, bool * v, const bool * default_value = nullptr);
// Width a trailing reset slot consumes (gap + square), for laying out toggles
@@ -161,7 +168,11 @@ struct list_row_result
// trailing_width reserves space on the right for trailing controls and excludes it from
// the row's click area. Place controls right-aligned at .max with SetCursorScreenPos,
// then call end_list_row().
list_row_result begin_list_row(const char * id, const char * icon, ImTextureID image, const std::string & title, const std::string & subtitle, bool selected = false, float trailing_width = 0, float height = 0);
// large_thumb makes the leading thumbnail/icon box span the full row height (icon boxes
// keep their background at that same size).
// interactive=false reserves layout only -- no row-body click area and no hover highlight,
// for rows whose body does nothing (only trailing controls act).
list_row_result begin_list_row(const char * id, const char * icon, ImTextureID image, const std::string & title, const std::string & subtitle, bool selected = false, float trailing_width = 0, float height = 0, bool large_thumb = false, bool interactive = true);
void end_list_row();
// Confirmation dialog (open with ImGui::OpenPopup(id)). Returns 1 if confirmed, -1 if
+8 -4
View File
@@ -390,7 +390,7 @@ void scenes::lobby::gui_server_list()
bool open_delete = false;
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ui::metrics::card_item_spacing);
ui::begin_card("##servers");
ui::begin_list_card("##servers");
{
if (sorted_cookies.empty())
{
@@ -471,7 +471,8 @@ void scenes::lobby::gui_server_list()
if (ui::button(c_label, reachable ? ui::button_style::primary : ui::button_style::secondary, {cw, 0}))
{
connect(data);
ImGui::OpenPopup("connecting");
// connecting popup is opened at window scope below (NOT here:
// inside begin_card PushID the id would not match BeginPopupModal -> orphaned popup)
}
if (not c_tooltip.empty() and ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
imgui_ctx->tooltip(c_tooltip);
@@ -1376,8 +1377,11 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
}
ImGui::PopStyleColor(); // ImGuiCol_ChildBg
// hairline dividers separating the top bar, sidebar and main panel
const ImU32 divider = ImGui::GetColorU32(wivrn::ui::current().border);
// hairline dividers separating the top bar, sidebar and main panel,
// following the panel opacity so they dim with the background
ImVec4 divider_col = wivrn::ui::current().border;
divider_col.w *= wivrn::ui::current().background_alpha;
const ImU32 divider = ImGui::GetColorU32(divider_col);
const ImVec2 win_pos = ImGui::GetWindowPos();
const ImVec2 win_size = ImGui::GetWindowSize();
ImDrawList * dl = ImGui::GetWindowDrawList();
+26 -30
View File
@@ -430,7 +430,7 @@ scenes::lobby::environment_item_action scenes::lobby::environment_item(environme
else if (transferring or (local and not model.builtin))
trailing = bh + ui::metrics::list_row_pad;
const auto row = ui::begin_list_row("##env", icon, model.screenshot, title, subtitle, selected, trailing);
const auto row = ui::begin_list_row("##env", icon, model.screenshot, title, subtitle, selected, trailing, 0, true);
if (row.clicked and not selected)
action = local ? environment_item_action::use_model : environment_item_action::download_model;
@@ -443,8 +443,10 @@ scenes::lobby::environment_item_action scenes::lobby::environment_item(environme
}
else if (transferring)
{
const int64_t total = handle->get_content_length() > 0 ? handle->get_content_length() : model.size;
const float fraction = total > 0 ? float(handle->get_progress()) / float(total) : -1.f;
ImGui::SetCursorScreenPos(row.trailing(x, {bh, bh}));
if (ui::icon_button(ICON_FA_STOP, {bh, bh}, false, _S("Cancel")))
if (ui::cancel_progress_button("##cancel", fraction, {bh, bh}, _S("Cancel")))
handle->cancel();
}
else if (local and not model.builtin)
@@ -650,40 +652,42 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ui::metrics::card_item_spacing);
ui::begin_card("##environments");
ui::begin_list_card("##environments");
environment_list(local_environments, false);
ui::end_card();
// Get more environments
ui::begin_card("##get_more");
bool open_download_popup = false;
ui::begin_list_card("##get_more");
{
const float bh = ImGui::GetFrameHeight() * ui::metrics::control_height;
const std::string browse = ui::icon_label(ICON_FA_UP_RIGHT_FROM_SQUARE, _("Browse"));
const float bw = ui::button_width(browse);
const auto row = ui::begin_list_row("##getmore", ICON_FA_IMAGES, 0, _S("Get more environments"), _S("Download community-made spaces from the WiVRn dashboard on your PC."), false, bw + ui::metrics::list_row_pad);
const auto row = ui::begin_list_row("##getmore", ICON_FA_IMAGES, 0, _S("Get more environments"), _S("Download community-made spaces from the WiVRn dashboard on your PC."), false, bw + ui::metrics::list_row_pad, 0, false, false);
ImGui::SetCursorScreenPos(row.trailing(row.max.x, {bw, bh}));
if (ui::button(browse, ui::button_style::secondary, {bw, 0}))
{
download_environment_list();
ImGui::OpenPopup("download environment model");
open_download_popup = true;
}
ui::end_list_row();
ui::end_card();
}
// OpenPopup must run at the same ID-stack level as BeginPopupModal below;
// begin_card pushes an ID, so defer the call until after end_card.
if (open_download_popup)
ImGui::OpenPopup("download environment model");
if (ui::button(_S("Open local glTF model"), ui::button_style::secondary))
lobby_file_picker_future = lobby_file_picker.open();
ImGui::SetNextWindowPos(imgui_ctx->layers()[1].vp_center(), ImGuiCond_Always, {0.5f, 0.5f});
ImGui::SetNextWindowSize({1200, 900});
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, constants::style::window_rounding);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, constants::style::window_border_size);
if (ImGui::BeginPopupModal("download environment model", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize))
if (ui::begin_modal("download environment model", _S("Browse environments"), 1200))
{
auto close = _("Close");
auto close_size = ImGui::CalcTextSize(close.c_str());
const float side = ImGui::GetFrameHeight() * ui::metrics::control_height;
const float list_h = 760;
ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, close_size.y + 80) /*, ImGuiChildFlags_AlwaysUseWindowPadding*/);
ImGui::BeginChild("Main", {0, list_h});
auto index_transfer = parse_environment_list();
switch (index_transfer ? index_transfer->get_state() : libcurl::state::reset)
@@ -718,38 +722,30 @@ void scenes::lobby::gui_customize(XrTime predicted_display_time)
CenterTextHV(downloadable_environment_list_status);
ImGui::Dummy({0, constants::gui::font_size_large});
ImGui::PushFont(nullptr, constants::gui::font_size_large);
ImGui::PushStyleColor(ImGuiCol_Button, 0);
ImGui::SetCursorPosX((ImGui::GetWindowSize().x - ImGui::CalcTextSize(ICON_FA_ROTATE).x) / 2 - ImGui::GetStyle().FramePadding.x);
if (ImGui::Button(ICON_FA_ROTATE))
ImGui::SetCursorPosX((ImGui::GetWindowSize().x - side) / 2);
if (ui::icon_button(ICON_FA_ROTATE, {side, side}, false, _("Refresh")))
download_environment_list();
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleColor(); // ImGuiCol_Button
ImGui::PopFont();
}
}
ScrollWhenDragging();
ImGui::EndChild();
ImGui::SetCursorPos(ImGui::GetWindowSize() - close_size - ImVec2{50, 50});
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.1f, 0.1f, 1.00f));
if (ImGui::Button(_S("Close")))
ImGui::Dummy({0, ImGui::GetStyle().ItemSpacing.y});
const std::string close = _S("Close");
const float cw = ui::button_width(close);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - cw);
if (ui::button(close, ui::button_style::secondary, {cw, 0}))
ImGui::CloseCurrentPopup();
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleColor(3); // ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_ButtonActive
popup_load_environment(predicted_display_time);
ImGui::EndPopup();
ui::end_modal();
}
else
{
popup_load_environment(predicted_display_time);
}
ImGui::PopStyleVar(2); // ImGuiStyleVar_WindowRounding, ImGuiStyleVar_WindowBorderSize
// if (ImGui::RadioButton(_S("Custom environment"), not config.passthrough_enabled and config.environment_model_uri != ""))
// lobby_file_picker_future = lobby_file_picker.open();