fix: Start fixing shortcuts on welcome screen. Breaks certain shortcuts still

This commit is contained in:
WerWolv
2026-01-23 00:07:34 +01:00
parent 96a5a5d34c
commit 810955b1be
4 changed files with 46 additions and 19 deletions

View File

@@ -728,13 +728,13 @@ namespace hex {
view->trackViewState();
// Skip views that shouldn't be processed currently
if (!view->shouldProcess())
if (!view->shouldProcess() || !view->getWindowOpenState())
continue;
const auto openViewCount = std::ranges::count_if(ContentRegistry::Views::impl::getEntries(), [](const auto &entry) {
const auto &[unlocalizedName, openView] = entry;
return openView->hasViewMenuItemEntry() && openView->shouldProcess();
return openView->hasViewMenuItemEntry() && openView->shouldDraw();
});
ImGuiWindowClass windowClass = {};
@@ -758,6 +758,19 @@ namespace hex {
// Draw view
view->draw();
// Handle view shortcuts
for (const auto &key : m_pressedKeys) {
ShortcutManager::process(
view.get(),
io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl,
io.KeyAlt,
io.KeyShift,
io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeySuper,
view.get() == View::getLastFocusedView(),
key
);
}
// If the window was just opened, it wasn't found above, so try to find it again
if (window == nullptr)
window = ImGui::FindWindowByName(view->getName().c_str());
@@ -793,10 +806,6 @@ namespace hex {
// Pass on currently pressed keys to the shortcut handler
if (!windowIsPopup) {
for (const auto &key : m_pressedKeys) {
ShortcutManager::process(view.get(), io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl, io.KeyAlt, io.KeyShift, io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeySuper, focused, key);
}
ImGui::End();
}
} else if (view->didWindowJustClose()) {
@@ -808,7 +817,13 @@ namespace hex {
// Handle global shortcuts
for (const auto &key : m_pressedKeys) {
ShortcutManager::processGlobals(io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl, io.KeyAlt, io.KeyShift, io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeySuper, key);
ShortcutManager::processGlobals(
io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl,
io.KeyAlt,
io.KeyShift,
io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeySuper,
key
);
}
m_pressedKeys.clear();