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

Side by Side Diff: ash/wm/workspace/workspace_cycler.cc

Issue 12209109: Switch ending workspace cycling to when the user lifts their fingers off the track pad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_cycler.h" 5 #include "ash/wm/workspace/workspace_cycler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/workspace/workspace_manager.h" 10 #include "ash/wm/workspace/workspace_manager.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 void WorkspaceCycler::OnEvent(ui::Event* event) { 97 void WorkspaceCycler::OnEvent(ui::Event* event) {
98 if (!IsCyclingAllowed()) 98 if (!IsCyclingAllowed())
99 SetState(NOT_CYCLING); 99 SetState(NOT_CYCLING);
100 100
101 ui::EventHandler::OnEvent(event); 101 ui::EventHandler::OnEvent(event);
102 } 102 }
103 103
104 void WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) { 104 void WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
105 // End cycling when the user taps after having cycled through workspaces. 105 if (state_ != NOT_CYCLING && event->type() == ui::ET_SCROLL_FLING_START) {
106 // TODO(pkotwicz): Use ui::ET_SCROLL_FLING_START instead to end cycling once
107 // it works for three fingers. (http://crbug.com/170484)
108 if (state_ != NOT_CYCLING && event->type() == ui::ET_SCROLL_FLING_CANCEL) {
109 SetState(STOPPING_CYCLING); 106 SetState(STOPPING_CYCLING);
110 event->StopPropagation(); 107 event->StopPropagation();
111 return; 108 return;
112 } 109 }
113 110
114 if (event->finger_count() != 3 || 111 if (event->finger_count() != 3 ||
115 event->type() != ui::ET_SCROLL) { 112 event->type() != ui::ET_SCROLL) {
116 if (state_ != NOT_CYCLING) 113 if (state_ != NOT_CYCLING)
117 event->StopPropagation(); 114 event->StopPropagation();
118 return; 115 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 animator_.reset(); 163 animator_.reset();
167 SetState(NOT_CYCLING); 164 SetState(NOT_CYCLING);
168 165
169 // Activate the workspace after updating the state so that a call to 166 // Activate the workspace after updating the state so that a call to
170 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. 167 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop.
171 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); 168 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate);
172 } 169 }
173 170
174 } // namespace internal 171 } // namespace internal
175 } // namespace ash 172 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698