Fix window position after switching from fullscreen

On Windows last_position_x/y (from SDL_GetWindowPosition()) was 0, 0 when
coming from fullscreen, and creating a window at position (0, 0) cuts off
the window decorations (SDL-Bug?) so the window can't even be moved
around anymore.
So now we only use the last_position_* if last_position_y was > 24, so we
have enough of the title bar to move the window around with the mouse.

This is part of #484
This commit is contained in:
Daniel Gibson 2019-11-16 18:38:21 +01:00
parent a4f56a9650
commit 6ecc083c83

View file

@ -78,7 +78,7 @@ ClearDisplayIndices(void)
static qboolean
CreateSDLWindow(int flags, int w, int h)
{
if (SDL_WINDOWPOS_ISUNDEFINED(last_position_x) || SDL_WINDOWPOS_ISUNDEFINED(last_position_y))
if (SDL_WINDOWPOS_ISUNDEFINED(last_position_x) || SDL_WINDOWPOS_ISUNDEFINED(last_position_y) || last_position_x < 0 ||last_position_y < 24)
{
last_position_x = last_position_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY((int)vid_displayindex->value);
}