| Index: ui/views/mus/native_widget_mus.cc
|
| diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
|
| index 45d09e9f5be8b093785a8ce2b8b472b5438baca0..53a7d93ce732814243a38816a46214e9e089b31a 100644
|
| --- a/ui/views/mus/native_widget_mus.cc
|
| +++ b/ui/views/mus/native_widget_mus.cc
|
| @@ -28,6 +28,7 @@
|
| #include "ui/base/hit_test.h"
|
| #include "ui/events/event.h"
|
| #include "ui/gfx/canvas.h"
|
| +#include "ui/gfx/path.h"
|
| #include "ui/native_theme/native_theme_aura.h"
|
| #include "ui/platform_window/platform_window_delegate.h"
|
| #include "ui/views/mus/platform_window_mus.h"
|
| @@ -493,6 +494,7 @@ void NativeWidgetMus::NotifyFrameChanged(
|
| native_widget->GetWidget()->non_client_view()->Layout();
|
| native_widget->GetWidget()->non_client_view()->SchedulePaint();
|
| native_widget->UpdateClientArea();
|
| + native_widget->UpdateHitTestMask();
|
| }
|
| }
|
| }
|
| @@ -674,6 +676,7 @@ void NativeWidgetMus::OnWidgetInitDone() {
|
| // function is called the NonClientView has been created, so that we can
|
| // correctly calculate the client area and push it to the mus::Window.
|
| UpdateClientArea();
|
| + UpdateHitTestMask();
|
| }
|
|
|
| bool NativeWidgetMus::ShouldUseNativeFrame() const {
|
| @@ -1156,6 +1159,7 @@ void NativeWidgetMus::OnBoundsChanged(const gfx::Rect& old_bounds,
|
| if (old_bounds.size() != new_bounds.size()) {
|
| native_widget_delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
|
| UpdateClientArea();
|
| + UpdateHitTestMask();
|
| }
|
| }
|
|
|
| @@ -1301,4 +1305,23 @@ void NativeWidgetMus::OnMusWindowVisibilityChanged(mus::Window* window) {
|
| native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible());
|
| }
|
|
|
| +void NativeWidgetMus::UpdateHitTestMask() {
|
| + // The window manager (or other underlay window provider) is not allowed to
|
| + // set a hit test mask, as that could interfere with a client app mask.
|
| + if (surface_type_ == mus::mojom::SurfaceType::UNDERLAY)
|
| + return;
|
| +
|
| + if (!native_widget_delegate_->HasHitTestMask()) {
|
| + window_->ClearHitTestMask();
|
| + return;
|
| + }
|
| +
|
| + gfx::Path mask_path;
|
| + native_widget_delegate_->GetHitTestMask(&mask_path);
|
| + // TODO(jamescook): Use the full path for the mask.
|
| + gfx::Rect mask_rect =
|
| + gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
|
| + window_->SetHitTestMask(mask_rect);
|
| +}
|
| +
|
| } // namespace views
|
|
|