mirror of https://github.com/WerWolv/ImHex.git
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");
|
ImGui::OpenPopup("##hex_editor_popup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool justOpened = true;
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding, ImGuiCond_Appearing);
|
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding, ImGuiCond_Appearing);
|
||||||
if (ImGui::BeginPopup("##hex_editor_popup", ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize |ImGuiWindowFlags_NoTitleBar)) {
|
if (ImGui::BeginPopup("##hex_editor_popup", ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize |ImGuiWindowFlags_NoTitleBar)) {
|
||||||
// Force close the popup when user is editing an input
|
// Force close the popup when user is editing an input
|
||||||
|
@ -549,6 +551,11 @@ namespace hex::plugin::builtin {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (justOpened) {
|
||||||
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
justOpened = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->m_currPopup != nullptr)
|
if (this->m_currPopup != nullptr)
|
||||||
this->m_currPopup->draw(this);
|
this->m_currPopup->draw(this);
|
||||||
else
|
else
|
||||||
|
@ -557,6 +564,7 @@ namespace hex::plugin::builtin {
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
} else {
|
} else {
|
||||||
this->closePopup();
|
this->closePopup();
|
||||||
|
justOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right click menu
|
// Right click menu
|
||||||
|
|
Loading…
Reference in New Issue