From 438c01181e454415e5daaa5e4871bd9d91d848bb Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 26 Jun 2018 19:05:01 +0200 Subject: [PATCH] Reduce glitches when chagin the window mode/size --- src/event.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index c763047..3f55346 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1735,6 +1735,9 @@ CEvent::SetFullScreen (bool bFullScreen, double prevScale) displayIndex = 0; #endif /* _WIN32 */ + SDL_RenderClear (g_renderer); + SDL_RenderPresent (g_renderer); + if (g_bFullScreen && g_zoom == 2) { int displays = SDL_GetNumVideoDisplays (); @@ -1760,11 +1763,6 @@ CEvent::SetFullScreen (bool bFullScreen, double prevScale) SDL_SetWindowBordered (g_window, bFullScreen ? SDL_FALSE : SDL_TRUE); SDL_SetWindowGrab (g_window, bFullScreen ? SDL_TRUE : SDL_FALSE); - if (!g_bFullScreen) - SDL_SetWindowPosition ( - g_window, SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex), - SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); - m_pPixmap->LoadCursors (); /* Force this update before otherwise the coordinates retrieved with @@ -1821,11 +1819,14 @@ CEvent::SetWindowSize (double prevScale, double newScale) newScale = 1; SDL_SetWindowSize (g_window, LXIMAGE * newScale, LYIMAGE * newScale); + SDL_RenderClear (g_renderer); + SDL_RenderPresent (g_renderer); int displayIndex = SDL_GetWindowDisplayIndex (g_window); SDL_SetWindowPosition ( g_window, SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex), SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); + SDL_Delay (100); m_pPixmap->LoadCursors ();