[nostalgia/gfx/studio/palette] Make page rename dialog accept on enter if input focused
All checks were successful
Build / build (push) Successful in 1m19s
All checks were successful
Build / build (push) Successful in 1m19s
This commit is contained in:
parent
b8d7658626
commit
640ac85de4
@ -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:
|
||||
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);
|
||||
[[fallthrough]];
|
||||
case ig::PopupResponse::Cancel:
|
||||
close();
|
||||
default:
|
||||
break;
|
||||
} else if (resp == ig::PopupResponse::Cancel) {
|
||||
close();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user