1
0
mirror of synced 2024-11-24 07:40:17 +01:00

impr: Make sure shortcuts can't be used when popups are open

This commit is contained in:
WerWolv 2023-03-31 11:07:53 +02:00
parent 173ed5475c
commit 722f6315c4

View File

@ -539,6 +539,8 @@ namespace hex {
void Window::frame() {
auto &io = ImGui::GetIO();
const bool popupOpen = ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId);
// Loop through all views and draw them
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
ImGui::GetCurrentContext()->NextWindowData.ClearFlags();
@ -557,7 +559,7 @@ namespace hex {
}
// Handle per-view shortcuts
if (view->getWindowOpenState()) {
if (view->getWindowOpenState() && !popupOpen) {
auto window = ImGui::FindWindowByName(view->getName().c_str());
bool hasWindow = window != nullptr;
bool focused = false;
@ -578,8 +580,10 @@ namespace hex {
}
// Handle global shortcuts
for (const auto &key : this->m_pressedKeys) {
ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key);
if (!popupOpen) {
for (const auto &key : this->m_pressedKeys) {
ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key);
}
}
this->m_pressedKeys.clear();