Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: ash/wm/workspace/workspace_event_filter.cc

Issue 9570037: Double clicking the resize handle should expand window along that axis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/workspace_event_filter.h ('k') | ash/wm/workspace/workspace_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/wm/workspace/workspace_event_filter.h ('k') | ash/wm/workspace/workspace_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698