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

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

Issue 145313003: Implement cursor compositing mode on Ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always update cursor image in SetCursor. Fixes initial wrong cursor. Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 5 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_
6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 template <typename T> class JSONValueConverter; 31 template <typename T> class JSONValueConverter;
32 } 32 }
33 33
34 namespace gfx { 34 namespace gfx {
35 class Display; 35 class Display;
36 class Insets; 36 class Insets;
37 } 37 }
38 38
39 namespace ash { 39 namespace ash {
40 namespace internal { 40 namespace internal {
41 class CursorWindowController;
41 class DisplayInfo; 42 class DisplayInfo;
42 class DisplayManager; 43 class DisplayManager;
43 class FocusActivationStore; 44 class FocusActivationStore;
44 class MirrorWindowController; 45 class MirrorWindowController;
45 class RootWindowController; 46 class RootWindowController;
46 class VirtualKeyboardWindowController; 47 class VirtualKeyboardWindowController;
47 } 48 }
48 49
49 // DisplayController owns and maintains RootWindows for each attached 50 // DisplayController owns and maintains RootWindows for each attached
50 // display, keeping them in sync with display configuration changes. 51 // display, keeping them in sync with display configuration changes.
(...skipping 18 matching lines...) Expand all
69 DisplayController(); 70 DisplayController();
70 virtual ~DisplayController(); 71 virtual ~DisplayController();
71 72
72 void Start(); 73 void Start();
73 void Shutdown(); 74 void Shutdown();
74 75
75 // Returns primary display's ID. 76 // Returns primary display's ID.
76 // TODO(oshima): Move this out from DisplayController; 77 // TODO(oshima): Move this out from DisplayController;
77 static int64 GetPrimaryDisplayId(); 78 static int64 GetPrimaryDisplayId();
78 79
80 internal::CursorWindowController* cursor_window_controller() {
81 return cursor_window_controller_.get();
82 }
83
79 internal::MirrorWindowController* mirror_window_controller() { 84 internal::MirrorWindowController* mirror_window_controller() {
80 return mirror_window_controller_.get(); 85 return mirror_window_controller_.get();
81 } 86 }
82 87
83 internal::VirtualKeyboardWindowController* 88 internal::VirtualKeyboardWindowController*
84 virtual_keyboard_window_controller() { 89 virtual_keyboard_window_controller() {
85 return virtual_keyboard_window_controller_.get(); 90 return virtual_keyboard_window_controller_.get();
86 } 91 }
87 92
88 // Initializes primary display. 93 // Initializes primary display.
(...skipping 11 matching lines...) Expand all
100 105
101 // Returns the root window for |display_id|. 106 // Returns the root window for |display_id|.
102 aura::Window* GetRootWindowForDisplayId(int64 id); 107 aura::Window* GetRootWindowForDisplayId(int64 id);
103 108
104 // Toggle mirror mode. 109 // Toggle mirror mode.
105 void ToggleMirrorMode(); 110 void ToggleMirrorMode();
106 111
107 // Swap primary and secondary display. 112 // Swap primary and secondary display.
108 void SwapPrimaryDisplay(); 113 void SwapPrimaryDisplay();
109 114
115 // Enable/Disable cursor compositing.
116 void SetCursorCompositingEnabled(bool enabled);
117
118 // Sets the display on which to draw cursor.
119 // Only applicable when cursor compositing is enabled.
120 void SetDisplayForCursor(const gfx::Display& display);
121
110 // Sets the ID of the primary display. If the display is not connected, it 122 // Sets the ID of the primary display. If the display is not connected, it
111 // will switch the primary display when connected. 123 // will switch the primary display when connected.
112 void SetPrimaryDisplayId(int64 id); 124 void SetPrimaryDisplayId(int64 id);
113 125
114 // Sets primary display. This re-assigns the current root 126 // Sets primary display. This re-assigns the current root
115 // window to given |display|. 127 // window to given |display|.
116 void SetPrimaryDisplay(const gfx::Display& display); 128 void SetPrimaryDisplay(const gfx::Display& display);
117 129
118 // Closes all child windows in the all root windows. 130 // Closes all child windows in the all root windows.
119 void CloseChildWindows(); 131 void CloseChildWindows();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 friend class internal::MirrorWindowController; 173 friend class internal::MirrorWindowController;
162 174
163 // Creates a root window for |display| and stores it in the |root_windows_| 175 // Creates a root window for |display| and stores it in the |root_windows_|
164 // map. 176 // map.
165 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); 177 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display);
166 178
167 void OnFadeOutForSwapDisplayFinished(); 179 void OnFadeOutForSwapDisplayFinished();
168 180
169 void UpdateHostWindowNames(); 181 void UpdateHostWindowNames();
170 182
183 void UpdateCursorWindowContainer();
184
171 class DisplayChangeLimiter { 185 class DisplayChangeLimiter {
172 public: 186 public:
173 DisplayChangeLimiter(); 187 DisplayChangeLimiter();
174 188
175 // Sets how long the throttling should last. 189 // Sets how long the throttling should last.
176 void SetThrottleTimeout(int64 throttle_ms); 190 void SetThrottleTimeout(int64 throttle_ms);
177 191
178 bool IsThrottled() const; 192 bool IsThrottled() const;
179 193
180 private: 194 private:
181 // The time when the throttling ends. 195 // The time when the throttling ends.
182 base::Time throttle_timeout_; 196 base::Time throttle_timeout_;
183 197
184 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); 198 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter);
185 }; 199 };
186 200
187 // The limiter to throttle how fast a user can 201 // The limiter to throttle how fast a user can
188 // change the display configuration. 202 // change the display configuration.
189 scoped_ptr<DisplayChangeLimiter> limiter_; 203 scoped_ptr<DisplayChangeLimiter> limiter_;
190 204
191 // The mapping from display ID to its root window. 205 // The mapping from display ID to its root window.
192 std::map<int64, aura::Window*> root_windows_; 206 std::map<int64, aura::Window*> root_windows_;
193 207
194 ObserverList<Observer> observers_; 208 ObserverList<Observer> observers_;
195 209
196 // Store the primary root window temporarily while replacing 210 // Store the primary root window temporarily while replacing
197 // display. 211 // display.
198 aura::Window* primary_root_window_for_replace_; 212 aura::Window* primary_root_window_for_replace_;
199 213
214 bool is_cursor_compositing_enabled_;
oshima 2014/02/05 21:49:59 looks to me that this can and probably should be i
hshi1 2014/02/05 22:55:58 Done.
215
200 scoped_ptr<internal::FocusActivationStore> focus_activation_store_; 216 scoped_ptr<internal::FocusActivationStore> focus_activation_store_;
201 217
218 scoped_ptr<internal::CursorWindowController> cursor_window_controller_;
202 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_; 219 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_;
203 scoped_ptr<internal::VirtualKeyboardWindowController> 220 scoped_ptr<internal::VirtualKeyboardWindowController>
204 virtual_keyboard_window_controller_; 221 virtual_keyboard_window_controller_;
205 222
206 // Stores the curent cursor location (in native coordinates) used to 223 // Stores the curent cursor location (in native coordinates) used to
207 // restore the cursor location when display configuration 224 // restore the cursor location when display configuration
208 // changed. 225 // changed.
209 gfx::Point cursor_location_in_native_coords_for_restore_; 226 gfx::Point cursor_location_in_native_coords_for_restore_;
210 227
211 DISALLOW_COPY_AND_ASSIGN(DisplayController); 228 DISALLOW_COPY_AND_ASSIGN(DisplayController);
212 }; 229 };
213 230
214 } // namespace ash 231 } // namespace ash
215 232
216 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 233 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698