diff options
Diffstat (limited to 'ui')
4 files changed, 25 insertions, 9 deletions
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host.h b/ui/views/widget/desktop_aura/desktop_root_window_host.h index ad904fa..77c6150 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host.h @@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopRootWindowHost { virtual gfx::Rect GetWorkAreaBoundsInScreen() const = 0; + // Sets the shape of the root window. If |native_region| is NULL then the + // window reverts to rectangular. Takes ownership of |native_region|. virtual void SetShape(gfx::NativeRegion native_region) = 0; virtual void Activate() = 0; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index 1f85742..2ba7af6 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -236,9 +236,15 @@ gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const { } void DesktopRootWindowHostWin::SetShape(gfx::NativeRegion native_region) { - SkPath path; - native_region->getBoundaryPath(&path); - message_handler_->SetRegion(gfx::CreateHRGNFromSkPath(path)); + if (native_region) { + SkPath path; + native_region->getBoundaryPath(&path); + message_handler_->SetRegion(gfx::CreateHRGNFromSkPath(path)); + } else { + message_handler_->SetRegion(NULL); + } + + delete native_region; } void DesktopRootWindowHostWin::Activate() { diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index 5907f5e..757b509 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -433,11 +433,18 @@ gfx::Rect DesktopRootWindowHostX11::GetWorkAreaBoundsInScreen() const { } void DesktopRootWindowHostX11::SetShape(gfx::NativeRegion native_region) { - SkPath path; - native_region->getBoundaryPath(&path); - Region region = gfx::CreateRegionFromSkPath(path); - XShapeCombineRegion(xdisplay_, xwindow_, ShapeBounding, 0, 0, region, false); - XDestroyRegion(region); + if (native_region) { + SkPath path; + native_region->getBoundaryPath(&path); + Region region = gfx::CreateRegionFromSkPath(path); + XShapeCombineRegion( + xdisplay_, xwindow_, ShapeBounding, 0, 0, region, false); + XDestroyRegion(region); + } else { + ResetWindowRegion(); + } + + delete native_region; } void DesktopRootWindowHostX11::Activate() { diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index 3ff89e4..894ec23 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -419,7 +419,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // Places the widget below the specified NativeView. void StackBelow(gfx::NativeView native_view); - // Sets a shape on the widget. This takes ownership of shape. + // Sets a shape on the widget. Passing a NULL |shape| reverts the widget to + // be rectangular. Takes ownership of |shape|. void SetShape(gfx::NativeRegion shape); // Hides the widget then closes it after a return to the message loop. |