[nostalgia,studio] Proper fix for input filtering

This commit is contained in:
Gary Talent 2025-01-20 02:10:48 -06:00
parent 48e45c7dd6
commit 6170647c0c
4 changed files with 14 additions and 2 deletions

View File

@ -258,8 +258,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
std::ignore = pushCommand<ApplyColorAllPagesCommand>( std::ignore = pushCommand<ApplyColorAllPagesCommand>(
m_pal, m_page, m_selectedColorRow); m_pal, m_page, m_selectedColorRow);
} }
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow) && if (ig::mainWinHasFocus()) {
!inputFocused && !m_pageRenameDlg.isOpen()) {
if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) { if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) {
numShortcuts(m_selectedColorRow, largestPage(m_pal)); numShortcuts(m_selectedColorRow, largestPage(m_pal));
} else { } else {

View File

@ -18,6 +18,9 @@
namespace studio { namespace studio {
namespace ig {
extern bool s_mainWinHasFocus;
}
static ox::Vector<Module const*> modules; static ox::Vector<Module const*> modules;
void registerModule(Module const*mod) noexcept { void registerModule(Module const*mod) noexcept {
@ -114,6 +117,8 @@ void StudioUI::draw() noexcept {
ImGuiWindowFlags_NoSavedSettings; ImGuiWindowFlags_NoSavedSettings;
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags); ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
{ {
ig::s_mainWinHasFocus = ImGui::IsWindowFocused(
ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy);
if (m_showProjectExplorer) { if (m_showProjectExplorer) {
m_projectExplorer.draw(m_sctx); m_projectExplorer.draw(m_sctx);
ImGui::SameLine(); ImGui::SameLine();

View File

@ -256,4 +256,7 @@ class FilePicker {
}; };
[[nodiscard]]
bool mainWinHasFocus() noexcept;
} }

View File

@ -208,4 +208,9 @@ void FilePicker::show() noexcept {
m_show = true; m_show = true;
} }
bool s_mainWinHasFocus{};
bool mainWinHasFocus() noexcept {
return s_mainWinHasFocus;
}
} }