From: Holger Schemel Date: Thu, 13 Oct 2022 18:43:14 +0000 (+0200) Subject: added dirty workaround to open program window on specified display X-Git-Tag: 4.3.3.0~57 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster-next-patch-release;p=rocksndiamonds.git added dirty workaround to open program window on specified display As SDL function "SDL_GetNumVideoDisplays()" seems to be broken on some systems (tested with older Linux systems and SDL 2.0.0 and 2.0.6, but also current macOS with SDL 2.0.20), do not use it for now to check if the specified display number is valid. --- diff --git a/src/libgame/misc.c b/src/libgame/misc.c index f0858f4a..b1f4b66c 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1561,12 +1561,17 @@ void GetOptions(int argc, char *argv[], int display_nr = atoi(option_arg); +#if 1 + // dirty hack: SDL_GetNumVideoDisplays() seems broken on some systems + options.display_nr = display_nr; +#else options.display_nr = MAX(0, MIN(display_nr, SDL_GetNumVideoDisplays() - 1)); if (display_nr != options.display_nr) Warn("invalid display %d -- using display %d", display_nr, options.display_nr); +#endif } #if defined(PLATFORM_MAC) else if (strPrefix(option, "-psn"))