mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 21:47:44 +00:00
video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
This commit is contained in:
@@ -1497,6 +1497,23 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* Confines the cursor in the specified rect area of a window.
|
||||
*
|
||||
* Note that this does NOT grab the cursor, it only defines the area a cursor
|
||||
* is restricted to when the window has mouse focus.
|
||||
*
|
||||
* \param window The window that will be associated with the barrier.
|
||||
* \param rect A rectangle area in window-relative coordinates. If NULL the
|
||||
* barrier for the specified window will be destroyed.
|
||||
*
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \sa SDL_SetWindowGrab
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window * window, const SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* Set the gamma ramp for the display that owns a given window.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user