Need some help with SDL_WINDOWS_DPI_SCALING

In the comments of SDL_WINDOWS_DPI_SCALING, it says the following secondarily:

  • “1” - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on
    displays with non-100% scale factors.

Can anyone explain to me what this means? What are SDL coordinates and what does that include, does that include the mouse position we get from SDL functions? Or is that only for the size of the window?

I would like to note that if the mouse position is scaled by SDL automatically, it does not do that to me.

Any help is appreciated.

Sorry I didn’t see this until now.

I’m not sure if that’s an official term for it, but yes “SDL coordinates” include mouse coordinates, window sizes, window positions, display bounds… I don’t have a full list but anything that isn’t explicitly pixels.

Here’s an example:

  • current git commit on main, c83329481760b9f587e2cf3482e8590339852db9
  • building in VS2022
  • I’m launching the testwm2 project with SDL_WINDOWS_DPI_SCALING=1 in the “Environment” and --info all --resizable in the “Command Arguments” in VS2022’s project debugging settings.
  • My display is set to 150% scaling in Windows.
  • testwm2 creates “640x480 point” sized window by default. So SDL (with the use of the SDL_WINDOWS_DPI_SCALING hint) resolves this to a window with a 960x720 pixel client area.
  • I’m clicking near the bottom right corner of the window, and getting a coordinate near 640,480 in the log