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

Side by Side Diff: ash/wm/workspace/two_step_edge_cycler.h

Issue 1127133003: Adjusts dragging logic to be less likely to trigger false positive switch from snapping to docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusts docking dragging logic to be more tolerant (nits) Created 5 years, 7 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
« no previous file with comments | « no previous file | ash/wm/workspace/two_step_edge_cycler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ 5 #ifndef ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_
6 #define ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ 6 #define ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 // TwoStepEdgeCycler is responsible for cycling between two modes when the mouse 15 // TwoStepEdgeCycler is responsible for cycling between two modes when the mouse
16 // is at the edge of the workspace. The cycler does not loop so it is impossible 16 // is at the edge of the workspace. The cycler does not loop so it is impossible
17 // to get back to the first mode once the second mode is reached. 17 // to get back to the first mode once the second mode is reached.
18 // TwoStepEdgeCycler should be destroyed once the mouse moves off the edge of 18 // TwoStepEdgeCycler should be destroyed once the mouse moves off the edge of
19 // the workspace. 19 // the workspace.
20 class ASH_EXPORT TwoStepEdgeCycler { 20 class ASH_EXPORT TwoStepEdgeCycler {
21 public: 21 public:
22 explicit TwoStepEdgeCycler(const gfx::Point& start); 22 // The direction in which a mouse should travel to switch mode.
23 enum Direction { DIRECTION_LEFT, DIRECTION_RIGHT };
24
25 explicit TwoStepEdgeCycler(const gfx::Point& start, Direction direction);
23 ~TwoStepEdgeCycler(); 26 ~TwoStepEdgeCycler();
24 27
25 // Update which mode should be used as a result of a mouse / touch move. 28 // Update which mode should be used as a result of a mouse / touch move.
26 // |location| is the location of the event. 29 // |location| is the location of the event.
27 void OnMove(const gfx::Point& location); 30 void OnMove(const gfx::Point& location);
28 31
29 bool use_second_mode() const { return second_mode_; } 32 bool use_second_mode() const { return second_mode_; }
30 33
31 private: 34 private:
32 // Whether the second mode should be used. 35 // Whether the second mode should be used.
33 bool second_mode_; 36 bool second_mode_;
34 37
35 // Time OnMove() was last invoked. 38 // Time OnMove() was last invoked.
36 base::TimeTicks time_last_move_; 39 base::TimeTicks time_last_move_;
37 40
38 // The number of moves since the cycler was constructed. 41 // The number of moves since the cycler was constructed.
39 int num_moves_; 42 int num_moves_;
40 43
41 // Initial x-coordinate. 44 // Initial x-coordinate.
42 int start_x_; 45 int start_x_;
43 46
47 // x-coordinate when paused.
48 int paused_x_;
49
50 // Whether the movement was paused.
51 bool paused_;
52
53 // Determines a preferred movement direction that we are watching.
54 Direction direction_;
55
44 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler); 56 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler);
45 }; 57 };
46 58
47 } // namespace ash 59 } // namespace ash
48 60
49 #endif // ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ 61 #endif // ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/wm/workspace/two_step_edge_cycler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698