Commit 05ae3cb5 authored by wez@chromium.org's avatar wez@chromium.org

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
parent d62dd5b2
......@@ -842,6 +842,13 @@ SkRegion* NativeAppWindowViews::GetDraggableRegion() {
void NativeAppWindowViews::UpdateInputRegion(scoped_ptr<SkRegion> region) {
input_region_ = region.Pass();
#if defined(USE_AURA)
if (input_region_)
window_->SetShape(new SkRegion(*input_region_));
else
window_->SetShape(NULL);
#endif // defined(USE_AURA)
}
void NativeAppWindowViews::HandleKeyboardEvent(
......
......@@ -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;
......
......@@ -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() {
......
......@@ -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() {
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment