fix: Add support for Wayland window decorations (#29618)

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
This commit is contained in:
Ryan Gonzalez 2022-01-26 15:59:09 -06:00 committed by GitHub
parent cabad35383
commit 7caa88c46f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 914 additions and 16 deletions

View file

@ -33,7 +33,11 @@ void FramelessView::Init(NativeWindowViews* window, views::Widget* frame) {
}
int FramelessView::ResizingBorderHitTest(const gfx::Point& point) {
// Check the frame first, as we allow a small area overlapping the contents
return ResizingBorderHitTestImpl(point, gfx::Insets(kResizeInsideBoundsSize));
}
int FramelessView::ResizingBorderHitTestImpl(const gfx::Point& point,
const gfx::Insets& resize_border) {
// to be used for resize handles.
bool can_ever_resize = frame_->widget_delegate()
? frame_->widget_delegate()->CanResize()
@ -47,12 +51,11 @@ int FramelessView::ResizingBorderHitTest(const gfx::Point& point) {
// Don't allow overlapping resize handles when the window is maximized or
// fullscreen, as it can't be resized in those states.
int resize_border = frame_->IsMaximized() || frame_->IsFullscreen()
? 0
: kResizeInsideBoundsSize;
return GetHTComponentForFrame(point, gfx::Insets(resize_border),
kResizeAreaCornerSize, kResizeAreaCornerSize,
can_ever_resize);
bool allow_overlapping_handles =
!frame_->IsMaximized() && !frame_->IsFullscreen();
return GetHTComponentForFrame(
point, allow_overlapping_handles ? resize_border : gfx::Insets(),
kResizeAreaCornerSize, kResizeAreaCornerSize, can_ever_resize);
}
gfx::Rect FramelessView::GetBoundsForClientView() const {