diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index 06cca318..a0c24ab3 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -50,15 +50,18 @@ void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept return; } if (ig::BeginPopup(tctx, "Rename Page", m_show)) { + if (ImGui::IsWindowAppearing()) { + ImGui::SetKeyboardFocusHere(); + } ig::InputText("Name", m_name); - switch (ig::PopupControlsOkCancel(m_show)) { - case ig::PopupResponse::OK: - inputSubmitted.emit(m_name); - [[fallthrough]]; - case ig::PopupResponse::Cancel: - close(); - default: - break; + auto const nameInputFocused = ImGui::IsItemFocused(); + auto const resp = ig::PopupControlsOkCancel(m_show); + if ((nameInputFocused && ImGui::IsKeyPressed(ImGuiKey_Enter)) + || resp == ig::PopupResponse::OK) { + inputSubmitted.emit(m_name); + close(); + } else if (resp == ig::PopupResponse::Cancel) { + close(); } ImGui::EndPopup(); }