Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SetSize() should honor minSize (#13994) #15052

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion atom/browser/api/atom_api_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ gfx::Rect Window::GetContentBounds() {
}

void Window::SetSize(int width, int height, mate::Arguments* args) {
gfx::Size size = window_->GetMinimumSize();
size.SetToMax(gfx::Size(width, height));
bool animate = false;
args->GetNext(&animate);
window_->SetSize(gfx::Size(width, height), animate);
window_->SetSize(size, animate);
}

std::vector<int> Window::GetSize() {
Expand Down
4 changes: 3 additions & 1 deletion docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,9 @@ Disable or enable the window.
* `height` Integer
* `animate` Boolean (optional) _macOS_

Resizes the window to `width` and `height`.
Resizes the window to `width` and `height`. If `width` or `height`
are below any set minimum size constraints the window will snap to
its minimum size.

#### `win.getSize()`

Expand Down