Dim rounded windows correctly
This commit is contained in:
@@ -934,6 +934,28 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
}
|
||||
}
|
||||
|
||||
if (auto modal_popup = ImGui::GetTopMostAndVisiblePopupModal(); modal_popup != nullptr)
|
||||
{
|
||||
ImDrawList * draw_list = ImGui::GetForegroundDrawList();
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
if (window == modal_popup or window->ParentWindow != nullptr or not window->Active or window->Hidden or window->IsFallbackWindow)
|
||||
continue;
|
||||
|
||||
static const auto virtual_keyboard_id = ImHashStr("VirtualKeyboard");
|
||||
if (window->ID == virtual_keyboard_id)
|
||||
continue;
|
||||
|
||||
ImRect window_rect{
|
||||
window->Pos.x,
|
||||
window->Pos.y,
|
||||
window->Pos.x + window->Size.x,
|
||||
window->Pos.y + window->Size.y};
|
||||
|
||||
draw_list->AddRectFilled(window_rect.Min, window_rect.Max, ImGui::ColorConvertFloat4ToU32(wivrn::ui::current().dimming), window->WindowRounding);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
current_command_buffer = (current_command_buffer + 1) % command_buffers.size();
|
||||
|
||||
@@ -53,6 +53,8 @@ static theme dark_default()
|
||||
t.success = rgb(52, 199, 123);
|
||||
t.warning = rgb(249, 115, 6);
|
||||
|
||||
t.dimming = rgb(128, 128, 128, 0.5f);
|
||||
|
||||
t.rounding = 8;
|
||||
t.card_rounding = 14;
|
||||
t.border_size = 1;
|
||||
|
||||
@@ -55,6 +55,9 @@ struct theme
|
||||
ImVec4 success;
|
||||
ImVec4 warning;
|
||||
|
||||
// Dimming when a modal popup is visible
|
||||
ImVec4 dimming;
|
||||
|
||||
// Shape, in pixels
|
||||
float rounding; // buttons, inputs, sliders
|
||||
float card_rounding; // cards
|
||||
|
||||
Reference in New Issue
Block a user