fix: improve the way frameless windows are handled on Windows (#16596)

* fix: improve the way frameless windows are handled on Windows

* tidy up code

* fix: return nullAcceleratedWidget instead of nullptr

* fix: format, use reinterpret cast
This commit is contained in:
Heilig Benedek 2019-01-31 03:19:47 +01:00 committed by Cheng Zhao
parent 49ec7e1582
commit cbb5164cc8
6 changed files with 134 additions and 21 deletions

View file

@ -173,14 +173,18 @@ void RootView::Layout() {
return;
const auto menu_bar_bounds =
menu_bar_visible_ ? gfx::Rect(0, 0, size().width(), kMenuBarHeight)
: gfx::Rect();
menu_bar_visible_
? gfx::Rect(insets_.left(), insets_.top(),
size().width() - insets_.width(), kMenuBarHeight)
: gfx::Rect();
if (menu_bar_)
menu_bar_->SetBoundsRect(menu_bar_bounds);
window_->content_view()->SetBoundsRect(
gfx::Rect(0, menu_bar_bounds.height(), size().width(),
size().height() - menu_bar_bounds.height()));
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::Size RootView::GetMinimumSize() const {
@ -217,4 +221,11 @@ void RootView::UnregisterAcceleratorsWithFocusManager() {
focus_manager->UnregisterAccelerators(this);
}
void RootView::SetInsets(const gfx::Insets& insets) {
if (insets != insets_) {
insets_ = insets;
Layout();
}
}
} // namespace atom