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

Side by Side Diff: ash/display/extended_mouse_warp_controller.h

Issue 1823913002: Allow moving cursors between connected displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
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 24 matching lines...) Expand all
35 public: 35 public:
36 explicit ExtendedMouseWarpController(aura::Window* drag_source); 36 explicit ExtendedMouseWarpController(aura::Window* drag_source);
37 ~ExtendedMouseWarpController() override; 37 ~ExtendedMouseWarpController() override;
38 38
39 // MouseWarpController: 39 // MouseWarpController:
40 bool WarpMouseCursor(ui::MouseEvent* event) override; 40 bool WarpMouseCursor(ui::MouseEvent* event) override;
41 void SetEnabled(bool enable) override; 41 void SetEnabled(bool enable) override;
42 42
43 private: 43 private:
44 friend class test::DisplayManagerTestApi; 44 friend class test::DisplayManagerTestApi;
45 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, 45 friend class ExtendedMouseWarpControllerTest;
46 IndicatorBoundsTestOnRight);
47 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
48 IndicatorBoundsTestOnLeft);
49 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
50 IndicatorBoundsTestOnTopBottom);
51 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, 46 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
52 IndicatorBoundsTestThreeDisplays); 47 IndicatorBoundsTestThreeDisplays);
48 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
49 IndicatorBoundsTestThreeDisplaysWithLayout);
50 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
51 IndicatorBoundsTestThreeDisplaysWithLayout2);
53 52
54 // Defined in header file because tests need access. 53 // Defined in header file because tests need access.
55 class WarpRegion { 54 class ASH_EXPORT WarpRegion {
56 public: 55 public:
57 WarpRegion(int64_t a_display_id, 56 WarpRegion(int64_t a_display_id,
58 int64_t b_display_id, 57 int64_t b_display_id,
59 const gfx::Rect& a_indicator_bounds, 58 const gfx::Rect& a_indicator_bounds,
60 const gfx::Rect& b_indicator_bounds); 59 const gfx::Rect& b_indicator_bounds);
61 ~WarpRegion(); 60 ~WarpRegion();
62 61
63 const gfx::Rect& a_indicator_bounds() { return a_indicator_bounds_; } 62 const gfx::Rect& a_indicator_bounds() { return a_indicator_bounds_; }
64 const gfx::Rect& b_indicator_bounds() { return b_indicator_bounds_; } 63 const gfx::Rect& b_indicator_bounds() { return b_indicator_bounds_; }
65 64
65 const gfx::Rect& GetIndicatorBoundsForTest(int64_t id) const;
66
66 private: 67 private:
67 friend class ExtendedMouseWarpController; 68 friend class ExtendedMouseWarpController;
68 69
69 // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be 70 // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be
70 // moved to |b_display_id|. Similarily, if the cursor is in 71 // moved to |b_display_id|. Similarily, if the cursor is in
71 // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|. 72 // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|.
72 73
73 // The id for the displays. Used for warping the cursor. 74 // The id for the displays. Used for warping the cursor.
74 int64_t a_display_id_; 75 int64_t a_display_id_;
75 int64_t b_display_id_; 76 int64_t b_display_id_;
(...skipping 21 matching lines...) Expand all
97 98
98 // Warps the mouse cursor to an alternate root window when the 99 // Warps the mouse cursor to an alternate root window when the
99 // mouse location in |event|, hits the edge of the event target's root and 100 // mouse location in |event|, hits the edge of the event target's root and
100 // the mouse cursor is considered to be in an alternate display. 101 // the mouse cursor is considered to be in an alternate display.
101 // If |update_mouse_location_now| is true, 102 // If |update_mouse_location_now| is true,
102 // Returns true if/ the cursor was moved. 103 // Returns true if/ the cursor was moved.
103 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, 104 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native,
104 const gfx::Point& point_in_screen, 105 const gfx::Point& point_in_screen,
105 bool update_mouse_location_now); 106 bool update_mouse_location_now);
106 107
107 // Update the edge/indicator bounds based on the current 108 // Creates WarpRegion between display |a| and
108 // display configuration. 109 // |b|. |drag_source_dispaly_id| is used to indicate in which
stevenjb 2016/03/24 18:08:30 nit: |b|. on prev line
oshima 2016/03/24 20:37:19 Done.
109 scoped_ptr<WarpRegion> CreateHorizontalEdgeBounds( 110 // display a drag is started, or invalid id passed if this is not
110 const gfx::Display& a, 111 // for dragging. Returns null scoped_ptr if two displays do not
111 const gfx::Display& b, 112 // share the edge.
112 DisplayPlacement::Position position); 113 scoped_ptr<WarpRegion> CreateWarpRegion(const gfx::Display& a,
113 scoped_ptr<WarpRegion> CreateVerticalEdgeBounds( 114 const gfx::Display& b,
114 const gfx::Display& a, 115 int64_t drag_source_dispay_id);
115 const gfx::Display& b,
116 DisplayPlacement::Position position);
117 116
118 void allow_non_native_event_for_test() { allow_non_native_event_ = true; } 117 void allow_non_native_event_for_test() { allow_non_native_event_ = true; }
119 118
120 // The root window in which the dragging started. 119 // The root window in which the dragging started.
121 aura::Window* drag_source_root_; 120 aura::Window* drag_source_root_;
122 121
123 bool enabled_; 122 bool enabled_;
124 123
125 bool allow_non_native_event_; 124 bool allow_non_native_event_;
126 125
127 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); 126 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController);
128 }; 127 };
129 128
130 } // namespace ash 129 } // namespace ash
131 130
132 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H 131 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698