Skip to content

Commit 8a67896

Browse files
committedJan 21, 2025··
docs: Note the preferred function for getting the content scale of a window
SDL_GetWindowDisplayScale() should be preferred over SDL_GetDisplayForWindow() + SDL_GetDisplayContentScale() for querying the per-window content scale, as the former provides a more accurate and current value for individual windows, as the per-window value can differ from the base display scale value, particularly on high-DPI and multi-monitor desktops.
1 parent 8526868 commit 8a67896

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎include/SDL3/SDL_video.h

+7
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat
729729
* display scale, which means that the user expects UI elements to be twice as
730730
* big on this display, to aid in readability.
731731
*
732+
* After window creation, SDL_GetWindowDisplayScale() should be used to query
733+
* the content scale factor for individual windows instead of querying the display
734+
* for a window and calling this function, as the per-window content scale factor
735+
* may differ from the base value of the display it is on, particularly on
736+
* high-DPI and/or multi-monitor desktop configurations.
737+
*
732738
* \param displayID the instance ID of the display to query.
733739
* \returns the content scale of the display, or 0.0f on failure; call
734740
* SDL_GetError() for more information.
@@ -737,6 +743,7 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat
737743
*
738744
* \since This function is available since SDL 3.1.3.
739745
*
746+
* \sa SDL_GetWindowDisplayScale
740747
* \sa SDL_GetDisplays
741748
*/
742749
extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displayID);

0 commit comments

Comments
 (0)
Please sign in to comment.