mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-18 10:48:28 +00:00
render: Update the size/scale/viewport on moves, in addition to resizes.
For OpenGL this means resetting the viewport state shadowing flag too. Fixes #1504
This commit is contained in:
parent
5613a56032
commit
cb81630816
2 changed files with 26 additions and 8 deletions
|
@ -698,7 +698,17 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
|||
renderer->WindowEvent(renderer, &event->window);
|
||||
}
|
||||
|
||||
if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||
/* In addition to size changes, we also want to do this block for
|
||||
* moves as well, for two reasons:
|
||||
*
|
||||
* 1. The window could be moved to a new display, which has a new
|
||||
* DPI and therefore a new window/drawable ratio
|
||||
* 2. For whatever reason, the viewport can get messed up during
|
||||
* window movement (this has been observed on macOS), so this is
|
||||
* also a good opportunity to force viewport updates
|
||||
*/
|
||||
if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
||||
event->window.event == SDL_WINDOWEVENT_MOVED) {
|
||||
/* Make sure we're operating on the default render target */
|
||||
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
|
||||
if (saved_target) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue