Skip to content

Commit 0b8ccd8

Browse files
committed
Change menu toggle key behavior
1 parent 14c3448 commit 0b8ccd8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Hooking.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,11 @@ LRESULT hooked_RegularWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
712712

713713
if (msg == WM_KEYUP && wparam == VK_F8)
714714
{
715-
// set menu focus
716-
Hooking::GetInstance().GetMenu()->SetFocus(!Hooking::GetInstance().GetMenu()->IsFocus());
715+
auto focus = menu->IsFocus();
717716

718-
// show menu if hidden
719-
if (!menu->IsVisible())
720-
{
721-
menu->SetVisibility(true);
722-
}
717+
// set menu focus
718+
menu->SetFocus(!focus);
719+
menu->SetVisibility(!focus);
723720

724721
// disable game input
725722
#if TRAE

Menu.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ void Menu::Process(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
348348
if (msg == WM_KEYUP && wparam == VK_F7)
349349
{
350350
m_visible = !m_visible;
351+
352+
// if menu is focussed and being hidden also stop focus
353+
if (m_focus && !m_visible)
354+
{
355+
m_focus = false;
356+
}
351357
}
352358

353359
if (msg == WM_KEYUP && wparam == VK_F5)

0 commit comments

Comments
 (0)