diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:07:04 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:07:04 +0000 |
commit | 26c2b6d2361d8b407291b0893981c1e1e66e850f (patch) | |
tree | 1fb6a6beee3cac737c059accfa05aea4c8de7a1c /ash | |
parent | 6dbb699eada8156876ef8e44e487f29ef594971a (diff) | |
download | chromium_src-26c2b6d2361d8b407291b0893981c1e1e66e850f.zip chromium_src-26c2b6d2361d8b407291b0893981c1e1e66e850f.tar.gz chromium_src-26c2b6d2361d8b407291b0893981c1e1e66e850f.tar.bz2 |
ash: Add a system gesture for the desktop.
The last active window is activated when 4-finger swipe-up happens
on the empty desktop. This is useful to quickly restore the last
window (e.g. after minimizing it with a 4-finger swipe down).
BUG=138643
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10806083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/wm/system_gesture_event_filter.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index 14941cf..871129f 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -41,7 +41,7 @@ namespace { using views::Widget; -const int kSystemPinchPoints = 4; +const int kSystemGesturePoints = 4; const int kAffordanceOuterRadius = 60; const int kAffordanceInnerRadius = 50; @@ -376,7 +376,7 @@ class SystemPinchHandler { switch (event.type()) { case ui::ET_GESTURE_END: { - if (event.details().touch_points() > kSystemPinchPoints) + if (event.details().touch_points() > kSystemGesturePoints) break; if (phantom_state_ == PHANTOM_WINDOW_MAXIMIZED) { @@ -598,6 +598,24 @@ ui::GestureStatus SystemGestureEventFilter::PreHandleGestureEvent( if (!system_target) return ui::GESTURE_STATUS_UNKNOWN; + RootWindowController* root_controller = + wm::GetRootWindowController(system_target->GetRootWindow()); + CHECK(root_controller); + aura::Window* desktop_container = root_controller->GetContainer( + ash::internal::kShellWindowId_DesktopBackgroundContainer); + if (desktop_container->Contains(system_target)) { + // The gesture was on the desktop window. + if (event->type() == ui::ET_GESTURE_MULTIFINGER_SWIPE && + event->details().swipe_up() && + event->details().touch_points() == kSystemGesturePoints) { + ash::AcceleratorController* accelerator = + ash::Shell::GetInstance()->accelerator_controller(); + if (accelerator->PerformAction(CYCLE_BACKWARD_MRU, ui::Accelerator())) + return ui::GESTURE_STATUS_CONSUMED; + } + return ui::GESTURE_STATUS_UNKNOWN; + } + WindowPinchHandlerMap::iterator find = pinch_handlers_.find(system_target); if (find != pinch_handlers_.end()) { SystemGestureStatus status = @@ -607,7 +625,7 @@ ui::GestureStatus SystemGestureEventFilter::PreHandleGestureEvent( return ui::GESTURE_STATUS_CONSUMED; } else { if (event->type() == ui::ET_GESTURE_BEGIN && - event->details().touch_points() >= kSystemPinchPoints) { + event->details().touch_points() >= kSystemGesturePoints) { pinch_handlers_[system_target] = new SystemPinchHandler(system_target); system_target->AddObserver(this); return ui::GESTURE_STATUS_CONSUMED; |