comparison 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
comparison
equal deleted inserted replaced
2457:9da3de58410d 2458:09c9d2c6bac0
1490 extra_windows = realloc(extra_windows, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*extra_windows)); 1490 extra_windows = realloc(extra_windows, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*extra_windows));
1491 extra_renderers = realloc(extra_renderers, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*extra_renderers)); 1491 extra_renderers = realloc(extra_renderers, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*extra_renderers));
1492 close_handlers = realloc(close_handlers, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*close_handlers)); 1492 close_handlers = realloc(close_handlers, (num_textures - FRAMEBUFFER_USER_START) * sizeof(*close_handlers));
1493 win_idx = num_textures - FRAMEBUFFER_USER_START - 1; 1493 win_idx = num_textures - FRAMEBUFFER_USER_START - 1;
1494 } 1494 }
1495 extra_windows[win_idx] = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0); 1495 int x = SDL_WINDOWPOS_UNDEFINED;
1496 int y = SDL_WINDOWPOS_UNDEFINED;
1497 SDL_GetWindowPosition(main_window, &x, &y);
1498 if (x != SDL_WINDOWPOS_UNDEFINED) {
1499 x += main_width;
1500 }
1501 extra_windows[win_idx] = SDL_CreateWindow(caption, x, y, width, height, 0);
1496 if (!extra_windows[win_idx]) { 1502 if (!extra_windows[win_idx]) {
1497 goto fail_window; 1503 goto fail_window;
1498 } 1504 }
1499 extra_renderers[win_idx] = SDL_CreateRenderer(extra_windows[win_idx], -1, SDL_RENDERER_ACCELERATED); 1505 extra_renderers[win_idx] = SDL_CreateRenderer(extra_windows[win_idx], -1, SDL_RENDERER_ACCELERATED);
1500 if (!extra_renderers[win_idx]) { 1506 if (!extra_renderers[win_idx]) {