mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-12-18 08:18:35 +00:00
render: Only update size/scale/viewport when moving to a new display, rather than all window movement.
We really only care about DPI changes here, so this both reduces work and also avoids weird cases where viewport state can be corrupted by trivial window events. This doesn't _completely_ get rid of the issue but this is somewhat intentional, since apps will definitely want to do a full reset when changing displays anyhow (otherwise DPI/adapter changes will screw things up, and that's out of our control as long as both window size and drawable size are exposed at the same time. Note that OpenGL still captures window events because of weird platform-specific issues like macOS and viewport stretching! Fixes #5949
This commit is contained in:
parent
cfbeb438c1
commit
a28f426acb
@ -705,16 +705,11 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
}
|
||||
|
||||
/* 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
|
||||
* window display changes as well! If the new display has a new DPI,
|
||||
* we need to update the viewport for the new window/drawable ratio.
|
||||
*/
|
||||
if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
||||
event->window.event == SDL_WINDOWEVENT_MOVED) {
|
||||
event->window.event == SDL_WINDOWEVENT_DISPLAY_CHANGED) {
|
||||
/* Make sure we're operating on the default render target */
|
||||
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
|
||||
if (saved_target) {
|
||||
|
Loading…
Reference in New Issue
Block a user