SDL_HINT_TRA...IS_TOUCH_ONLY(3)

πŸ’– SDL_HINT_TRACKPAD_IS_TOUCH_ONLY πŸ’–

okay bestie, welcome to SDL_HINT_TRACKPAD_IS_TOUCH_ONLY(3) β€” yes that's the manual page name, it's giving long and dramatic but I promise it's a whole vibe once you get in. this is one of the SDL3 function/hint pages, and it's literally about whether your trackpad is a mouse or a whole touch device. the way that one little variable decides so much?? iconic.


✨ NAME ✨

SDL_HINT_TRACKPAD_IS_TOUCH_ONLY β€” a variable controlling whether trackpads should be treated as touch devices.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_hints.h>

#define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY"

like, that's the include, that's the define, that's the whole entry point. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ“: on macOS (and possibly other platforms in the future, they're keeping their options open, main character energy), SDL will report touches on a trackpad as mouse input. and honestly? that's generally what users expect from this device. it's the normal, default, nobody-bats-an-eye behaviour.

BUT β€” and this is the plot twist πŸ’€ β€” those trackpads are often actually full multitouch-capable touch devices. like, they were touch devices the whole time and we were just calling them mice. so for some apps, it might be preferable to treat them as such. and that's exactly what this hint lets you do. 🫢

the variable can be set to the following values:

  • "0" β€” Trackpad will send mouse events. (this is the default, it's the chill one)
  • "1" β€” Trackpad will send touch events. (the spicy one, multitouch mode activated ✨)
⚠️ okay so important: this hint should be set before SDL is initialized. like, before. set it early or it won't hit the same, fr fr.

πŸ‘‘ AVAILABILITY πŸ‘‘

this hint is available since SDL 3.2.0. so if you're on anything older... bestie, upgrade. πŸ’…


πŸŽ€ one last thing πŸŽ€

this page came to you from Simple Directmedia Layer, riding with SDL 3.4.18. that's the source and the version, right there, no cap. now go set your hint before SDL_Init and live your best multitouch life. bye bestie, love u, don't forget to check the other hints pages πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from