summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/frame
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-06 05:15:03 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-06 05:15:03 +0000
commit06f35a420e28433170a6c25ac36e21683b8a4430 (patch)
treeba97fcf6f966ad3f5b8bc95143f687e83a2bdf93 /chrome/browser/views/frame
parent6d01474a4466109350986371be9aeb5bfda1eecc (diff)
downloadchromium_src-06f35a420e28433170a6c25ac36e21683b8a4430.zip
chromium_src-06f35a420e28433170a6c25ac36e21683b8a4430.tar.gz
chromium_src-06f35a420e28433170a6c25ac36e21683b8a4430.tar.bz2
Rework nonclient hittest plumbing so the NonClientFrameView is responsible for the whole window's hit testing. Make use of this in the glass frame to add support for HTSYSMENU. Doing this in the opaque frame will be more complex, so that's coming next.
BUG=6961 TEST=Single- and double-clicks on the upper left corner of a Chrome window in Aero glass mode should trigger the system menu and the window closing, respectively. Review URL: http://codereview.chromium.org/573042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/frame')
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.cc2
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.cc18
2 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc
index bc219f0..aa91d12 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/views/frame/browser_frame_gtk.cc
@@ -38,7 +38,7 @@ class PopupNonClientFrameView : public BrowserNonClientFrameView {
return client_bounds;
}
virtual int NonClientHitTest(const gfx::Point& point) {
- return HTNOWHERE;
+ return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
}
virtual void GetWindowMask(const gfx::Size& size,
gfx::Path* window_mask) {}
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc
index f3f5f11..89679a0 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/views/frame/glass_browser_frame_view.cc
@@ -158,15 +158,25 @@ int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
if (!browser_view_->IsBrowserTypeNormal() || !bounds().Contains(point))
return HTNOWHERE;
+ // See if we're in the sysmenu region. We still have to check the tabstrip
+ // first so that clicks in a tab don't get treated as sysmenu clicks.
+ int frame_border_thickness = FrameBorderThickness();
+ int nonclient_border_thickness = NonClientBorderThickness();
+ gfx::Rect sysmenu_rect(nonclient_border_thickness, frame_border_thickness,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON));
+ bool in_sysmenu = sysmenu_rect.Contains(point);
+
int frame_component =
frame_->GetWindow()->GetClientView()->NonClientHitTest(point);
+ if (in_sysmenu)
+ return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU;
if (frame_component != HTNOWHERE)
return frame_component;
- int border_thickness = FrameBorderThickness();
- int window_component = GetHTComponentForFrame(point, border_thickness,
- NonClientBorderThickness(), border_thickness,
- kResizeAreaCornerSize - border_thickness,
+ int window_component = GetHTComponentForFrame(point, frame_border_thickness,
+ nonclient_border_thickness, frame_border_thickness,
+ kResizeAreaCornerSize - frame_border_thickness,
frame_->GetWindow()->GetDelegate()->CanResize());
// Fall back to the caption if no other component matches.
return (window_component == HTNOWHERE) ? HTCAPTION : window_component;