SDL: Update the focus in case we changed focus to a child window and then away from the application

From 2248a549375b5cbe5d04a9792baca9d7b780afaf Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 5 Nov 2021 22:48:46 -0700
Subject: [PATCH] Update the focus in case we changed focus to a child window
 and then away from the application

In this case we'll get WM_KILLFOCUS when the child window is focused, but we'll retain focus on the top level window, but when we Alt-Tab away, we won't get another WM_KILLFOCUS or WM_NCACTIVATE, we get WM_ACTIVATE instead, so we need to check for focus updates in response to that as well.
---
 src/video/windows/SDL_windowsevents.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 24765fd21c..d5ffaecd97 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -685,13 +685,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
     case WM_ACTIVATE:
         {
+            /* Update the focus in case we changed focus to a child window and then away from the application */
+            WIN_UpdateFocus(data->window);
         }
         break;
 
     case WM_SETFOCUS:
     case WM_KILLFOCUS:
         {
-            /* Update the focus in case it's changing between windows in the same application */
+            /* Update the focus in case it's changing between top-level windows in the same application */
             WIN_UpdateFocus(data->window);
         }
         break;