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
|
||||
|
|
|
@ -40,8 +40,6 @@ class RootView : public views::View {
|
|||
// Register/Unregister accelerators supported by the menu model.
|
||||
void RegisterAcceleratorsWithFocusManager(AtomMenuModel* menu_model);
|
||||
void UnregisterAcceleratorsWithFocusManager();
|
||||
void SetInsets(const gfx::Insets& insets);
|
||||
gfx::Insets insets() const { return insets_; }
|
||||
|
||||
// views::View:
|
||||
void Layout() override;
|
||||
|
@ -59,8 +57,6 @@ class RootView : public views::View {
|
|||
bool menu_bar_visible_ = false;
|
||||
bool menu_bar_alt_pressed_ = false;
|
||||
|
||||
gfx::Insets insets_;
|
||||
|
||||
// Map from accelerator to menu item's command id.
|
||||
accelerator_util::AcceleratorTable accelerator_table_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue