Skip to content

Commit

Permalink
mir: Set the max/min w/h vs just setting the window w/h
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonSchaefer committed Mar 18, 2017
1 parent 60ba855 commit c35f46d
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/video/mir/SDL_mirwindow.c
Expand Up @@ -249,35 +249,49 @@ MIR_HideWindow(_THIS, SDL_Window* window)
UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden);
}

static void
UpdateMirWindowSize(MIR_Data* mir_data, MIR_Window* mir_window, int width, int height)
void
MIR_SetWindowSize(_THIS, SDL_Window* window)
{
MIR_Data* mir_data = _this->driverdata;
MIR_Window* mir_window = window->driverdata;

if (IsMirWindowValid(mir_window)) {
MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
MIR_mir_window_spec_set_width (spec, width);
MIR_mir_window_spec_set_height(spec, height);
MIR_mir_window_spec_set_width (spec, window->w);
MIR_mir_window_spec_set_height(spec, window->h);

MIR_mir_window_apply_spec(mir_window->window, spec);
MIR_mir_window_spec_release(spec);
}
}

void
MIR_SetWindowSize(_THIS, SDL_Window* window)
{
UpdateMirWindowSize(_this->driverdata, window->driverdata, window->w, window->h);
}

void
MIR_SetWindowMinimumSize(_THIS, SDL_Window* window)
{
UpdateMirWindowSize(_this->driverdata, window->driverdata, window->min_w, window->min_h);
MIR_Data* mir_data = _this->driverdata;
MIR_Window* mir_window = window->driverdata;

if (IsMirWindowValid(mir_window)) {
MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
MIR_mir_window_spec_set_min_width (spec, window->min_w);
MIR_mir_window_spec_set_min_height(spec, window->min_h);

MIR_mir_window_apply_spec(mir_window->window, spec);
}
}

void
MIR_SetWindowMaximumSize(_THIS, SDL_Window* window)
{
UpdateMirWindowSize(_this->driverdata, window->driverdata, window->max_w, window->max_h);
MIR_Data* mir_data = _this->driverdata;
MIR_Window* mir_window = window->driverdata;

if (IsMirWindowValid(mir_window)) {
MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
MIR_mir_window_spec_set_max_width (spec, window->max_w);
MIR_mir_window_spec_set_max_height(spec, window->max_h);

MIR_mir_window_apply_spec(mir_window->window, spec);
}
}

void
Expand Down

0 comments on commit c35f46d

Please sign in to comment.