summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 01:15:59 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 01:15:59 +0000
commit6c856ae733bf8d1f187ec5b93e07216ace0c4693 (patch)
tree1bca8fe2359b7334d99bfba154876e38ba319688 /views
parent1f97d19d40c07ecc87070a9dd616f966f9f7619e (diff)
downloadchromium_src-6c856ae733bf8d1f187ec5b93e07216ace0c4693.zip
chromium_src-6c856ae733bf8d1f187ec5b93e07216ace0c4693.tar.gz
chromium_src-6c856ae733bf8d1f187ec5b93e07216ace0c4693.tar.bz2
Revert 30903 - Gets find bar animation/clipping to work on views/gtk.
BUG=none TEST=none Review URL: http://codereview.chromium.org/340077 TBR=sky@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/view.cc8
-rw-r--r--views/widget/widget.h4
-rw-r--r--views/widget/widget_gtk.cc4
-rw-r--r--views/widget/widget_gtk.h2
-rw-r--r--views/widget/widget_win.cc4
-rw-r--r--views/widget/widget_win.h2
-rw-r--r--views/window/window_gtk.cc2
-rw-r--r--views/window/window_win.cc4
8 files changed, 17 insertions, 13 deletions
diff --git a/views/view.cc b/views/view.cc
index 34ec1c3..1e1cd20 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -429,12 +429,14 @@ bool View::HitTest(const gfx::Point& l) const {
if (HasHitTestMask()) {
gfx::Path mask;
GetHitTestMask(&mask);
- ScopedRegion rgn(mask.CreateNativeRegion());
- // TODO: can this use SkRegion's contains instead?
#if defined(OS_WIN)
+ ScopedHRGN rgn(mask.CreateHRGN());
return !!PtInRegion(rgn, l.x(), l.y());
#elif defined(OS_LINUX)
- return gdk_region_point_in(rgn.Get(), l.x(), l.y());
+ GdkRegion* region = mask.CreateGdkRegion();
+ bool result = gdk_region_point_in(region, l.x(), l.y());
+ gdk_region_destroy(region);
+ return result;
#endif
}
// No mask, but inside our bounds.
diff --git a/views/widget/widget.h b/views/widget/widget.h
index 357f07a..7b08737 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -96,8 +96,8 @@ class Widget {
// Places the widget in front of the specified widget in z-order.
virtual void MoveAbove(Widget* widget) = 0;
- // Sets a shape on the widget. This takes ownership of shape.
- virtual void SetShape(gfx::NativeRegion shape) = 0;
+ // Sets a shape on the widget.
+ virtual void SetShape(const gfx::Path& shape) = 0;
// Hides the widget then closes it after a return to the message loop.
virtual void Close() = 0;
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 4edef7c..4557286 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -378,10 +378,12 @@ void WidgetGtk::MoveAbove(Widget* widget) {
NOTIMPLEMENTED();
}
-void WidgetGtk::SetShape(gfx::NativeRegion region) {
+void WidgetGtk::SetShape(const gfx::Path& shape) {
DCHECK(widget_);
DCHECK(widget_->window);
+ gdk_window_shape_combine_region(widget_->window, NULL, 0, 0);
+ GdkRegion* region = shape.CreateGdkRegion();
gdk_window_shape_combine_region(widget_->window, region, 0, 0);
gdk_region_destroy(region);
}
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index 3799a4a..e97f58e 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -118,7 +118,7 @@ class WidgetGtk
virtual void GetBounds(gfx::Rect* out, bool including_frame) const;
virtual void SetBounds(const gfx::Rect& bounds);
virtual void MoveAbove(Widget* other);
- virtual void SetShape(gfx::NativeRegion region);
+ virtual void SetShape(const gfx::Path& shape);
virtual void Close();
virtual void CloseNow();
virtual void Show();
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index a3dc3ce..e0edee8 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -144,8 +144,8 @@ void WidgetWin::MoveAbove(Widget* other) {
bounds.width(), bounds.height(), SWP_NOACTIVATE);
}
-void WidgetWin::SetShape(gfx::NativeRegion region) {
- SetWindowRgn(region, TRUE);
+void WidgetWin::SetShape(const gfx::Path& shape) {
+ SetWindowRgn(shape.CreateHRGN(), TRUE);
}
void WidgetWin::Close() {
diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h
index f22417c..b8e21dd 100644
--- a/views/widget/widget_win.h
+++ b/views/widget/widget_win.h
@@ -184,7 +184,7 @@ class WidgetWin : public app::WindowImpl,
virtual void GetBounds(gfx::Rect* out, bool including_frame) const;
virtual void SetBounds(const gfx::Rect& bounds);
virtual void MoveAbove(Widget* other);
- virtual void SetShape(gfx::NativeRegion region);
+ virtual void SetShape(const gfx::Path& shape);
virtual void Close();
virtual void CloseNow();
virtual void Show();
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index fff4e74..9bf2071 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -326,7 +326,7 @@ void WindowGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) {
non_client_view_->GetWindowMask(gfx::Size(allocation->width,
allocation->height),
&window_mask);
- GdkRegion* mask_region = window_mask.CreateNativeRegion();
+ GdkRegion* mask_region = window_mask.CreateGdkRegion();
gdk_window_shape_combine_region(GetNativeView()->window, mask_region, 0, 0);
if (mask_region)
gdk_region_destroy(mask_region);
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index 66a1e85..f77b806 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -1355,11 +1355,11 @@ void WindowWin::ResetWindowRegion(bool force) {
gfx::Path window_mask;
non_client_view_->GetWindowMask(
gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask);
- new_region = window_mask.CreateNativeRegion();
+ new_region = window_mask.CreateHRGN();
}
if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) {
- // SetWindowRgn takes ownership of the HRGN created by CreateNativeRegion.
+ // SetWindowRgn takes ownership of the HRGN created by CreateHRGN.
SetWindowRgn(new_region, TRUE);
} else {
DeleteObject(new_region);