Skip to content

Commit

Permalink
Fixed bug 5323 - SDL_SetWindowMaximumSize fails if Width or Height is…
Browse files Browse the repository at this point in the history
… equal to minimum Height or Width

batyastudios

Basicly there is problem and somewhat a solution: https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267

If you SDL_SetWindowMaximumSize() after SDL_SetWindowMinimumSize() with one of axes have the same value, function will have no effect.

This: (line 2144@SDL_video.c)
if (max_w <= window->min_w || max_h <= window->min_h) {
    SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
    return;
}

May be changed to this:
if (max_w < window->min_w || max_h < window->min_h) {
    SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
    return;
}
  • Loading branch information
slouken committed Oct 20, 2020
1 parent cbadd1e commit f1b603a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/video/SDL_video.c
Expand Up @@ -2152,8 +2152,8 @@ SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
return;
}

if ((window->max_w && min_w >= window->max_w) ||
(window->max_h && min_h >= window->max_h)) {
if ((window->max_w && min_w > window->max_w) ||
(window->max_h && min_h > window->max_h)) {
SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
return;
}
Expand Down Expand Up @@ -2195,7 +2195,7 @@ SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h)
return;
}

if (max_w <= window->min_w || max_h <= window->min_h) {
if (max_w < window->min_w || max_h < window->min_h) {
SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
return;
}
Expand Down

0 comments on commit f1b603a

Please sign in to comment.