| Index: ash/wm/workspace/workspace_event_filter.cc
|
| ===================================================================
|
| --- ash/wm/workspace/workspace_event_filter.cc (revision 124527)
|
| +++ ash/wm/workspace/workspace_event_filter.cc (working copy)
|
| @@ -9,9 +9,13 @@
|
| #include "ash/wm/window_util.h"
|
| #include "ash/wm/workspace/workspace_layout_manager.h"
|
| #include "ash/wm/workspace/workspace_window_resizer.h"
|
| +#include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/event.h"
|
| +#include "ui/aura/screen_aura.h"
|
| #include "ui/aura/window.h"
|
| +#include "ui/aura/window_delegate.h"
|
| #include "ui/base/hit_test.h"
|
| +#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
|
|
|
| namespace {
|
|
|
| @@ -26,6 +30,19 @@
|
| window_frame->OnWindowHoverChanged(hovered);
|
| }
|
|
|
| +void SingleAxisMaximize(aura::Window* window, const gfx::Rect& maximize_rect) {
|
| + window->ClearProperty(aura::client::kRestoreBoundsKey);
|
| + window->SetProperty(aura::client::kRestoreBoundsKey,
|
| + new gfx::Rect(window->bounds()));
|
| + window->SetBounds(maximize_rect);
|
| +}
|
| +
|
| +void SingleAxisUnmaximize(aura::Window* window,
|
| + const gfx::Rect& restore_bounds) {
|
| + window->SetBounds(restore_bounds);
|
| + window->ClearProperty(aura::client::kRestoreBoundsKey);
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace ash {
|
| @@ -51,6 +68,9 @@
|
| case ui::ET_MOUSE_EXITED:
|
| UpdateHoveredWindow(NULL);
|
| break;
|
| + case ui::ET_MOUSE_PRESSED:
|
| + HandleVerticalResizeDoubleClick(target, event);
|
| + break;
|
| default:
|
| break;
|
| }
|
| @@ -90,5 +110,43 @@
|
| hovered_window_->AddObserver(this);
|
| }
|
|
|
| +void WorkspaceEventFilter::HandleVerticalResizeDoubleClick(
|
| + aura::Window* target,
|
| + aura::MouseEvent* event) {
|
| + if (event->flags() & ui::EF_IS_DOUBLE_CLICK) {
|
| + int component =
|
| + target->delegate()->GetNonClientComponent(event->location());
|
| + gfx::Rect work_area =
|
| + gfx::Screen::GetMonitorWorkAreaNearestWindow(target);
|
| + const gfx::Rect* restore_bounds =
|
| + target->GetProperty(aura::client::kRestoreBoundsKey);
|
| + if (component == HTBOTTOM || component == HTTOP) {
|
| + if (restore_bounds &&
|
| + (target->bounds().height() == work_area.height() &&
|
| + target->bounds().y() == work_area.y())) {
|
| + SingleAxisUnmaximize(target, *restore_bounds);
|
| + } else {
|
| + SingleAxisMaximize(target,
|
| + gfx::Rect(target->bounds().x(),
|
| + work_area.y(),
|
| + target->bounds().width(),
|
| + work_area.height()));
|
| + }
|
| + } else if (component == HTLEFT || component == HTRIGHT) {
|
| + if (restore_bounds &&
|
| + (target->bounds().width() == work_area.width() &&
|
| + target->bounds().x() == work_area.x())) {
|
| + SingleAxisUnmaximize(target, *restore_bounds);
|
| + } else {
|
| + SingleAxisMaximize(target,
|
| + gfx::Rect(work_area.x(),
|
| + target->bounds().y(),
|
| + work_area.width(),
|
| + target->bounds().height()));
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace internal
|
| } // namespace ash
|
|
|