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

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

Issue 2949353003: Implement large cursors in Mushrome. (Closed)
Patch Set: rename everything to CursorSize Created 3 years, 6 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
« no previous file with comments | « services/ui/public/interfaces/window_manager.mojom ('k') | services/ui/ws/cursor_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_CURSOR_STATE_H_ 5 #ifndef SERVICES_UI_WS_CURSOR_STATE_H_
6 #define SERVICES_UI_WS_CURSOR_STATE_H_ 6 #define SERVICES_UI_WS_CURSOR_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/optional.h" 10 #include "base/optional.h"
11 #include "ui/base/cursor/cursor_data.h" 11 #include "ui/base/cursor/cursor_data.h"
12 12
13 namespace ui { 13 namespace ui {
14
15 enum class CursorSize;
16
14 namespace ws { 17 namespace ws {
15 18
16 class DisplayManager; 19 class DisplayManager;
17 20
18 // Owns all the state about if and how the cursor is displayed in mus. 21 // Owns all the state about if and how the cursor is displayed in mus.
19 class CursorState { 22 class CursorState {
20 public: 23 public:
21 explicit CursorState(DisplayManager* display_manager); 24 explicit CursorState(DisplayManager* display_manager);
22 ~CursorState(); 25 ~CursorState();
23 26
24 // Sets the normal cursor which would be used if the window manager hasn't 27 // Sets the normal cursor which would be used if the window manager hasn't
25 // set an override cursor. 28 // set an override cursor.
26 void SetCurrentWindowCursor(const ui::CursorData& cursor); 29 void SetCurrentWindowCursor(const ui::CursorData& cursor);
27 30
28 // When the cursor is locked, changes to the cursor are queued up. Queued 31 // When the cursor is locked, changes to the cursor are queued up. Queued
29 // changes are performed atomically when the cursor is unlocked. 32 // changes are performed atomically when the cursor is unlocked.
30 void LockCursor(); 33 void LockCursor();
31 void UnlockCursor(); 34 void UnlockCursor();
32 35
33 // Whether the cursor is visible on the display. 36 // Whether the cursor is visible on the display.
34 void SetCursorVisible(bool visible); 37 void SetCursorVisible(bool visible);
35 38
36 // Sets a cursor globally, which overrides the per-window cursors. 39 // Sets a cursor globally, which overrides the per-window cursors.
37 void SetGlobalOverrideCursor(const base::Optional<ui::CursorData>& cursor); 40 void SetGlobalOverrideCursor(const base::Optional<ui::CursorData>& cursor);
38 41
42 // Sets the cursor size.
43 void SetCursorSize(ui::CursorSize cursor_size);
44
39 private: 45 private:
40 // A snapshot of the cursor state at a specific time. 46 // A snapshot of the cursor state at a specific time.
41 class StateSnapshot; 47 class StateSnapshot;
42 48
43 // Synchronizes |current_state_| with all the platform displays. 49 // Synchronizes cursor set data with all platform displays.
50 void SetPlatformCursorSize();
51
52 // Synchronizes the current cursor state with all the platform displays.
44 void SetPlatformCursor(); 53 void SetPlatformCursor();
45 54
46 // Contains are the displays we notify on cursor changes. 55 // Contains are the displays we notify on cursor changes.
47 DisplayManager* display_manager_; 56 DisplayManager* display_manager_;
48 57
49 // Number of times LockCursor() has been invoked without a corresponding 58 // Number of times LockCursor() has been invoked without a corresponding
50 // UnlockCursor(). 59 // UnlockCursor().
51 int cursor_lock_count_ = 0; 60 int cursor_lock_count_ = 0;
52 61
53 // The current state of the cursor. 62 // The current state of the cursor.
54 std::unique_ptr<StateSnapshot> current_state_; 63 std::unique_ptr<StateSnapshot> current_state_;
55 64
56 // The cursor state to restore when the cursor is unlocked. 65 // The cursor state to restore when the cursor is unlocked.
57 std::unique_ptr<StateSnapshot> state_on_unlock_; 66 std::unique_ptr<StateSnapshot> state_on_unlock_;
58 67
59 DISALLOW_COPY_AND_ASSIGN(CursorState); 68 DISALLOW_COPY_AND_ASSIGN(CursorState);
60 }; 69 };
61 70
62 } // namespace ws 71 } // namespace ws
63 } // namespace ui 72 } // namespace ui
64 73
65 #endif // SERVICES_UI_WS_CURSOR_STATE_H_ 74 #endif // SERVICES_UI_WS_CURSOR_STATE_H_
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/window_manager.mojom ('k') | services/ui/ws/cursor_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698