6369: Fix Move also requesting the current canvas size, which should report… r=Robyt3 a=Jupeyy

… a resize event

fixes #6368

For some reason KDE seems to set the current window'd size of the window (even if i use fullscreen)  for the window when its minimized. And ::Move re-requests the canvas size.

This resulted in the incorrect viewport.

Funnily enough for me under KDE this also means that the check for GotResized, to only notify the components when the canvas actually resized is now useless.

`@Robyt3` can you check if Windows is not doing this behavior? Else the previous patch is useless for the crash bug :D
On the other hand, this *could* have been part of the text container bug, tho I cannot imagine yet why

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2023-03-05 11:53:12 +00:00 committed by GitHub
commit a14f32cf47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2947,9 +2947,8 @@ bool CGraphics_Threaded::SetWindowScreen(int Index)
return false;
}
m_pBackend->GetViewportSize(m_ScreenWidth, m_ScreenHeight);
AdjustViewport(true);
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
// send a got resized event so that the current canvas size is requested
GotResized(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight, g_Config.m_GfxScreenRefreshRate);
for(auto &PropChangedListener : m_vPropChangeListeners)
PropChangedListener();
@ -2966,9 +2965,9 @@ void CGraphics_Threaded::Move(int x, int y)
// Only handling CurScreen != m_GfxScreen doesn't work reliably
const int CurScreen = m_pBackend->GetWindowScreen();
m_pBackend->UpdateDisplayMode(CurScreen);
m_pBackend->GetViewportSize(m_ScreenWidth, m_ScreenHeight);
AdjustViewport(true);
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
// send a got resized event so that the current canvas size is requested
GotResized(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight, g_Config.m_GfxScreenRefreshRate);
for(auto &PropChangedListener : m_vPropChangeListeners)
PropChangedListener();