summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 02:51:34 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 02:51:34 +0000
commit847dda8ade71638fae9596d4b5102667c29fad1e (patch)
tree961773bbd2b5645cb129869f2ed0f7a50b63c9d6 /chrome/views
parentb01a2c21bfaa8d4a64efa648e3637d9d3c0d3bb1 (diff)
downloadchromium_src-847dda8ade71638fae9596d4b5102667c29fad1e.zip
chromium_src-847dda8ade71638fae9596d4b5102667c29fad1e.tar.gz
chromium_src-847dda8ade71638fae9596d4b5102667c29fad1e.tar.bz2
Fix regression where the window caption buttons weren't clickable when maximized. This is because of the nonclient frameview/clientview hierarchy changes.
Make sure that the frame gets a chance to respond to GetViewForPoint before the client view if the client view does not visually overlap. http://crbug.com/8312 Review URL: http://codereview.chromium.org/40062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/non_client_view.cc30
-rw-r--r--chrome/views/non_client_view.h8
2 files changed, 37 insertions, 1 deletions
diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc
index ca54796..2e7804c 100644
--- a/chrome/views/non_client_view.cc
+++ b/chrome/views/non_client_view.cc
@@ -159,6 +159,36 @@ void NonClientView::ViewHierarchyChanged(bool is_add, View* parent,
}
}
+views::View* NonClientView::GetViewForPoint(const gfx::Point& point) {
+ return GetViewForPoint(point, false);
+}
+
+views::View* NonClientView::GetViewForPoint(const gfx::Point& point,
+ bool can_create_floating) {
+ // Because of the z-ordering of our child views (the client view is positioned
+ // over the non-client frame view, if the client view ever overlaps the frame
+ // view visually (as it does for the browser window), then it will eat mouse
+ // events for the window controls. We override this method here so that we can
+ // detect this condition and re-route the events to the non-client frame view.
+ // The assumption is that the frame view's implementation of HitTest will only
+ // return true for area not occupied by the client view.
+ gfx::Point point_in_child_coords(point);
+ View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords);
+ if (frame_view_->HitTest(point_in_child_coords))
+ return frame_view_->GetViewForPoint(point);
+
+ return View::GetViewForPoint(point, can_create_floating);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// NonClientFrameView, View overrides:
+
+bool NonClientFrameView::HitTest(const gfx::Point& l) const {
+ // For the default case, we assume the non-client frame view never overlaps
+ // the client view.
+ return !GetWidget()->AsWindow()->client_view()->bounds().Contains(l);
+}
+
////////////////////////////////////////////////////////////////////////////////
// NonClientFrameView, protected:
diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h
index f801d6f..32130c3 100644
--- a/chrome/views/non_client_view.h
+++ b/chrome/views/non_client_view.h
@@ -22,7 +22,7 @@ namespace views {
// responds to events within the frame portions of the non-client area of a
// window. This view does _not_ contain the ClientView, but rather is a sibling
// of it.
-class NonClientFrameView : public views::View {
+class NonClientFrameView : public View {
public:
// Various edges of the frame border have a 1 px shadow along their edges; in
// a few cases we shift elements based on this amount for visual appeal.
@@ -55,6 +55,9 @@ class NonClientFrameView : public views::View {
virtual void EnableClose(bool enable) = 0;
virtual void ResetWindowControls() = 0;
+ // Overridden from View:
+ virtual bool HitTest(const gfx::Point& l) const;
+
protected:
NonClientFrameView() : paint_as_active_(false) {}
@@ -191,6 +194,9 @@ class NonClientView : public View {
protected:
// NonClientView, View overrides:
virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+ virtual views::View* GetViewForPoint(const gfx::Point& point);
+ virtual views::View* GetViewForPoint(const gfx::Point& point,
+ bool can_create_floating);
private:
// The frame that hosts this NonClientView.