[studio] Cleanup

This commit is contained in:
Gary Talent 2025-01-20 00:16:16 -06:00
parent 7b638538aa
commit d54e93d836

View File

@ -39,13 +39,15 @@ void NewDir::draw(StudioContext &ctx) noexcept {
case Stage::Opening: case Stage::Opening:
ImGui::OpenPopup(title().c_str()); ImGui::OpenPopup(title().c_str());
m_open = true; m_open = true;
m_stage = Stage::Open;
[[fallthrough]]; [[fallthrough]];
case Stage::Open: case Stage::Open:
drawWindow(ctx.tctx, m_open, [this] { drawWindow(ctx.tctx, m_open, [this] {
if (m_stage == Stage::Opening) { if (ImGui::IsWindowAppearing()) {
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();
} }
ig::InputText("Name", m_str); ig::InputText("Name", m_str);
ImGui::SetItemDefaultFocus();
if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) { if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) {
newDir.emit(m_path + "/" + m_str); newDir.emit(m_path + "/" + m_str);
close(); close();
@ -55,7 +57,6 @@ void NewDir::draw(StudioContext &ctx) noexcept {
close(); close();
} }
}); });
m_stage = Stage::Open;
break; break;
} }
} }