Chromium Code Reviews| Index: ash/wm/frame_painter.cc |
| diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc |
| index 244ba858264e339c06aa79846999adec5ad6e943..05735e4668ccfa8ff35516ff9e5d4b2e26c057c7 100644 |
| --- a/ash/wm/frame_painter.cc |
| +++ b/ash/wm/frame_painter.cc |
| @@ -7,6 +7,7 @@ |
| #include "ash/ash_constants.h" |
| #include "ash/shell.h" |
| #include "ash/shell_window_ids.h" |
| +#include "ash/wm/property_util.h" |
| #include "ash/wm/window_util.h" |
| #include "ash/wm/workspace_controller.h" |
| #include "base/logging.h" // DCHECK |
| @@ -26,6 +27,7 @@ |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/font.h" |
| #include "ui/gfx/image/image.h" |
| +#include "ui/gfx/screen.h" |
| #include "ui/views/controls/button/image_button.h" |
| #include "ui/views/widget/widget.h" |
| #include "ui/views/widget/widget_delegate.h" |
| @@ -246,6 +248,7 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view, |
| kResizeAreaCornerSize, |
| kResizeAreaCornerSize, |
| can_ever_resize); |
| + frame_component = AdjustFrameHitCodeForMaximizedModes(frame_component); |
| if (frame_component != HTNOWHERE) |
| return frame_component; |
| @@ -594,6 +597,44 @@ int FramePainter::GetHeaderOpacity(HeaderMode header_mode, |
| return kInactiveWindowOpacity; |
| } |
| +int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) { |
| + if (hit_code != HTNOWHERE && wm::IsWindowNormal(window_) && |
| + GetRestoreBoundsInScreen(window_)) { |
| + // When there is a restore rectangle, a left/right maximized window might |
| + // be active. |
| + gfx::Rect bounds = window_->bounds(); |
|
sky
2012/09/06 19:45:11
const gfx::Rect& here and next line.
And you need
Mr4D (OOO till 08-26)
2012/09/06 23:16:13
Done.
|
| + gfx::Rect screen = gfx::Screen::GetDisplayMatching(bounds).work_area(); |
| + if (bounds.y() == screen.y() && bounds.bottom() == screen.bottom()) { |
| + // The window is probably either left or right maximized. |
| + if (bounds.x() == screen.x()) { |
| + // It is left maximized and we can only allow a right resize. |
| + return (hit_code == HTBOTTOMRIGHT || |
| + hit_code == HTTOPRIGHT || |
| + hit_code == HTRIGHT) ? HTRIGHT : HTNOWHERE; |
| + } else if (bounds.right() == screen.right()) { |
| + // It is right maximized and we can only allow a left resize. |
| + return (hit_code == HTBOTTOMLEFT || |
| + hit_code == HTTOPLEFT || |
| + hit_code == HTLEFT) ? HTLEFT : HTNOWHERE; |
| + } |
| + } else if (bounds.x() == screen.x() && |
| + bounds.right() == screen.right()) { |
| + // If horizontal fill mode is activated we don't allow a left/right |
| + // resizing. |
| + if (bounds.right() == screen.right()) { |
|
sky
2012/09/06 19:45:11
Shouldn't this check y coordinates (620 checks x c
Mr4D (OOO till 08-26)
2012/09/06 23:16:13
Actually - I don't think that any additional check
|
| + if (hit_code == HTTOPRIGHT || |
| + hit_code == HTTOP || |
| + hit_code == HTTOPLEFT) |
| + return HTTOP; |
| + return (hit_code == HTBOTTOMRIGHT || |
| + hit_code == HTBOTTOM || |
| + hit_code == HTBOTTOMLEFT) ? HTBOTTOM : HTNOWHERE; |
| + } |
| + } |
| + } |
| + return hit_code; |
| +} |
| + |
| // static |
| bool FramePainter::UseSoloWindowHeader() { |
| if (!instances_) |