Commit 2793c9cfb0af642aabf0f83700a84e441b2ca035

Cameron Gutman 2021-01-25T18:40:26

Fix grabbing Alt+Tab and Alt+Esc on Windows 7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index ef64031..87878dd 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -457,6 +457,15 @@ WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
     case VK_RCONTROL:
         scanCode = SDL_SCANCODE_RCTRL;
         break;
+
+    /* These are required to intercept Alt+Tab and Alt+Esc on Windows 7 */
+    case VK_TAB:
+        scanCode = SDL_SCANCODE_TAB;
+        break;
+    case VK_ESCAPE:
+        scanCode = SDL_SCANCODE_ESCAPE;
+        break;
+
     default:
         return CallNextHookEx(NULL, nCode, wParam, lParam);
     }