| 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 const gfx::Rect& a_indicator_bounds() { return a_indicator_bounds_; } |
| 64 const gfx::Rect& b_indicator_bounds() { return b_indicator_bounds_; } |
| 65 |
| 66 private: |
| 67 friend class ExtendedMouseWarpController; |
| 68 |
| 63 // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be | 69 // 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 | 70 // 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|. | 71 // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|. |
| 66 | 72 |
| 67 // The id for the displays. Used for warping the cursor. | 73 // The id for the displays. Used for warping the cursor. |
| 68 int64_t a_display_id; | 74 int64_t a_display_id_; |
| 69 int64_t b_display_id; | 75 int64_t b_display_id_; |
| 70 | 76 |
| 71 gfx::Rect a_edge_bounds_in_native; | 77 gfx::Rect a_edge_bounds_in_native_; |
| 72 gfx::Rect b_edge_bounds_in_native; | 78 gfx::Rect b_edge_bounds_in_native_; |
| 73 | 79 |
| 74 // The bounds for warp hole windows. These are kept in the instance for | 80 // The bounds for warp hole windows. These are kept in the instance for |
| 75 // testing. | 81 // testing. |
| 76 gfx::Rect a_indicator_bounds; | 82 gfx::Rect a_indicator_bounds_; |
| 77 gfx::Rect b_indicator_bounds; | 83 gfx::Rect b_indicator_bounds_; |
| 78 | 84 |
| 79 // Shows the area where a window can be dragged in to/out from another | 85 // Shows the area where a window can be dragged in to/out from another |
| 80 // display. | 86 // display. |
| 81 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator; | 87 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator_; |
| 82 | 88 |
| 83 private: | |
| 84 DISALLOW_COPY_AND_ASSIGN(WarpRegion); | 89 DISALLOW_COPY_AND_ASSIGN(WarpRegion); |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 std::vector<scoped_ptr<WarpRegion>> warp_regions_; | 92 std::vector<scoped_ptr<WarpRegion>> warp_regions_; |
| 88 | 93 |
| 89 // Registers the WarpRegion; also displays a drag indicator on the screen if | 94 // Registers the WarpRegion; also displays a drag indicator on the screen if |
| 90 // |drag_source| is true. | 95 // |has_drag_source| is true. |
| 91 void AddWarpRegion(scoped_ptr<WarpRegion> region, bool drag_source); | 96 void AddWarpRegion(scoped_ptr<WarpRegion> region, bool has_drag_source); |
| 92 | 97 |
| 93 // Warps the mouse cursor to an alternate root window when the | 98 // 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 | 99 // 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. | 100 // the mouse cursor is considered to be in an alternate display. |
| 96 // If |update_mouse_location_now| is true, | 101 // If |update_mouse_location_now| is true, |
| 97 // Returns true if/ the cursor was moved. | 102 // Returns true if/ the cursor was moved. |
| 98 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, | 103 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, |
| 99 const gfx::Point& point_in_screen, | 104 const gfx::Point& point_in_screen, |
| 100 bool update_mouse_location_now); | 105 bool update_mouse_location_now); |
| 101 | 106 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 bool enabled_; | 123 bool enabled_; |
| 119 | 124 |
| 120 bool allow_non_native_event_; | 125 bool allow_non_native_event_; |
| 121 | 126 |
| 122 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); | 127 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); |
| 123 }; | 128 }; |
| 124 | 129 |
| 125 } // namespace ash | 130 } // namespace ash |
| 126 | 131 |
| 127 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 132 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
| OLD | NEW |