SDL_HINT_AND...P_BACK_BUTTON(3)
π NAME π
SDL_HINT_ANDROID_TRAP_BACK_BUTTON β bestie, it's literally just a variable that controls whether we trap the Android back button so we can handle it ourselves manually. that's it. that's the whole girl. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_hints.h>
#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
π¦ DESCRIPTION π¦
okay so listen. this hint is lowkey essential for two whole reasons. one: it makes the right mouse button actually work on some Android devices. two: it lets you trap the back button for use in your code reliably, no cap. if this hint is true, the back button shows up as an SDL_EVENT_KEY_DOWN / SDL_EVENT_KEY_UP pair with a keycode of SDL_SCANCODE_AC_BACK. slay. π
the variable can be set to the following values, and yes we're going through all of them:
"0"β the back button will be handled as usual for the system. this is the default, bestie. (default)"1"β the back button will be trapped, allowing you to handle the key press manually. (this will also let right mouse click work on systems where the right mouse button functions as back.)
this hint can be set anytime. no waiting around, no setup era, just vibes. π
πΈ AVAILABILITY πΈ
this hint has been available since SDL 3.2.0. she's new-ish but she's iconic. periodt. π
ok but fr fr, if you're not trapping that back button and your right mouse click is giving nothing on some Android devicesβ¦ this is your sign. π«Ά
that's the whole page, bestie! this came to you courtesy of Simple Directmedia Layer β SDL 3.4.18 π β go build something cute, mwah πβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms