From 8e526594fad338b745f9cea8ac696af4806e9c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Zumer?= Date: Fri, 29 Nov 2019 17:42:34 -0500 Subject: [PATCH] Recenter the window when exiting fullscreen mode This moves the window back to the center of the display instead of to (0, 0) when exiting fullscreen mode, which has the side effect of hiding the title bar if it is present. --- system_sdl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system_sdl.c b/system_sdl.c index 198013fa..00604c29 100644 --- a/system_sdl.c +++ b/system_sdl.c @@ -377,6 +377,12 @@ SDL_Surface* SDL_COMPAT_SetVideoMode(int width, int height, int bitsperpixel, Ui FreeResources(); + // When leaving fullscreen mode, X and Y coordinates should be recentered relative to the display. + if (flags ^ SDL_WINDOW_FULLSCREEN) { + g_lastx = SDL_WINDOWPOS_CENTERED; + g_lasty = SDL_WINDOWPOS_CENTERED; + } + g_window = SDL_CreateWindow("oricutron", g_lastx, g_lasty, g_width, g_height, flags); if (g_icon)