From 96d0204f300527e1e690306b811996b3144d5412 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Tue, 18 Jun 2013 14:32:08 +0200 Subject: [PATCH] Pressing ALT or F10 on Windows no longer steals the focus --- src/SFML/Window/Win32/WindowImplWin32.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index cd45915c8..e98cd037d 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -899,6 +899,10 @@ LRESULT CALLBACK WindowImplWin32::globalOnEvent(HWND handle, UINT message, WPARA if (message == WM_CLOSE) return 0; + // Don't forward the menu system command, so that pressing ALT or F10 doesn't steal the focus + if ((message == WM_SYSCOMMAND) && (wParam == SC_KEYMENU)) + return 0; + static const bool hasUnicode = hasUnicodeSupport(); return hasUnicode ? DefWindowProcW(handle, message, wParam, lParam) : DefWindowProcA(handle, message, wParam, lParam);