impr: Make sure hex editor popups have their input focused
This commit is contained in:
parent
180a27fdc9
commit
6dbaac4283
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user