renderer: Don't reset viewport on window move
Stop resetting the viewport on window move
Fixes #5949
@flibitijibibo , does this conflict with https://github.com/libsdl-org/SDL/commit/cb8163081685fd97deba3c800bb8f10841b555a1?
It does but just barely - we need this case to happen when moving the window causes a DPI change (moving from a 100% display to a 200% display for example), we don't need it in any other case.
It does but just barely - we need this case to happen when moving the window causes a DPI change (moving from a 100% display to a 200% display for example), we don't need it in any other case.
Maybe we need a window "display changed" event instead?
That would definitely be helpful, and we might be able to do it at a high level too:
https://github.com/FNA-XNA/FNA/blob/master/src/FNAPlatform/SDL2_FNAPlatform.cs#L1026
It seems like what we actually want to do is rescale the viewport relative to the previous window size? e.g. if the viewport was the bottom half of the window, the new viewport would be the bottom half of the new window, etc.
It seems like what we actually want to do is rescale the viewport relative to the previous window size? e.g. if the viewport was the bottom half of the window, the new viewport would be the bottom half of the new window, etc.
I see.
But what if the window is half-way on display 1 and half-way on display 2?
My instinct is we need to scale the viewport from what it was to the new DPI, or this is going to be broken, which is going to need a more-complex PR (I don't think we need a new event for this case, but maybe I'm wrong).
But what if the window is half-way on display 1 and half-way on display 2?
It depends on the system. Windows will pick the center of the window and wherever that is, that is the display used for DPI scaling. macOS will scale each portion of the window individually based on the display it covers. For our purposes, we'll do the same as Windows, where a window will use the display covered by the center of the window.
But what if the window is half-way on display 1 and half-way on display 2?
It depends on the system. Windows will pick the center of the window and wherever that is, that is the display used for DPI scaling. macOS will scale each portion of the window individually based on the display it covers. For our purposes, we'll do the same as Windows, where a window will use the display covered by the center of the window.
Confirming that Wayland does it the Windows way as well.
@icculus, we shouldn't punt on this for 2.24.0
Turns out we already have the foundation to fix this, so I'm going to take care of this now.
@Axilot, thanks for the patch, it helped us work out the actual bug!