summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 21:45:34 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 21:45:34 +0000
commit05ae3cb514d685126d57f689e41d318ed3673b02 (patch)
tree2bc8e10d121b288cafd87bfafef2bd5aa968325c /ui
parentd62dd5b23310270796d958083313cc0cbad31205 (diff)
downloadchromium_src-05ae3cb514d685126d57f689e41d318ed3673b02.zip
chromium_src-05ae3cb514d685126d57f689e41d318ed3673b02.tar.gz
chromium_src-05ae3cb514d685126d57f689e41d318ed3673b02.tar.bz2
Plumb native AppWindow input region through to window shape under Aura.
This CL also fixes gfk::NativeRegion leaks in DesktopRootWindowHost for Windows & X11. BUG=310932 Review URL: https://codereview.chromium.org/54983005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host.h2
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_win.cc12
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc17
-rw-r--r--ui/views/widget/widget.h3
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.