1
0
mirror of synced 2024-11-12 10:10:53 +01:00

impr: Make sure hex editor popups have their input focused

This commit is contained in:
WerWolv 2023-05-21 10:35:14 +02:00
parent 180a27fdc9
commit 6dbaac4283

View File

@ -542,6 +542,8 @@ namespace hex::plugin::builtin {
ImGui::OpenPopup("##hex_editor_popup");
}
static bool justOpened = true;
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding, ImGuiCond_Appearing);
if (ImGui::BeginPopup("##hex_editor_popup", ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize |ImGuiWindowFlags_NoTitleBar)) {
// Force close the popup when user is editing an input
@ -549,6 +551,11 @@ namespace hex::plugin::builtin {
ImGui::CloseCurrentPopup();
}
if (justOpened) {
ImGui::SetKeyboardFocusHere();
justOpened = false;
}
if (this->m_currPopup != nullptr)
this->m_currPopup->draw(this);
else
@ -557,6 +564,7 @@ namespace hex::plugin::builtin {
ImGui::EndPopup();
} else {
this->closePopup();
justOpened = true;
}
// Right click menu