SDL_HINT_VID...PLAY_PRIORITY(3)

πŸ’– SDL_HINT_VIDEO_DISPLAY_PRIORITY πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS manual, and today's main character is SDL_HINT_VIDEO_DISPLAY_PRIORITY β€” no cap, this one is lowkey iconic if you've ever been mad about which monitor SDL thinks is "the" monitor. 🌸

✨ NAME ✨

SDL_HINT_VIDEO_DISPLAY_PRIORITY β€” a comma separated list containing the names of the displays that SDL should sort to the front of the display list. fr fr, that's it, that's the whole vibe. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_hints.h>

#define SDL_HINT_VIDEO_DISPLAY_PRIORITY "SDL_VIDEO_DISPLAY_PRIORITY"

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea πŸ“ β€” when you set this hint, displays whose name strings match will get prioritized in the list of displays, the one that SDL_GetDisplays() hands you. and the first one you list becomes the primary display. periodt. πŸ‘‘

the naming convention can vary depending on your environment, but it's usually a connector name β€” think 'DP-1', 'DP-2', 'HDMI-A-1', etc... iykyk.

wondering where to even find these connector names? don't stress, bestie, we got you:

  • on Wayland desktops, the connector names associated with displays live in the name property of the info output from wayland-info -i wl_output.
  • on X11 desktops, the xrandr utility can be used to retrieve the connector names associated with displays.

this hint is currently supported on the following drivers:

  • KMSDRM (kmsdrm)
  • Wayland (wayland)
  • X11 (x11)
⚠️ okay important one, bestie: this hint should be set before SDL is initialized. set it late and it's giving nothing. πŸ’€

🌈 AVAILABILITY 🌈

this hint has been available since SDL 3.2.0. so if you're on something older, no vibes for you, sorry. 😭


and that's the whole page, bestie!! 🫢 this lil slice of the manual lives under Simple Directmedia Layer, running SDL 3.4.18 β€” so go forth, sort your displays, and make that primary monitor the main character it was always meant to be. βœ¨πŸ§šπŸ’œ

πŸ“¦ where this page comes from