fix: adjust window size in NCCALCSIZE instead of adding insets (#19883)
This commit is contained in:
parent
080fdb3817
commit
f6c523db13
3 changed files with 28 additions and 37 deletions
|
@ -176,18 +176,14 @@ void RootView::Layout() {
|
|||
return;
|
||||
|
||||
const auto menu_bar_bounds =
|
||||
menu_bar_visible_
|
||||
? gfx::Rect(insets_.left(), insets_.top(),
|
||||
size().width() - insets_.width(), kMenuBarHeight)
|
||||
: gfx::Rect();
|
||||
menu_bar_visible_ ? gfx::Rect(0, 0, size().width(), kMenuBarHeight)
|
||||
: gfx::Rect();
|
||||
if (menu_bar_)
|
||||
menu_bar_->SetBoundsRect(menu_bar_bounds);
|
||||
|
||||
window_->content_view()->SetBoundsRect(
|
||||
gfx::Rect(insets_.left(),
|
||||
menu_bar_visible_ ? menu_bar_bounds.bottom() : insets_.top(),
|
||||
size().width() - insets_.width(),
|
||||
size().height() - menu_bar_bounds.height() - insets_.height()));
|
||||
gfx::Rect(0, menu_bar_visible_ ? menu_bar_bounds.bottom() : 0,
|
||||
size().width(), size().height() - menu_bar_bounds.height()));
|
||||
}
|
||||
|
||||
gfx::Size RootView::GetMinimumSize() const {
|
||||
|
@ -224,11 +220,4 @@ void RootView::UnregisterAcceleratorsWithFocusManager() {
|
|||
focus_manager->UnregisterAccelerators(this);
|
||||
}
|
||||
|
||||
void RootView::SetInsets(const gfx::Insets& insets) {
|
||||
if (insets != insets_) {
|
||||
insets_ = insets;
|
||||
Layout();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue