diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 25f410250..3adeb6102 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -6,7 +6,7 @@ Copyright (c) 2002-2023 Various contributors (see below, and AUTHORS.txt) https://tuxpaint.org/ -2023.April.27 (0.9.30) +2023.April.28 (0.9.30) * Improvements to Stamp tool: --------------------------- * Avoid playing English descriptive sound for a stamp @@ -104,6 +104,12 @@ https://tuxpaint.org/ (shows when certain features are enabled; not just disabled) Bill Kendrick + * SDL_VIDEO_WINDOW_POS environment variable is now recognized + when running Tux Paint in fullscreen mode (useful for positioning + Tux Paint on a particular monitor). + Closes https://sourceforge.net/p/tuxpaint/bugs/277/ + Bill Kendrick + * Starter and Template Improvements --------------------------------- * More starters have smearing disabled (world maps & "skyline-sf-dusk") diff --git a/docs/en/ENVVARS.txt b/docs/en/ENVVARS.txt index 1e8ac60f9..2e4ad8c67 100644 --- a/docs/en/ENVVARS.txt +++ b/docs/en/ENVVARS.txt @@ -76,7 +76,7 @@ Language-related environment variables Display-related environment variables The following are a few of the environment variables supported by Simple - DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying + DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. @@ -89,6 +89,9 @@ Display-related environment variables SDL_VIDEO_WINDOW_POS - Requests where to position Tux Paint's window. Normally set to - "center" by Tux Paint itself, unless the environment variable is - already set (e.g., to "nopref", meaning "no preference"). + Requests where to position Tux Paint's window, and can be used to + specify what display to place a fullscreen Tux Paint in a + multi-monitor configuration. If not set, or set to "nopref" + (meaning "no preference"), Simple DirectMedia Layer (libSDL) + decides. Can be set to an X,Y coordinate (e.g. 200,100), or + "center" (meaning "center"). diff --git a/docs/en/html/ENVVARS.html b/docs/en/html/ENVVARS.html index 4dff8e46c..f81b45555 100644 --- a/docs/en/html/ENVVARS.html +++ b/docs/en/html/ENVVARS.html @@ -110,7 +110,7 @@ Display-related environment variables

- The following are a few of the environment variables supported by Simple DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. + The following are a few of the environment variables supported by Simple DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint.

SDL_VIDEO_ALLOW_SCREENSAVER @@ -124,7 +124,7 @@

- Requests where to position Tux Paint's window. Normally set to "center" by Tux Paint itself, unless the environment variable is already set (e.g., to "nopref", meaning "no preference").

+ Requests where to position Tux Paint's window, and can be used to specify what display to place a fullscreen Tux Paint in a multi-monitor configuration. If not set, or set to "nopref" (meaning "no preference"), Simple DirectMedia Layer (libSDL) decides. Can be set to an X,Y coordinate (e.g. 200,100), or "center" (meaning "center").

diff --git a/docs/es_ES.UTF-8/ENVVARS.txt b/docs/es_ES.UTF-8/ENVVARS.txt index 5441d0440..03d465e87 100644 --- a/docs/es_ES.UTF-8/ENVVARS.txt +++ b/docs/es_ES.UTF-8/ENVVARS.txt @@ -76,7 +76,7 @@ Language-related environment variables Display-related environment variables The following are a few of the environment variables supported by Simple - DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying + DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. @@ -89,6 +89,9 @@ Display-related environment variables SDL_VIDEO_WINDOW_POS - Requests where to position Tux Paint's window. Normally set to - "center" by Tux Paint itself, unless the environment variable is - already set (e.g., to "nopref", meaning "no preference"). + Requests where to position Tux Paint's window, and can be used to + specify what display to place a fullscreen Tux Paint in a + multi-monitor configuration. If not set, or set to "nopref" + (meaning "no preference"), Simple DirectMedia Layer (libSDL) + decides. Can be set to an X,Y coordinate (e.g. 200,100), or + "center" (meaning "center"). diff --git a/docs/es_ES.UTF-8/html/ENVVARS.html b/docs/es_ES.UTF-8/html/ENVVARS.html index 77a81db09..22b9bb533 100644 --- a/docs/es_ES.UTF-8/html/ENVVARS.html +++ b/docs/es_ES.UTF-8/html/ENVVARS.html @@ -110,7 +110,7 @@ Display-related environment variables

- The following are a few of the environment variables supported by Simple DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. + The following are a few of the environment variables supported by Simple DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint.

SDL_VIDEO_ALLOW_SCREENSAVER @@ -124,7 +124,7 @@

- Requests where to position Tux Paint's window. Normally set to "center" by Tux Paint itself, unless the environment variable is already set (e.g., to "nopref", meaning "no preference").

+ Requests where to position Tux Paint's window, and can be used to specify what display to place a fullscreen Tux Paint in a multi-monitor configuration. If not set, or set to "nopref" (meaning "no preference"), Simple DirectMedia Layer (libSDL) decides. Can be set to an X,Y coordinate (e.g. 200,100), or "center" (meaning "center").

diff --git a/docs/fr_FR.UTF-8/ENVVARS.txt b/docs/fr_FR.UTF-8/ENVVARS.txt index 2e523a2f4..c3fe56eec 100644 --- a/docs/fr_FR.UTF-8/ENVVARS.txt +++ b/docs/fr_FR.UTF-8/ENVVARS.txt @@ -85,7 +85,7 @@ Variables d'environnement relatives aux langues Variables d'environnement en rapport avec l'affichage Ce qui suit donne quelques variables d'environnement supportées par Simple - DirectMedia Layer (libSD) — que Tux Paint utilise pour l'affichage des + DirectMedia Layer (libSDL) — que Tux Paint utilise pour l'affichage des dessins, pour jouer des sons et traiter les saisies de la souris, du clavier et du joystick — et qui peuvent être utiles aux utilisateurs de Tux Paint. @@ -99,7 +99,9 @@ Variables d'environnement en rapport avec l'affichage SDL_VIDEO_WINDOW_POS - Indique où positionner la fenêtre de Tux Paint. Normalement - positionnée à "center" par Tux Paint lui-même, à moins que la - variable d'environnement n'ait déjà une valeur (par ex. "nopref" - signifie pas de préférence). + Requests where to position Tux Paint's window, and can be used to + specify what display to place a fullscreen Tux Paint in a + multi-monitor configuration. If not set, or set to "nopref" + (meaning "no preference"), Simple DirectMedia Layer (libSDL) + decides. Can be set to an X,Y coordinate (e.g. 200,100), or + "center" (meaning "center"). diff --git a/docs/fr_FR.UTF-8/html/ENVVARS.html b/docs/fr_FR.UTF-8/html/ENVVARS.html index 8d85055d9..4865d6d76 100644 --- a/docs/fr_FR.UTF-8/html/ENVVARS.html +++ b/docs/fr_FR.UTF-8/html/ENVVARS.html @@ -110,7 +110,7 @@ Variables d'environnement en rapport avec l'affichage

- Ce qui suit donne quelques variables d'environnement supportées par Simple DirectMedia Layer (libSD) — que Tux Paint utilise pour l'affichage des dessins, pour jouer des sons et traiter les saisies de la souris, du clavier et du joystick — et qui peuvent être utiles aux utilisateurs de Tux Paint. + Ce qui suit donne quelques variables d'environnement supportées par Simple DirectMedia Layer (libSDL) — que Tux Paint utilise pour l'affichage des dessins, pour jouer des sons et traiter les saisies de la souris, du clavier et du joystick — et qui peuvent être utiles aux utilisateurs de Tux Paint.

SDL_VIDEO_ALLOW_SCREENSAVER @@ -124,7 +124,7 @@

- Indique où positionner la fenêtre de Tux Paint. Normalement positionnée à "center" par Tux Paint lui-même, à moins que la variable d'environnement n'ait déjà une valeur (par ex. "nopref" signifie pas de préférence).

+ Requests where to position Tux Paint's window, and can be used to specify what display to place a fullscreen Tux Paint in a multi-monitor configuration. If not set, or set to "nopref" (meaning "no preference"), Simple DirectMedia Layer (libSDL) decides. Can be set to an X,Y coordinate (e.g. 200,100), or "center" (meaning "center").

diff --git a/docs/gl_ES.UTF-8/ENVVARS.txt b/docs/gl_ES.UTF-8/ENVVARS.txt index bb3f3aa19..539644861 100644 --- a/docs/gl_ES.UTF-8/ENVVARS.txt +++ b/docs/gl_ES.UTF-8/ENVVARS.txt @@ -79,7 +79,7 @@ Variábeis de contorno relacionadas co idioma Variábeisbles de contorno relacionadas co que se amosa A seguir amósanse algunhas das variábeis de contorno compatíbeis con - Simple DirectMedia Layer (libSD) — que Tux Paint utiliza para amosar + Simple DirectMedia Layer (libSDL) — que Tux Paint utiliza para amosar gráficos, reproducir sons e recibir entrada do rato, teclado e joystick — e que poden ser útiles para os usuarios de Tux Paint. @@ -92,6 +92,9 @@ Variábeisbles de contorno relacionadas co que se amosa SDL_VIDEO_WINDOW_POS - Requests where to position Tux Paint's window. Normally set to - "center" by Tux Paint itself, unless the environment variable is - already set (e.g., to "nopref", meaning "no preference"). + Requests where to position Tux Paint's window, and can be used to + specify what display to place a fullscreen Tux Paint in a + multi-monitor configuration. If not set, or set to "nopref" + (meaning "no preference"), Simple DirectMedia Layer (libSDL) + decides. Can be set to an X,Y coordinate (e.g. 200,100), or + "center" (meaning "center"). diff --git a/docs/gl_ES.UTF-8/html/ENVVARS.html b/docs/gl_ES.UTF-8/html/ENVVARS.html index 02eddc670..4fdbba76c 100644 --- a/docs/gl_ES.UTF-8/html/ENVVARS.html +++ b/docs/gl_ES.UTF-8/html/ENVVARS.html @@ -110,7 +110,7 @@ Variábeisbles de contorno relacionadas co que se amosa

- A seguir amósanse algunhas das variábeis de contorno compatíbeis con Simple DirectMedia Layer (libSD) — que Tux Paint utiliza para amosar gráficos, reproducir sons e recibir entrada do rato, teclado e joystick — e que poden ser útiles para os usuarios de Tux Paint. + A seguir amósanse algunhas das variábeis de contorno compatíbeis con Simple DirectMedia Layer (libSDL) — que Tux Paint utiliza para amosar gráficos, reproducir sons e recibir entrada do rato, teclado e joystick — e que poden ser útiles para os usuarios de Tux Paint.

SDL_VIDEO_ALLOW_SCREENSAVER @@ -124,7 +124,7 @@

- Requests where to position Tux Paint's window. Normally set to "center" by Tux Paint itself, unless the environment variable is already set (e.g., to "nopref", meaning "no preference").

+ Requests where to position Tux Paint's window, and can be used to specify what display to place a fullscreen Tux Paint in a multi-monitor configuration. If not set, or set to "nopref" (meaning "no preference"), Simple DirectMedia Layer (libSDL) decides. Can be set to an X,Y coordinate (e.g. 200,100), or "center" (meaning "center").

diff --git a/docs/ja_JP.UTF-8/ENVVARS.txt b/docs/ja_JP.UTF-8/ENVVARS.txt index 79325fe76..978a29260 100644 --- a/docs/ja_JP.UTF-8/ENVVARS.txt +++ b/docs/ja_JP.UTF-8/ENVVARS.txt @@ -76,7 +76,7 @@ Language-related environment variables Display-related environment variables The following are a few of the environment variables supported by Simple - DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying + DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. @@ -89,6 +89,9 @@ Display-related environment variables SDL_VIDEO_WINDOW_POS - Requests where to position Tux Paint's window. Normally set to - "center" by Tux Paint itself, unless the environment variable is - already set (e.g., to "nopref", meaning "no preference"). + Requests where to position Tux Paint's window, and can be used to + specify what display to place a fullscreen Tux Paint in a + multi-monitor configuration. If not set, or set to "nopref" + (meaning "no preference"), Simple DirectMedia Layer (libSDL) + decides. Can be set to an X,Y coordinate (e.g. 200,100), or + "center" (meaning "center"). diff --git a/docs/ja_JP.UTF-8/html/ENVVARS.html b/docs/ja_JP.UTF-8/html/ENVVARS.html index b5b9033e5..f14e90c5e 100644 --- a/docs/ja_JP.UTF-8/html/ENVVARS.html +++ b/docs/ja_JP.UTF-8/html/ENVVARS.html @@ -110,7 +110,7 @@ Display-related environment variables

- The following are a few of the environment variables supported by Simple DirectMedia Layer (libSD) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint. + The following are a few of the environment variables supported by Simple DirectMedia Layer (libSDL) — which Tux Paint utilizes for displaying graphics, playing sounds, and receiving mouse, keyboard, and joystick input — and which may be useful to users of Tux Paint.

SDL_VIDEO_ALLOW_SCREENSAVER @@ -124,7 +124,7 @@

- Requests where to position Tux Paint's window. Normally set to "center" by Tux Paint itself, unless the environment variable is already set (e.g., to "nopref", meaning "no preference").

+ Requests where to position Tux Paint's window, and can be used to specify what display to place a fullscreen Tux Paint in a multi-monitor configuration. If not set, or set to "nopref" (meaning "no preference"), Simple DirectMedia Layer (libSDL) decides. Can be set to an X,Y coordinate (e.g. 200,100), or "center" (meaning "center").

diff --git a/src/tuxpaint.c b/src/tuxpaint.c index aee63a6f2..353a96854 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - April 27, 2023 + June 14, 2002 - April 28, 2023 */ #include "platform.h" @@ -28954,6 +28954,7 @@ static void setup(void) SDL_Rect dest; int scale; int canvas_width, canvas_height; + int win_x = SDL_WINDOWPOS_UNDEFINED, win_y = SDL_WINDOWPOS_UNDEFINED; #ifndef LOW_QUALITY_COLOR_SELECTOR int x, y; @@ -29176,22 +29177,49 @@ static void setup(void) } + /* SDL1.2 supported "SDL_VIDEO_WINDOW_POS", but SDL2 does not, + so we implement it ourselves */ + if (getenv((char *)"SDL_VIDEO_WINDOW_POS") != NULL) + { + char *winpos; + + winpos = getenv((char *)"SDL_VIDEO_WINDOW_POS"); + if (strcmp(winpos, "nopref") != 0) + { + if (strcmp(winpos, "center") == 0) + { + win_x = SDL_WINDOWPOS_CENTERED; + win_y = SDL_WINDOWPOS_CENTERED; + } + else + { + int success; + + success = sscanf(winpos, "%d,%d", &win_x, &win_y); + if (success != 2) + { + fprintf(stderr, "Warning: Cannot parse SDL_VIDEO_WINDOW_POS value of \"%s\"; ignoring\n", winpos); + win_x = SDL_WINDOWPOS_UNDEFINED; + win_y = SDL_WINDOWPOS_UNDEFINED; + } + } + } + } + + /* Open Window: */ if (fullscreen) { #ifdef USE_HWSURFACE window_screen = - SDL_CreateWindow("Tux Paint", SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, + SDL_CreateWindow("Tux Paint", win_x, win_y, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_HWSURFACE); if (window_screen == NULL) printf("window_screen = NULL 1\n"); #else - window_screen = SDL_CreateWindow(NULL, - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, + window_screen = SDL_CreateWindow(NULL, win_x, win_y, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_FULLSCREEN_DESKTOP); if (window_screen == NULL) printf("window_screen = NULL 2\n"); @@ -29291,7 +29319,6 @@ static void setup(void) if (!fullscreen) { - int win_x = SDL_WINDOWPOS_UNDEFINED, win_y = SDL_WINDOWPOS_UNDEFINED; int max_scrn_w, max_scrn_h; int num_displays, i, res; SDL_DisplayMode mode; @@ -29357,36 +29384,6 @@ static void setup(void) } - /* SDL1.2 supported "SDL_VIDEO_WINDOW_POS", but SDL2 does not, - so we implement it ourselves */ - if (getenv((char *)"SDL_VIDEO_WINDOW_POS") != NULL) - { - char *winpos; - - winpos = getenv((char *)"SDL_VIDEO_WINDOW_POS"); - if (strcmp(winpos, "nopref") != 0) - { - if (strcmp(winpos, "center") == 0) - { - win_x = SDL_WINDOWPOS_CENTERED; - win_y = SDL_WINDOWPOS_CENTERED; - } - else - { - int success; - - success = sscanf(winpos, "%d,%d", &win_x, &win_y); - if (success != 2) - { - fprintf(stderr, "Warning: Cannot parse SDL_VIDEO_WINDOW_POS value of \"%s\"; ignoring\n", winpos); - win_x = SDL_WINDOWPOS_UNDEFINED; - win_y = SDL_WINDOWPOS_UNDEFINED; - } - } - } - } - - /* Finally, ready to create a window! */ #ifdef USE_HWSURFACE window_screen = SDL_CreateWindow("Tux Paint", win_x, win_y, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_HWSURFACE);