Fix the last frame before not showing overlay

The last frame was sending inputs to the game window, making the game receive a <TAB>.
merge-requests/28/head
Nemirtingas 2019-08-18 17:49:47 +02:00
parent ca0ef4380a
commit 3c83e08d34
1 changed files with 6 additions and 1 deletions

View File

@ -91,6 +91,7 @@ bool IgnoreMsg(UINT uMsg)
LRESULT CALLBACK Windows_Hook::HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK Windows_Hook::HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
Steam_Overlay* overlay = get_steam_client()->steam_overlay; Steam_Overlay* overlay = get_steam_client()->steam_overlay;
bool show = overlay->ShowOverlay();
// Is the event is a key press // Is the event is a key press
if (uMsg == WM_KEYDOWN) if (uMsg == WM_KEYDOWN)
{ {
@ -99,11 +100,15 @@ LRESULT CALLBACK Windows_Hook::HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
{ {
// If Left Shift is pressed // If Left Shift is pressed
if (GetAsyncKeyState(VK_LSHIFT) & (1 << 15)) if (GetAsyncKeyState(VK_LSHIFT) & (1 << 15))
{
overlay->ShowOverlay(!overlay->ShowOverlay()); overlay->ShowOverlay(!overlay->ShowOverlay());
if (overlay->ShowOverlay())
show = true;
}
} }
} }
if (overlay->ShowOverlay()) if (show)
{ {
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
if (IgnoreMsg(uMsg)) if (IgnoreMsg(uMsg))