SDL_HINT_VID...LE_TO_DISPLAY(3)
π SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY π
okay bestie, gather round, because today's main character is a little SDL3 hint from the SDL3 FUNCTIONS manual, and she is a lot. her full government name is SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, and she's here to force non-DPI-aware Wayland windows to output at 1:1 scaling. no cap. let's get into it. π¦
β¨ NAME β¨
SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY β a variable that forces non-DPI-aware Wayland windows to output at 1:1 scaling. she's giving "legacy app rescue mission" but also "chaos on certain display setups." π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_hints.h>
#define SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY "SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY"
like, that's the whole vibe. include the header, use the define, slay. β¨
π DESCRIPTION π
okay so first things first: this must be set before initializing the video subsystem. no take-backs, no "oops I set it late," it's an before situation, bestie. π
when this hint is set, Wayland windows that are not flagged as being DPI-aware will be output with scaling designed to force 1:1 pixel mapping. it's literally forcing the pixels to line up one-to-one. iconic? maybe. dangerous? also maybe. π
the whole point is to let legacy applications display without desktop scaling being applied, but lowkey it has issues with certain display configurations, because it forces the window to behave in a way that Wayland desktops were not designed to accommodate:
- Rounding errors can result with odd window sizes and/or desktop scales, which can cause the window contents to appear slightly blurry. π΅βπ«
- Positioning the window may be imprecise due to unit conversions and rounding.
- The window may be unusably small on scaled desktops.
- The window may jump in size when moving between displays of different scale factors.
- Displays may appear to overlap when using a multi-monitor setup with scaling enabled.
- Possible loss of cursor precision due to the logical size of the window being reduced.
bestie, if you're building something new, the move is to design with proper DPI awareness handling instead of enabling this. fr fr. this hint is for the legacy girlies only. π
the variable can be set to the following values:
"0"β Windows will be scaled normally."1"β Windows will be forced to scale to achieve 1:1 output.
and one more time for the people in the back: this hint should be set before creating a window. β
π AVAILABILITY π
this hint is available since SDL 3.2.0. she's been around, she's established, she's got seniority. π
and that's the whole page, bestie. this was SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY from the SDL3 FUNCTIONS manual, brought to you by Simple Directmedia Layer in version SDL 3.4.18. mwah. take care of your DPI awareness and your windows will thank you. ππ¦β¨
π¦ 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