mir: Set the max/min w/h vs just setting the window w/h
authorBrandon Schaefer <brandon.schaefer@canonical.com>
Sat, 18 Mar 2017 13:57:57 -0700
changeset 1094010118eaebdfd
parent 10939 e212b4d00d84
child 10941 e42332dd9f4e
mir: Set the max/min w/h vs just setting the window w/h
src/video/mir/SDL_mirwindow.c
     1.1 --- a/src/video/mir/SDL_mirwindow.c	Thu Mar 16 16:45:12 2017 -0700
     1.2 +++ b/src/video/mir/SDL_mirwindow.c	Sat Mar 18 13:57:57 2017 -0700
     1.3 @@ -249,35 +249,49 @@
     1.4      UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden);
     1.5  }
     1.6  
     1.7 -static void
     1.8 -UpdateMirWindowSize(MIR_Data* mir_data, MIR_Window* mir_window, int width, int height)
     1.9 -{
    1.10 -    if (IsMirWindowValid(mir_window)) {
    1.11 -        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
    1.12 -        MIR_mir_window_spec_set_width (spec, width);
    1.13 -        MIR_mir_window_spec_set_height(spec, height);
    1.14 -
    1.15 -        MIR_mir_window_apply_spec(mir_window->window, spec);
    1.16 -        MIR_mir_window_spec_release(spec);
    1.17 -    }
    1.18 -}
    1.19 -
    1.20  void
    1.21  MIR_SetWindowSize(_THIS, SDL_Window* window)
    1.22  {
    1.23 -    UpdateMirWindowSize(_this->driverdata, window->driverdata, window->w, window->h);
    1.24 +    MIR_Data* mir_data     = _this->driverdata;
    1.25 +    MIR_Window* mir_window = window->driverdata;
    1.26 +
    1.27 +    if (IsMirWindowValid(mir_window)) {
    1.28 +        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
    1.29 +        MIR_mir_window_spec_set_width (spec, window->w);
    1.30 +        MIR_mir_window_spec_set_height(spec, window->h);
    1.31 +
    1.32 +        MIR_mir_window_apply_spec(mir_window->window, spec);
    1.33 +    }
    1.34  }
    1.35  
    1.36  void
    1.37  MIR_SetWindowMinimumSize(_THIS, SDL_Window* window)
    1.38  {
    1.39 -    UpdateMirWindowSize(_this->driverdata, window->driverdata, window->min_w, window->min_h);
    1.40 +    MIR_Data* mir_data     = _this->driverdata;
    1.41 +    MIR_Window* mir_window = window->driverdata;
    1.42 +
    1.43 +    if (IsMirWindowValid(mir_window)) {
    1.44 +        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
    1.45 +        MIR_mir_window_spec_set_min_width (spec, window->min_w);
    1.46 +        MIR_mir_window_spec_set_min_height(spec, window->min_h);
    1.47 +
    1.48 +        MIR_mir_window_apply_spec(mir_window->window, spec);
    1.49 +    }
    1.50  }
    1.51  
    1.52  void
    1.53  MIR_SetWindowMaximumSize(_THIS, SDL_Window* window)
    1.54  {
    1.55 -    UpdateMirWindowSize(_this->driverdata, window->driverdata, window->max_w, window->max_h);
    1.56 +    MIR_Data* mir_data     = _this->driverdata;
    1.57 +    MIR_Window* mir_window = window->driverdata;
    1.58 +
    1.59 +    if (IsMirWindowValid(mir_window)) {
    1.60 +        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
    1.61 +        MIR_mir_window_spec_set_max_width (spec, window->max_w);
    1.62 +        MIR_mir_window_spec_set_max_height(spec, window->max_h);
    1.63 +
    1.64 +        MIR_mir_window_apply_spec(mir_window->window, spec);
    1.65 +    }
    1.66  }
    1.67  
    1.68  void