Add mouse hint to README-highdpi.md
Closes #10074
This hint isn't actually relevant for display scaling handling.
There's a FIXME in WIN_SetEnhancedMouseScale() wondering if we need do anything for displays with different DPI and/or display scale.
What unit is SDL's internal mouse position in, Pixel or points?
This needs to be clarified because either SDL's mouse scaling is not faithful due to not matching the OS's DPI scaling, or the motion matches OS but the reported units are mismatched due to DPI scaling.
They're in window coordinates, which are pixels on Windows and Linux, and points on macOS.
I think that's a point worth clarifying in this specific README.. I'll think about how to reword it.
Is my understanding in the following table correct?
- 3840x2160 physical monitor resolution
- 200% Windows display scale or 2x MacOS display
- Fullscreen window
| Value | Default | High Density |
|---|---|---|
| Mouse coodinate space | 3840x2160 | 3840x2160 |
Args to SDL_CreateWindow() |
3840x2160 | 1920x1080 |
SDL_GetWindowSize() |
3840x2160 | 1920x1080 |
SDL_GetWindowSizeInPixels() |
3840x2160 | 3840x2160 |
SDL_GetWindowPixelDensity() |
1.0 | 2.0 |
SDL_GetWindowDisplayScale() |
1.0 | 2.0 |
SDL_GetDisplayContentScale() |
2.0 | 2.0 |
SDL_GetWindowDisplayScale() == SDL_GetWindowPixelDensity()
SDL_GetWindowPixelDensity() == SDL_GetWindowSizeInPixels() / SDL_GetWindowSize()
Is my understanding in the following table correct?
- 3840x2160 physical monitor resolution
- 200% Windows display scale or 2x MacOS display
- Fullscreen window
These are going to vary between macOS and Windows, because they treat high DPI differently. macOS uses virtualized points for the window coordinates and Windows uses pixels.
Here's an updated table for Windows, which doesn't distinguish between default and high density (using SDL's default behavior)
| Value | |
|---|---|
| Mouse coordinate space | 3840x2160 |
Args to SDL_CreateWindow() |
3840x2160 |
SDL_GetWindowSize() |
3840x2160 |
SDL_GetWindowSizeInPixels() |
3840x2160 |
SDL_GetWindowPixelDensity() |
1.0 |
SDL_GetWindowDisplayScale() |
2.0 |
SDL_GetDisplayContentScale() |
2.0 |
Here's an updated table for macOS, where the High Density entries are for windows on a 2x display and created with the SDL_WINDOW_HIGH_PIXEL_DENSITY flag.
| Value | Default | High Density |
|---|---|---|
| Mouse coordinate space | 1920x1080 | 1920x1080 |
Args to SDL_CreateWindow() |
1920x1080 | 1920x1080 |
SDL_GetWindowSize() |
1920x1080 | 1920x1080 |
SDL_GetWindowSizeInPixels() |
1920x1080 | 3840x2160 |
SDL_GetWindowPixelDensity() |
1.0 | 2.0 |
SDL_GetWindowDisplayScale() |
1.0 | 2.0 |
SDL_GetDisplayContentScale() |
1.0 | 1.0 |
Here is a correction as well:
SDL_GetWindowPixelDensity() == SDL_GetWindowSizeInPixels() / SDL_GetWindowSize()
SDL_GetWindowDisplayScale() == SDL_GetWindowPixelDensity() * SDL_GetDisplayContentScale()
By the way, I appreciate your willingness to learn how this all works.
Thanks, really appreciate your patience bearing with me. I’ll incorporate the examples as well as think about how to phrase them unambiguously.
I tried to interpret the interfaces in terms of advisory factors with respect to memory pixels or native units, please let me know if there are any misunderstandings in what I wrote.
I have some questions and clarification here. I'll come back to this when I have more time.
Merged, thanks!