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..aff2b273b9c1c7f21759228a482861a5bb874c61 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,32 @@ int FramePainter::GetHeaderOpacity(HeaderMode header_mode, |
| return kInactiveWindowOpacity; |
| } |
| +int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) { |
| + if (hit_code != HTNOWHERE) { |
|
sky
2012/09/05 17:03:24
Why does this logic depend upon having restore bou
Mr4D (OOO till 08-26)
2012/09/06 16:06:54
Due to our snapping: I don't think so. You can get
|
| + // When there is a restore rectangle, a left/right maximized window might |
| + // be active. |
| + if (wm::IsWindowNormal(window_) && GetRestoreBoundsInScreen(window_)) { |
| + gfx::Rect bounds = window_->bounds(); |
| + 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; |
| + } |
| + } |
| + } |
| + } |
| + return hit_code; |
| +} |
| + |
| // static |
| bool FramePainter::UseSoloWindowHeader() { |
| if (!instances_) |