src/video/SDL_video.c
changeset 6681 5a0396a933b5
parent 6671 394e25751ef5
child 6755 af77e1a6faf0
child 8373 46d45dfa5fc7
     1.1 --- a/src/video/SDL_video.c	Wed Nov 21 23:00:06 2012 -0500
     1.2 +++ b/src/video/SDL_video.c	Sun Nov 18 15:45:12 2012 +0300
     1.3 @@ -1563,19 +1563,47 @@
     1.4      CHECK_WINDOW_MAGIC(window, );
     1.5  
     1.6      if (_this && window && window->magic == &_this->window_magic) {
     1.7 -        if (w) {
     1.8 -            *w = window->w;
     1.9 +        *w = window->w;
    1.10 +        *h = window->h;
    1.11 +    }
    1.12 +}
    1.13 +
    1.14 +void
    1.15 +SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
    1.16 +{
    1.17 +    CHECK_WINDOW_MAGIC(window, );
    1.18 +    
    1.19 +    if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
    1.20 +        window->min_w = min_w;
    1.21 +        window->min_h = min_h;
    1.22 +        if (_this->SetWindowMinimumSize) {
    1.23 +            _this->SetWindowMinimumSize(_this, window);
    1.24          }
    1.25 -        if (h) {
    1.26 -            *h = window->h;
    1.27 -        }
    1.28 -    } else {
    1.29 -        if (w) {
    1.30 -            *w = 0;
    1.31 -        }
    1.32 -        if (h) {
    1.33 -            *h = 0;
    1.34 -        }
    1.35 +        /* Ensure that window is not smaller than minimal size */
    1.36 +        SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
    1.37 +    }
    1.38 +}
    1.39 +
    1.40 +void
    1.41 +SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h)
    1.42 +{
    1.43 +    int dummy;
    1.44 +    
    1.45 +    if (!min_w) {
    1.46 +        min_w = &dummy;
    1.47 +    }
    1.48 +    if (!min_h) {
    1.49 +        min_h = &dummy;
    1.50 +    }
    1.51 +    
    1.52 +    *min_w = 0;
    1.53 +    *min_h = 0;
    1.54 +    
    1.55 +    CHECK_WINDOW_MAGIC(window, );
    1.56 +    
    1.57 +    if (_this && window && window->magic == &_this->window_magic) {
    1.58 +        *min_w = window->min_w;
    1.59 +        *min_h = window->min_h;
    1.60      }
    1.61  }
    1.62