diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 22a66155b..2aa84f3a3 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -55,6 +55,13 @@ https://tuxpaint.org/ native size. (SDL2.0) TOYAMA Shin-ichi + * If only one display is available, when running in windowed mode + and asking for Tux Paint to appear in a width and/or height larger + than the display's dimensions, Tux Paint will fall back to + the maximum(s) the display is capable of. + (Closes https://sourceforge.net/p/tuxpaint/feature-requests/113/) + Bill Kendrick + * Changed default UI font from Bitstream Vera to DejaVu Sans. h/t Mark Kim diff --git a/docs/en/OPTIONS.txt b/docs/en/OPTIONS.txt index f520402f5..358508e19 100644 --- a/docs/en/OPTIONS.txt +++ b/docs/en/OPTIONS.txt @@ -126,6 +126,11 @@ Video/Sound * 768x1024 * 1600x1200 + 💡 If only one display is available, and Tux Paint is being run in + windowed (not fullscreen) mode, and the chosen window size exceeds + the capabilities of the display, Tux Paint will fall back to the + display's dimensions. + orient=portrait Swaps the width/height options given to Tux Paint, useful for diff --git a/docs/en/html/OPTIONS.html b/docs/en/html/OPTIONS.html index 078cbdf8d..f00fadd70 100644 --- a/docs/en/html/OPTIONS.html +++ b/docs/en/html/OPTIONS.html @@ -298,6 +298,9 @@
  • 1600x1200
  • + +

    + 💡 If only one display is available, and Tux Paint is being run in windowed (not fullscreen) mode, and the chosen window size exceeds the capabilities of the display, Tux Paint will fall back to the display's dimensions.

    diff --git a/docs/es_ES.UTF-8/OPTIONS.txt b/docs/es_ES.UTF-8/OPTIONS.txt index 391df57cd..715cc82bc 100644 --- a/docs/es_ES.UTF-8/OPTIONS.txt +++ b/docs/es_ES.UTF-8/OPTIONS.txt @@ -126,6 +126,11 @@ Video/Sound * 768x1024 * 1600x1200 + 💡 If only one display is available, and Tux Paint is being run in + windowed (not fullscreen) mode, and the chosen window size exceeds + the capabilities of the display, Tux Paint will fall back to the + display's dimensions. + orient=portrait Swaps the width/height options given to Tux Paint, useful for diff --git a/docs/es_ES.UTF-8/html/OPTIONS.html b/docs/es_ES.UTF-8/html/OPTIONS.html index a40e817b9..e50b57dc9 100644 --- a/docs/es_ES.UTF-8/html/OPTIONS.html +++ b/docs/es_ES.UTF-8/html/OPTIONS.html @@ -298,6 +298,9 @@
  • 1600x1200
  • + +

    + 💡 If only one display is available, and Tux Paint is being run in windowed (not fullscreen) mode, and the chosen window size exceeds the capabilities of the display, Tux Paint will fall back to the display's dimensions.

    diff --git a/docs/fr_FR.UTF-8/OPTIONS.txt b/docs/fr_FR.UTF-8/OPTIONS.txt index 1710d4b09..ca806f906 100644 --- a/docs/fr_FR.UTF-8/OPTIONS.txt +++ b/docs/fr_FR.UTF-8/OPTIONS.txt @@ -133,6 +133,11 @@ Vidéo/Son * 768x1024 * 1600x1200 + 💡 If only one display is available, and Tux Paint is being run in + windowed (not fullscreen) mode, and the chosen window size exceeds + the capabilities of the display, Tux Paint will fall back to the + display's dimensions. + orient=portrait Permute les options de largeur / hauteur données à Tux Paint, diff --git a/docs/fr_FR.UTF-8/html/OPTIONS.html b/docs/fr_FR.UTF-8/html/OPTIONS.html index 19e1d36b8..ae0c1b4b3 100644 --- a/docs/fr_FR.UTF-8/html/OPTIONS.html +++ b/docs/fr_FR.UTF-8/html/OPTIONS.html @@ -298,6 +298,9 @@
  • 1600x1200
  • + +

    + 💡 If only one display is available, and Tux Paint is being run in windowed (not fullscreen) mode, and the chosen window size exceeds the capabilities of the display, Tux Paint will fall back to the display's dimensions.

    diff --git a/docs/gl_ES.UTF-8/OPTIONS.txt b/docs/gl_ES.UTF-8/OPTIONS.txt index abd0407e2..0041086e1 100644 --- a/docs/gl_ES.UTF-8/OPTIONS.txt +++ b/docs/gl_ES.UTF-8/OPTIONS.txt @@ -135,6 +135,11 @@ Video/Sound * 768x1024 * 1600x1200 + 💡 If only one display is available, and Tux Paint is being run in + windowed (not fullscreen) mode, and the chosen window size exceeds + the capabilities of the display, Tux Paint will fall back to the + display's dimensions. + orient=portrait Cambia as opcións de largo/alto dadas a Tux Paint, útiles para diff --git a/docs/gl_ES.UTF-8/html/OPTIONS.html b/docs/gl_ES.UTF-8/html/OPTIONS.html index 880fa5f8c..ef1f1eeaf 100644 --- a/docs/gl_ES.UTF-8/html/OPTIONS.html +++ b/docs/gl_ES.UTF-8/html/OPTIONS.html @@ -298,6 +298,9 @@
  • 1600x1200
  • + +

    + 💡 If only one display is available, and Tux Paint is being run in windowed (not fullscreen) mode, and the chosen window size exceeds the capabilities of the display, Tux Paint will fall back to the display's dimensions.

    diff --git a/docs/ja_JP.UTF-8/OPTIONS.txt b/docs/ja_JP.UTF-8/OPTIONS.txt index 8cc0bc902..ab7664dd4 100644 --- a/docs/ja_JP.UTF-8/OPTIONS.txt +++ b/docs/ja_JP.UTF-8/OPTIONS.txt @@ -111,6 +111,11 @@ Windows のユーザー * 768x1024 * 1600x1200 + 💡 If only one display is available, and Tux Paint is being run in + windowed (not fullscreen) mode, and the chosen window size exceeds + the capabilities of the display, Tux Paint will fall back to the + display's dimensions. + orient=portrait ウィンドウの幅と高さの設定を入れ替えます。これは、タブレットパソコンのような縦型のディスプレイでウィンドウを回転させる際に便利なオプションです。 diff --git a/docs/ja_JP.UTF-8/html/OPTIONS.html b/docs/ja_JP.UTF-8/html/OPTIONS.html index 68fbec35e..cd141bdc6 100644 --- a/docs/ja_JP.UTF-8/html/OPTIONS.html +++ b/docs/ja_JP.UTF-8/html/OPTIONS.html @@ -298,6 +298,9 @@
  • 1600x1200
  • + +

    + 💡 If only one display is available, and Tux Paint is being run in windowed (not fullscreen) mode, and the chosen window size exceeds the capabilities of the display, Tux Paint will fall back to the display's dimensions.

    diff --git a/src/tuxpaint.c b/src/tuxpaint.c index c118fb75e..5787f7a91 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -14399,9 +14399,6 @@ static void load_starter(char *img_id) if (tmp_surf != NULL) { img_starter = SDL_DisplayFormatAlpha(tmp_surf); - //SDL_SetSurfaceAlphaMod(img_starter, SDL_ALPHA_OPAQUE); - //SDL_SetSurfaceBlendMode(img_starter, SDL_BLENDMODE_BLEND); - printf("QQQQ\n"); SDL_FreeSurface(tmp_surf); } @@ -30011,10 +30008,58 @@ static void setup(void) if (!fullscreen) { int win_x = SDL_WINDOWPOS_UNDEFINED, win_y = SDL_WINDOWPOS_UNDEFINED; + int found_capable_display, max_scrn_w, max_scrn_h; + int num_displays, num_modes, i, res; + SDL_DisplayMode mode; + + /* Query all displays to ensure that, if we only have on display, + that Tux Paint's window will not be larger than it */ + found_capable_display = 0; + max_scrn_w = -1; + max_scrn_h = -1; + + num_displays = SDL_GetNumVideoDisplays(); + if (num_displays == 0) { + fprintf(stderr, "Warning: SDL_GetNumVideoDisplays() returned zero!"); + } else if (num_displays < 0) { + fprintf(stderr, "Warning: SDL_GetNumVideoDisplays() failed: %s\n", SDL_GetError()); + } else { + for (i = 0; i < num_displays; i++) { + res = SDL_GetCurrentDisplayMode(i, &mode); + if (res != 0) { + fprintf(stderr, "Warning: SDL_GetCurrentDisplayMode() on display %d %d failed: %s\n", i, SDL_GetError()); + } else { + if (mode.w >= WINDOW_WIDTH && mode.h >= WINDOW_HEIGHT) { + /* Found a display capable of the chosen window size */ + found_capable_display = 1; + } else { + if (mode.w >= max_scrn_w) + max_scrn_w = mode.w; + if (mode.h >= max_scrn_h) + max_scrn_h = mode.h; + } + } + } + } + + if (max_scrn_w == -1) { + fprintf(stderr, "Warning: Could not query any display modes!?\n"); + } else if (num_displays == 1) { + /* Only found one display, and window size is larger? Use that window size */ + if (WINDOW_WIDTH > max_scrn_w) { + fprintf(stderr, "Asked for window width (%d) larger than max screen width (%d)\n", WINDOW_WIDTH, max_scrn_w); + WINDOW_WIDTH = max_scrn_w; + } + + if (WINDOW_HEIGHT > max_scrn_h) { + fprintf(stderr, "Asked for window height (%d) larger than max screen height (%d)\n", WINDOW_HEIGHT, max_scrn_h); + WINDOW_HEIGHT = max_scrn_h; + } + } + /* 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; @@ -30037,9 +30082,9 @@ static void setup(void) } } + + /* Finally, ready to create a window! */ #ifdef USE_HWSURFACE - /* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, - VIDEO_BPP, SDL_HWSURFACE); */ window_screen = SDL_CreateWindow("Tux Paint", win_x, win_y, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_HWSURFACE); if (window_screen == NULL)