SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS(3)

πŸ’– SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, we're doing a whole page about one (1) hint and honestly? it's lowkey a bop πŸŽ€

🌸 NAME 🌸

SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS β€” a variable that controls whether menus can be opened with their keyboard shortcut, aka Alt+mnemonic. yep that's the whole gig. iconic behavior fr fr πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_hints.h>

#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"

like look at her. one include, one define, no notes 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea. if the mnemonics are enabled, then menus can be opened by pressing the Alt key plus the corresponding mnemonic β€” for example, Alt+F opens the File menu. cute, right? slay.

BUT. and this is the messy part 😭 β€” in case an invalid mnemonic is pressed, Windows makes an audible beep to convey that nothing happened. and bestie. this is true even if the window has no menu at all! like ma'am, there is no menu, why are we beeping πŸ’€

because most SDL applications don't have menus, and some want to use the Alt key for other purposes, SDL disables mnemonics (and the beeping) by default. protect your ears, periodt.

⚠️ Note: this also affects keyboard events! with mnemonics enabled, when a menu is opened from the keyboard, you will not receive a KEYUP event for the mnemonic key, and might not receive one for Alt. so if your input code is going "where is my KEYUP 😭" β€” that's why. not a bug, it's the vibe. 🌈

the variable can be set to the following values:

  • "0" β€” Alt+mnemonic does nothing, no beeping. (default) πŸ”‡
  • "1" β€” Alt+mnemonic opens menus, invalid mnemonics produce a beep. πŸ””

this hint can be set anytime. no waiting, no drama, just set it whenever. πŸ’œ


⭐ AVAILABILITY ⭐

this hint is available since SDL 3.2.0. so if you're on something older, bestie, it's giving ✨ nothing ✨ β€” go update 🧚


and that's the page!! πŸ’– brought to you by Simple Directmedia Layer, rockin' version SDL 3.4.18, with the whole SDL_HINT_WIND...ENU_MNEMONICS(3) moment living rent free in the footer. go forth and mnemonic responsibly, bestie πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from