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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/display.h
diff --git a/services/ui/ws/display.h b/services/ui/ws/display.h
index 98acc83ec341dd3de82475c22aa026a4a87b5a57..1ace44a2e574ad06c5239ebf5031590efe8a8585 100644
--- a/services/ui/ws/display.h
+++ b/services/ui/ws/display.h
@@ -149,8 +149,21 @@ class Display : public PlatformDisplayDelegate,
// |display_root| being destroyed.
void RemoveWindowManagerDisplayRoot(WindowManagerDisplayRoot* display_root);
+ // Sets the native cursor to |cursor|.
void UpdateNativeCursor(const ui::CursorData& cursor);
+ // When the cursor is locked, changes to the cursor are queued up. Queued
+ // changes are performed atomically when the cursor is unlocked.
+ void LockCursor();
+ void UnlockCursor();
+
+ // Whether the cursor is visible on the display.
+ void ShowCursor();
+ void HideCursor();
+
+ // Sets a cursor globally, which overrides the per-window cursors.
+ void SetGlobalOverrideCursor(const base::Optional<ui::CursorData>& cursor);
+
// mojom::WindowTreeHost:
void SetSize(const gfx::Size& size) override;
void SetTitle(const std::string& title) override;
@@ -167,6 +180,8 @@ class Display : public PlatformDisplayDelegate,
using WindowManagerDisplayRootMap =
std::map<UserId, WindowManagerDisplayRoot*>;
+ class CursorState;
+
// Inits the necessary state once the display is ready.
void InitWindowManagerDisplayRoots();
@@ -181,6 +196,9 @@ class Display : public PlatformDisplayDelegate,
// pixels.
void CreateRootWindow(const gfx::Size& size);
+ // Synchronizes |current_state_| with the platform display.
+ void SetPlatformCursor();
+
// PlatformDisplayDelegate:
ServerWindow* GetRootWindow() override;
EventSink* GetEventSink() override;
@@ -218,8 +236,15 @@ class Display : public PlatformDisplayDelegate,
// external window mode this will be invalid.
display::Display display_;
- // The last cursor set. Used to track whether we need to change the cursor.
- ui::CursorData last_cursor_;
+ // Number of times LockCursor() has been invoked without a corresponding
+ // UnlockCursor().
+ int cursor_lock_count_ = 0u;
+
+ // The current state of the cursor.
+ std::unique_ptr<CursorState> current_state_;
+
+ // The cursor state to restore when the cursor is unlocked.
+ std::unique_ptr<CursorState> state_on_unlock_;
ServerWindowTracker activation_parents_;

Powered by Google App Engine
This is Rietveld 408576698