OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |