diff options
| author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 17:33:14 +0000 |
|---|---|---|
| committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 17:33:14 +0000 |
| commit | 08090a8f2588b1e03c3766fd676b5a19824d5b62 (patch) | |
| tree | f239d61a904d90c2fb29c94d5eab950e5d759b70 /chrome/views | |
| parent | 76b5257c62a4b7e0d70e734f0d29071323ed137c (diff) | |
| download | chromium_src-08090a8f2588b1e03c3766fd676b5a19824d5b62.zip chromium_src-08090a8f2588b1e03c3766fd676b5a19824d5b62.tar.gz chromium_src-08090a8f2588b1e03c3766fd676b5a19824d5b62.tar.bz2 | |
Support custom border widths. Allow user to resize the window (instead of doing nothing) when over our client edge graphics. Make resize corner behavior on XP more native. More cleanup.
BUG=5054
Review URL: http://codereview.chromium.org/21116
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
| -rw-r--r-- | chrome/views/non_client_view.cc | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index cbf5636..91dd070 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -13,46 +13,47 @@ int NonClientView::GetHTComponentForFrame(const gfx::Point& point, int resize_border_thickness, int resize_corner_size, bool can_resize) { - int component = HTNOWHERE; + // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for + // a |resize_corner_size|-length strip of both the side and top borders, but + // only to return HTBOTTOMLEFT/HTBOTTOMRIGHT along the bottom border + corner + // (not the side border). Vista goes further and doesn't return these on any + // of the side borders. Here we copy the XP behavior. + int component; if (point.x() < resize_border_thickness) { - if (point.y() < resize_corner_size) { + if (point.y() < resize_corner_size) component = HTTOPLEFT; - } else if (point.y() >= (height() - resize_corner_size)) { + else if (point.y() >= (height() - resize_border_thickness)) component = HTBOTTOMLEFT; - } else { + else component = HTLEFT; - } - } else if (point.x() < resize_corner_size) { - if (point.y() < top_resize_border_height) { - component = HTTOPLEFT; - } else if (point.y() >= (height() - resize_border_thickness)) { - component = HTBOTTOMLEFT; - } } else if (point.x() >= (width() - resize_border_thickness)) { - if (point.y() < resize_corner_size) { + if (point.y() < resize_corner_size) component = HTTOPRIGHT; - } else if (point.y() >= (height() - resize_corner_size)) { + else if (point.y() >= (height() - resize_border_thickness)) component = HTBOTTOMRIGHT; - } else { + else component = HTRIGHT; - } - } else if (point.x() >= (width() - resize_corner_size)) { - if (point.y() < top_resize_border_height) { - component = HTTOPRIGHT; - } else if (point.y() >= (height() - resize_border_thickness)) { - component = HTBOTTOMRIGHT; - } } else if (point.y() < top_resize_border_height) { - component = HTTOP; + if (point.x() < resize_corner_size) + component = HTTOPLEFT; + else if (point.x() >= (width() - resize_corner_size)) + component = HTTOPRIGHT; + else + component = HTTOP; } else if (point.y() >= (height() - resize_border_thickness)) { - component = HTBOTTOM; + if (point.x() < resize_corner_size) + component = HTBOTTOMLEFT; + else if (point.x() >= (width() - resize_corner_size)) + component = HTBOTTOMRIGHT; + else + component = HTBOTTOM; + } else { + return HTNOWHERE; } // If the window can't be resized, there are no resize boundaries, just // window borders. - if (component != HTNOWHERE) - return can_resize ? component : HTBORDER; - return HTNOWHERE; + return can_resize ? component : HTBORDER; } } // namespace views |
