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

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

Issue 2857963003: Add {Lock,Unlock,Show,Hide}Cursor() to the window manager mojom. (Closed)
Patch Set: sky comments 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
« no previous file with comments | « services/ui/ws/BUILD.gn ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_WS_CURSOR_STATE_H_
6 #define SERVICES_UI_WS_CURSOR_STATE_H_
7
8 #include <memory>
9
10 #include "base/optional.h"
11 #include "ui/base/cursor/cursor_data.h"
12
13 namespace ui {
14 namespace ws {
15
16 class DisplayManager;
17
18 // Owns all the state about if and how the cursor is displayed in mus.
19 class CursorState {
20 public:
21 explicit CursorState(DisplayManager* display_manager);
22 ~CursorState();
23
24 // Sets the normal cursor which would be used if the window manager hasn't
25 // set an override cursor.
26 void SetCurrentWindowCursor(const ui::CursorData& cursor);
27
28 // When the cursor is locked, changes to the cursor are queued up. Queued
29 // changes are performed atomically when the cursor is unlocked.
30 void LockCursor();
31 void UnlockCursor();
32
33 // Whether the cursor is visible on the display.
34 void SetCursorVisible(bool visible);
35
36 // Sets a cursor globally, which overrides the per-window cursors.
37 void SetGlobalOverrideCursor(const base::Optional<ui::CursorData>& cursor);
38
39 private:
40 // A snapshot of the cursor state at a specific time.
41 class StateSnapshot;
42
43 // Synchronizes |current_state_| with all the platform displays.
44 void SetPlatformCursor();
45
46 // Contains are the displays we notify on cursor changes.
47 DisplayManager* display_manager_;
48
49 // Number of times LockCursor() has been invoked without a corresponding
50 // UnlockCursor().
51 int cursor_lock_count_ = 0;
52
53 // The current state of the cursor.
54 std::unique_ptr<StateSnapshot> current_state_;
55
56 // The cursor state to restore when the cursor is unlocked.
57 std::unique_ptr<StateSnapshot> state_on_unlock_;
58
59 DISALLOW_COPY_AND_ASSIGN(CursorState);
60 };
61
62 } // namespace ws
63 } // namespace ui
64
65 #endif // SERVICES_UI_WS_CURSOR_STATE_H_
OLDNEW
« no previous file with comments | « services/ui/ws/BUILD.gn ('k') | services/ui/ws/cursor_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698