Mercurial > repos > blastem
diff render_sdl.c @ 2458:09c9d2c6bac0
Avoid spawning secondary windows right on top of the main one
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 21 Feb 2024 20:34:52 -0800 |
parents | bed4d3db8a3f |
children | ccee8dccd9cc |
line wrap: on
line diff
--- a/render_sdl.c Wed Feb 21 20:25:06 2024 -0800 +++ b/render_sdl.c Wed Feb 21 20:34:52 2024 -0800 @@ -1492,7 +1492,13 @@ close_handlers = realloc(close_handlers, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*close_handlers)); win_idx = num_textures - FRAMEBUFFER_USER_START - 1; } - extra_windows[win_idx] = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0); + int x = SDL_WINDOWPOS_UNDEFINED; + int y = SDL_WINDOWPOS_UNDEFINED; + SDL_GetWindowPosition(main_window, &x, &y); + if (x != SDL_WINDOWPOS_UNDEFINED) { + x += main_width; + } + extra_windows[win_idx] = SDL_CreateWindow(caption, x, y, width, height, 0); if (!extra_windows[win_idx]) { goto fail_window; }