Add SDL_GetPointDisplayIndex
and SDL_GetRectDisplayIndex
and re-implement SDL_GetWindowDisplayIndex
in terms of SDL_GetRectDisplayIndex
- This allows looking up the display index for an arbitrary location rather than requiring an active window to do so. - This change also reimplements the fallback display lookup that found the display with center closest to the window's center to instead find the display rect edge closest to the window center (this was done in the almost identical display lookup used in SDL_windowsmodes.c, which now uses `SDL_GetPointDisplayIndex`). In practice this should almost never be hit as it requires the window's center to not be enclosed by any display rect.
This commit is contained in:
parent
20f9a1b8a4
commit
98bac00dcc
7 changed files with 116 additions and 94 deletions
|
@ -597,6 +597,31 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
|
|||
*/
|
||||
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
|
||||
|
||||
/**
|
||||
* Get the index of the display containing a point
|
||||
*
|
||||
* \param point the point to query
|
||||
* \returns the index of the display containing the point or a negative
|
||||
* error code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \sa SDL_GetDisplayBounds
|
||||
* \sa SDL_GetNumVideoDisplays
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point);
|
||||
|
||||
/**
|
||||
* Get the index of the display primarily containing a rect
|
||||
*
|
||||
* \param rect the rect to query
|
||||
* \returns the index of the display entirely containing the rect or closest
|
||||
* to the center of the rect on success or a negative error code on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \sa SDL_GetDisplayBounds
|
||||
* \sa SDL_GetNumVideoDisplays
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRectDisplayIndex(const SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* Get the index of the display associated with a window.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue