impr: Make sure shortcuts can't be used when popups are open
This commit is contained in:
parent
173ed5475c
commit
722f6315c4
@ -539,6 +539,8 @@ namespace hex {
|
|||||||
void Window::frame() {
|
void Window::frame() {
|
||||||
auto &io = ImGui::GetIO();
|
auto &io = ImGui::GetIO();
|
||||||
|
|
||||||
|
const bool popupOpen = ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId);
|
||||||
|
|
||||||
// Loop through all views and draw them
|
// Loop through all views and draw them
|
||||||
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
|
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||||
ImGui::GetCurrentContext()->NextWindowData.ClearFlags();
|
ImGui::GetCurrentContext()->NextWindowData.ClearFlags();
|
||||||
@ -557,7 +559,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle per-view shortcuts
|
// Handle per-view shortcuts
|
||||||
if (view->getWindowOpenState()) {
|
if (view->getWindowOpenState() && !popupOpen) {
|
||||||
auto window = ImGui::FindWindowByName(view->getName().c_str());
|
auto window = ImGui::FindWindowByName(view->getName().c_str());
|
||||||
bool hasWindow = window != nullptr;
|
bool hasWindow = window != nullptr;
|
||||||
bool focused = false;
|
bool focused = false;
|
||||||
@ -578,9 +580,11 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle global shortcuts
|
// Handle global shortcuts
|
||||||
|
if (!popupOpen) {
|
||||||
for (const auto &key : this->m_pressedKeys) {
|
for (const auto &key : this->m_pressedKeys) {
|
||||||
ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key);
|
ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->m_pressedKeys.clear();
|
this->m_pressedKeys.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user