# HG changeset patch # User Michael Pavone # Date 1708576492 28800 # Node ID 09c9d2c6bac04cdf4cd774cf92b7922d5c70b28c # Parent 9da3de58410d783625f2b3a1628cb6ce308efb57 Avoid spawning secondary windows right on top of the main one diff -r 9da3de58410d -r 09c9d2c6bac0 render_sdl.c --- 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; }