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:
1 parent
5613a56032
commit
cb81630816
2 files changed
+26
-8
No files matched your search
+11
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user