Add SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS.

(cherry picked from commit 232ed540db)
This commit is contained in:
Rudolf-Walter Kiss-Szakacs
2022-12-02 07:22:31 +02:00
committed by Sam Lantinga
parent 927c4d4aa4
commit cc7b6f9e49
4 changed files with 37 additions and 12 deletions

View File

@@ -1357,8 +1357,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSCOMMAND:
{
if ((wParam & 0xFFF0) == SC_KEYMENU) {
return 0;
if (!g_WindowsEnableMenuMnemonics) {
if ((wParam & 0xFFF0) == SC_KEYMENU) {
return 0;
}
}
#if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)

View File

@@ -24,6 +24,7 @@
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../SDL_hints_c.h"
#include "SDL_windowsvideo.h"
#include "SDL_windowsframebuffer.h"
@@ -38,24 +39,22 @@ static void WIN_VideoQuit(_THIS);
/* Hints */
SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
SDL_bool g_WindowsEnableMenuMnemonics = SDL_FALSE;
SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
static void SDLCALL UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
if (newValue && *newValue == '0') {
g_WindowsEnableMessageLoop = SDL_FALSE;
} else {
g_WindowsEnableMessageLoop = SDL_TRUE;
}
g_WindowsEnableMessageLoop = SDL_GetStringBoolean(newValue, SDL_TRUE);
}
static void SDLCALL UpdateWindowsEnableMenuMnemonics(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
g_WindowsEnableMenuMnemonics = SDL_GetStringBoolean(newValue, SDL_FALSE);
}
static void SDLCALL UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
if (newValue && *newValue == '0') {
g_WindowFrameUsableWhileCursorHidden = SDL_FALSE;
} else {
g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
}
g_WindowFrameUsableWhileCursorHidden = SDL_GetStringBoolean(newValue, SDL_TRUE);
}
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
@@ -450,6 +449,7 @@ int WIN_VideoInit(_THIS)
#endif
SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL);
SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS, UpdateWindowsEnableMenuMnemonics, NULL);
SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)

View File

@@ -460,6 +460,7 @@ typedef struct SDL_VideoData
} SDL_VideoData;
extern SDL_bool g_WindowsEnableMessageLoop;
extern SDL_bool g_WindowsEnableMenuMnemonics;
extern SDL_bool g_WindowFrameUsableWhileCursorHidden;
typedef struct IDirect3D9 IDirect3D9;