Skip to content

Commit

Permalink
Recenter the window when exiting fullscreen mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rzumer committed Nov 29, 2019
1 parent b5bb011 commit 8e52659
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions system_sdl.c
Expand Up @@ -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)
Expand Down

0 comments on commit 8e52659

Please sign in to comment.