mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-15 09:18:27 +00:00
video: Drop size and position requests for windows in a fixed size/position state
It is not uncommon for clients to redundantly set the window size and position, either as a holdover from an SDL 1 port, when this was required, due to any window state change triggering a universal update function that sets all window state, even if unnecessary (e.g. always calling SDL_SetWindowSize(), even if the window is fullscreen), or due to the use of compatability layers. Historically, these clients expect that their behavior won't override the base window state, which is an assumption that the windowing changes in SDL 3 broke by caching size and position changes that can't be applied immediately. This change drops size and position requests when the window is in the maximized and fullscreen states (fullscreen-desktop windows will be repositioned, but the non-fullscreen floating position will not be overwritten), which is behavior more in line with existing client assumptions, and should ease the porting process, as well as prevent annoying bugs when older software is run via sdl2-compat. In the process of making these changes, pending window state has been moved to separate variables in the SDL_Window struct, as this fixes bugs regarding fullscreen display selection and centering windows immediately after resize on asynchronous platforms, which had issues due to pending state possibly being overwritten.
This commit is contained in:
parent
6fa6297441
commit
eda0261c4e
21 changed files with 359 additions and 283 deletions
|
@ -1529,13 +1529,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surfa
|
|||
/**
|
||||
* Request that the window's position be set.
|
||||
*
|
||||
* If, at the time of this request, the window is in a fixed-size state such
|
||||
* as maximized, this request may be deferred until the window returns to a
|
||||
* resizable state.
|
||||
* If the window is in an exclusive fullscreen or maximized state, this request
|
||||
* has no effect.
|
||||
*
|
||||
* This can be used to reposition fullscreen-desktop windows onto a different
|
||||
* display, however, exclusive fullscreen windows are locked to a specific
|
||||
* display and can only be repositioned programmatically via
|
||||
* display, however, as exclusive fullscreen windows are locked to a specific
|
||||
* display, they can only be repositioned programmatically via
|
||||
* SDL_SetWindowFullscreenMode().
|
||||
*
|
||||
* On some windowing systems this request is asynchronous and the new
|
||||
|
@ -1596,12 +1595,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *
|
|||
/**
|
||||
* Request that the size of a window's client area be set.
|
||||
*
|
||||
* If, at the time of this request, the window in a fixed-size state, such as
|
||||
* maximized or fullscreen, the request will be deferred until the window
|
||||
* exits this state and becomes resizable again.
|
||||
* If the window is in a fullscreen or maximized state, this request has no
|
||||
* effect.
|
||||
*
|
||||
* To change the fullscreen mode of a window, use
|
||||
* SDL_SetWindowFullscreenMode()
|
||||
* To change the exclusive fullscreen mode of a window, use
|
||||
* SDL_SetWindowFullscreenMode().
|
||||
*
|
||||
* On some windowing systems, this request is asynchronous and the new window
|
||||
* size may not have have been applied immediately upon the return of this
|
||||
|
@ -2021,6 +2019,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MaximizeWindow(SDL_Window *window);
|
|||
/**
|
||||
* Request that the window be minimized to an iconic representation.
|
||||
*
|
||||
* If the window is in a fullscreen state, this request has no direct effect.
|
||||
* It may alter the state the window is returned to when leaving fullscreen.
|
||||
*
|
||||
* On some windowing systems this request is asynchronous and the new window
|
||||
* state may not have been applied immediately upon the return of this
|
||||
* function. If an immediate change is required, call SDL_SyncWindow() to
|
||||
|
@ -2048,6 +2049,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MinimizeWindow(SDL_Window *window);
|
|||
* Request that the size and position of a minimized or maximized window be
|
||||
* restored.
|
||||
*
|
||||
* If the window is in a fullscreen state, this request has no direct effect.
|
||||
* It may alter the state the window is returned to when leaving fullscreen.
|
||||
*
|
||||
* On some windowing systems this request is asynchronous and the new window
|
||||
* state may not have have been applied immediately upon the return of this
|
||||
* function. If an immediate change is required, call SDL_SyncWindow() to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue