OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 5 #ifndef ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
6 #define ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 6 #define ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
7 | 7 |
8 #include "ash/display/mouse_warp_controller.h" | 8 #include "ash/display/mouse_warp_controller.h" |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, | 45 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
46 IndicatorBoundsTestOnRight); | 46 IndicatorBoundsTestOnRight); |
47 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, | 47 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
48 IndicatorBoundsTestOnLeft); | 48 IndicatorBoundsTestOnLeft); |
49 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, | 49 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
50 IndicatorBoundsTestOnTopBottom); | 50 IndicatorBoundsTestOnTopBottom); |
51 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, | 51 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
52 IndicatorBoundsTestThreeDisplays); | 52 IndicatorBoundsTestThreeDisplays); |
53 | 53 |
54 // Defined in header file because tests need access. | 54 // Defined in header file because tests need access. |
55 struct WarpRegion { | 55 class WarpRegion { |
56 public: | 56 public: |
57 WarpRegion(int64_t a_display_id, | 57 WarpRegion(int64_t a_display_id, |
58 int64_t b_display_id, | 58 int64_t b_display_id, |
59 const gfx::Rect& a_indicator_bounds, | 59 const gfx::Rect& a_indicator_bounds, |
60 const gfx::Rect& b_indicator_bounds); | 60 const gfx::Rect& b_indicator_bounds); |
61 ~WarpRegion(); | 61 ~WarpRegion(); |
62 | 62 |
63 // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be | 63 // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be |
64 // moved to |b_display_id|. Similarily, if the cursor is in | 64 // moved to |b_display_id|. Similarily, if the cursor is in |
65 // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|. | 65 // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|. |
66 | 66 |
67 // The id for the displays. Used for warping the cursor. | 67 // The id for the displays. Used for warping the cursor. |
68 int64_t a_display_id; | 68 int64_t a_display_id; |
69 int64_t b_display_id; | 69 int64_t b_display_id; |
70 | 70 |
71 gfx::Rect a_edge_bounds_in_native; | 71 gfx::Rect a_edge_bounds_in_native; |
72 gfx::Rect b_edge_bounds_in_native; | 72 gfx::Rect b_edge_bounds_in_native; |
73 | 73 |
74 // The bounds for warp hole windows. These are kept in the instance for | 74 // The bounds for warp hole windows. These are kept in the instance for |
75 // testing. | 75 // testing. |
76 gfx::Rect a_indicator_bounds; | 76 gfx::Rect a_indicator_bounds; |
77 gfx::Rect b_indicator_bounds; | 77 gfx::Rect b_indicator_bounds; |
78 | 78 |
79 // Shows the area where a window can be dragged in to/out from another | 79 // Shows the area where a window can be dragged in to/out from another |
80 // display. | 80 // display. |
81 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator; | 81 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator; |
stevenjb
2016/01/25 21:42:55
All members should be named with a trailing _ and
jdufault
2016/01/25 22:48:46
Done.
| |
82 | 82 |
83 private: | 83 private: |
84 DISALLOW_COPY_AND_ASSIGN(WarpRegion); | 84 DISALLOW_COPY_AND_ASSIGN(WarpRegion); |
85 }; | 85 }; |
86 | 86 |
87 std::vector<scoped_ptr<WarpRegion>> warp_regions_; | 87 std::vector<scoped_ptr<WarpRegion>> warp_regions_; |
88 | 88 |
89 // Registers the WarpRegion; also displays a drag indicator on the screen if | 89 // Registers the WarpRegion; also displays a drag indicator on the screen if |
90 // |drag_source| is true. | 90 // |has_drag_source| is true. |
91 void AddWarpRegion(scoped_ptr<WarpRegion> region, bool drag_source); | 91 void AddWarpRegion(scoped_ptr<WarpRegion> region, bool has_drag_source); |
92 | 92 |
93 // Warps the mouse cursor to an alternate root window when the | 93 // Warps the mouse cursor to an alternate root window when the |
94 // mouse location in |event|, hits the edge of the event target's root and | 94 // mouse location in |event|, hits the edge of the event target's root and |
95 // the mouse cursor is considered to be in an alternate display. | 95 // the mouse cursor is considered to be in an alternate display. |
96 // If |update_mouse_location_now| is true, | 96 // If |update_mouse_location_now| is true, |
97 // Returns true if/ the cursor was moved. | 97 // Returns true if/ the cursor was moved. |
98 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, | 98 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, |
99 const gfx::Point& point_in_screen, | 99 const gfx::Point& point_in_screen, |
100 bool update_mouse_location_now); | 100 bool update_mouse_location_now); |
101 | 101 |
(...skipping 16 matching lines...) Expand all Loading... | |
118 bool enabled_; | 118 bool enabled_; |
119 | 119 |
120 bool allow_non_native_event_; | 120 bool allow_non_native_event_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); | 122 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace ash | 125 } // namespace ash |
126 | 126 |
127 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 127 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
OLD | NEW |