1
0
Fork 0

Display/Display: Cache position when entering fullscreen and restore when entering window mode again.

This commit is contained in:
Henrik Hautakoski 2022-09-12 22:24:19 +02:00
parent d34d20361d
commit d12d60b1ba
2 changed files with 13 additions and 0 deletions

View file

@ -106,6 +106,11 @@ void Display::setVideoMode(Mode mode)
m_impl->exitFullscreen();
}
// Cache window position when entering fullscreen.
if (mode == FULLSCREEN || mode == WINDOWEDFULLSCREEN) {
m_cachePos = m_impl->getPosition();
}
// True fullscreen
if (mode == FULLSCREEN) {
m_impl->enterFullscreen(m_description.mode);
@ -120,6 +125,9 @@ void Display::setVideoMode(Mode mode)
else {
// Set stored decoration.
m_impl->setDecoration(m_description.decoration);
// Restore position.
m_impl->setPosition(m_cachePos.x, m_cachePos.y);
}
m_fmode = mode;