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

Side by Side Diff: services/ui/ws/display.h

Issue 2857963003: Add {Lock,Unlock,Show,Hide}Cursor() to the window manager mojom. (Closed)
Patch Set: General cleanup. Created 3 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
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 SERVICES_UI_WS_DISPLAY_H_ 5 #ifndef SERVICES_UI_WS_DISPLAY_H_
6 #define SERVICES_UI_WS_DISPLAY_H_ 6 #define SERVICES_UI_WS_DISPLAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const ui::TextInputState& state); 142 const ui::TextInputState& state);
143 void SetImeVisibility(ServerWindow* window, bool visible); 143 void SetImeVisibility(ServerWindow* window, bool visible);
144 144
145 // Called just before |tree| is destroyed. 145 // Called just before |tree| is destroyed.
146 void OnWillDestroyTree(WindowTree* tree); 146 void OnWillDestroyTree(WindowTree* tree);
147 147
148 // Removes |display_root| from internal maps. This called prior to 148 // Removes |display_root| from internal maps. This called prior to
149 // |display_root| being destroyed. 149 // |display_root| being destroyed.
150 void RemoveWindowManagerDisplayRoot(WindowManagerDisplayRoot* display_root); 150 void RemoveWindowManagerDisplayRoot(WindowManagerDisplayRoot* display_root);
151 151
152 // Sets the native cursor to |cursor|.
152 void UpdateNativeCursor(const ui::CursorData& cursor); 153 void UpdateNativeCursor(const ui::CursorData& cursor);
153 154
155 // When the cursor is locked, changes to the cursor are queued up. Queued
156 // changes are performed atomically when the cursor is unlocked.
157 void LockCursor();
158 void UnlockCursor();
159
160 // Whether the cursor is visible on the display.
161 void ShowCursor();
162 void HideCursor();
163
164 // Sets a cursor globally, which overrides the per-window cursors.
165 void SetGlobalOverrideCursor(const base::Optional<ui::CursorData>& cursor);
166
154 // mojom::WindowTreeHost: 167 // mojom::WindowTreeHost:
155 void SetSize(const gfx::Size& size) override; 168 void SetSize(const gfx::Size& size) override;
156 void SetTitle(const std::string& title) override; 169 void SetTitle(const std::string& title) override;
157 170
158 // Updates the size of display root ServerWindow and WM root ServerWindow(s). 171 // Updates the size of display root ServerWindow and WM root ServerWindow(s).
159 void OnViewportMetricsChanged(const display::ViewportMetrics& metrics); 172 void OnViewportMetricsChanged(const display::ViewportMetrics& metrics);
160 173
161 // Returns the root window of the active user. 174 // Returns the root window of the active user.
162 ServerWindow* GetActiveRootWindow(); 175 ServerWindow* GetActiveRootWindow();
163 176
164 private: 177 private:
165 friend class test::DisplayTestApi; 178 friend class test::DisplayTestApi;
166 179
167 using WindowManagerDisplayRootMap = 180 using WindowManagerDisplayRootMap =
168 std::map<UserId, WindowManagerDisplayRoot*>; 181 std::map<UserId, WindowManagerDisplayRoot*>;
169 182
183 class CursorState;
184
170 // Inits the necessary state once the display is ready. 185 // Inits the necessary state once the display is ready.
171 void InitWindowManagerDisplayRoots(); 186 void InitWindowManagerDisplayRoots();
172 187
173 // Creates the set of WindowManagerDisplayRoots from the 188 // Creates the set of WindowManagerDisplayRoots from the
174 // WindowManagerWindowTreeFactorySet. 189 // WindowManagerWindowTreeFactorySet.
175 void CreateWindowManagerDisplayRootsFromFactories(); 190 void CreateWindowManagerDisplayRootsFromFactories();
176 191
177 void CreateWindowManagerDisplayRootFromFactory( 192 void CreateWindowManagerDisplayRootFromFactory(
178 WindowManagerWindowTreeFactory* factory); 193 WindowManagerWindowTreeFactory* factory);
179 194
180 // Creates the root ServerWindow for this display, where |size| is in physical 195 // Creates the root ServerWindow for this display, where |size| is in physical
181 // pixels. 196 // pixels.
182 void CreateRootWindow(const gfx::Size& size); 197 void CreateRootWindow(const gfx::Size& size);
183 198
199 // Synchronizes |current_state_| with the platform display.
200 void SetPlatformCursor();
201
184 // PlatformDisplayDelegate: 202 // PlatformDisplayDelegate:
185 ServerWindow* GetRootWindow() override; 203 ServerWindow* GetRootWindow() override;
186 EventSink* GetEventSink() override; 204 EventSink* GetEventSink() override;
187 void OnAcceleratedWidgetAvailable() override; 205 void OnAcceleratedWidgetAvailable() override;
188 void OnNativeCaptureLost() override; 206 void OnNativeCaptureLost() override;
189 OzonePlatform* GetOzonePlatform() override; 207 OzonePlatform* GetOzonePlatform() override;
190 208
191 // FocusControllerDelegate: 209 // FocusControllerDelegate:
192 bool CanHaveActiveChildren(ServerWindow* window) const override; 210 bool CanHaveActiveChildren(ServerWindow* window) const override;
193 211
(...skipping 17 matching lines...) Expand all
211 std::unique_ptr<DisplayBinding> binding_; 229 std::unique_ptr<DisplayBinding> binding_;
212 WindowServer* const window_server_; 230 WindowServer* const window_server_;
213 std::unique_ptr<ServerWindow> root_; 231 std::unique_ptr<ServerWindow> root_;
214 std::unique_ptr<PlatformDisplay> platform_display_; 232 std::unique_ptr<PlatformDisplay> platform_display_;
215 std::unique_ptr<FocusController> focus_controller_; 233 std::unique_ptr<FocusController> focus_controller_;
216 234
217 // In internal window mode this contains information about the display. In 235 // In internal window mode this contains information about the display. In
218 // external window mode this will be invalid. 236 // external window mode this will be invalid.
219 display::Display display_; 237 display::Display display_;
220 238
221 // The last cursor set. Used to track whether we need to change the cursor. 239 // Number of times LockCursor() has been invoked without a corresponding
222 ui::CursorData last_cursor_; 240 // UnlockCursor().
241 int cursor_lock_count_ = 0u;
242
243 // The current state of the cursor.
244 std::unique_ptr<CursorState> current_state_;
245
246 // The cursor state to restore when the cursor is unlocked.
247 std::unique_ptr<CursorState> state_on_unlock_;
223 248
224 ServerWindowTracker activation_parents_; 249 ServerWindowTracker activation_parents_;
225 250
226 cc::LocalSurfaceIdAllocator allocator_; 251 cc::LocalSurfaceIdAllocator allocator_;
227 252
228 WindowManagerDisplayRootMap window_manager_display_root_map_; 253 WindowManagerDisplayRootMap window_manager_display_root_map_;
229 254
230 DISALLOW_COPY_AND_ASSIGN(Display); 255 DISALLOW_COPY_AND_ASSIGN(Display);
231 }; 256 };
232 257
233 } // namespace ws 258 } // namespace ws
234 } // namespace ui 259 } // namespace ui
235 260
236 #endif // SERVICES_UI_WS_DISPLAY_H_ 261 #endif // SERVICES_UI_WS_DISPLAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698