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

Unified Diff: components/mus/ws/user_display_manager.h

Issue 1881253002: mus: Implement ScreenMus::GetCursorScreenPoint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with tot Created 4 years, 8 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
« no previous file with comments | « components/mus/ws/event_dispatcher_unittest.cc ('k') | components/mus/ws/user_display_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/user_display_manager.h
diff --git a/components/mus/ws/user_display_manager.h b/components/mus/ws/user_display_manager.h
index c17a7c6981a155821d53159ac3482e8ddaedc8ad..65c1787ffb8b599a03712568867abf2237d8c3a9 100644
--- a/components/mus/ws/user_display_manager.h
+++ b/components/mus/ws/user_display_manager.h
@@ -7,12 +7,17 @@
#include <set>
+#include "base/atomicops.h"
#include "base/macros.h"
#include "components/mus/public/interfaces/display.mojom.h"
#include "components/mus/ws/user_id.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr_set.h"
+namespace gfx {
+class Point;
+}
+
namespace mus {
namespace ws {
@@ -39,6 +44,14 @@ class UserDisplayManager : public mojom::DisplayManager {
// Called by Display prior to |display| being removed and destroyed.
void OnWillDestroyDisplay(Display* display);
+ // Called from WindowManagerState when its EventDispatcher receives a mouse
+ // event.
+ void OnMouseCursorLocationChanged(const gfx::Point& point);
+
+ // Returns a read-only handle to the shared memory which contains the global
+ // mouse cursor position. Each call returns a new handle.
+ mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
+
private:
friend class test::UserDisplayManagerTestApi;
@@ -74,6 +87,20 @@ class UserDisplayManager : public mojom::DisplayManager {
// Observer used for tests.
mojom::DisplayManagerObserver* test_observer_ = nullptr;
+ // The current location of the cursor. This is always kept up to date so we
+ // can atomically write this to |cursor_location_memory_| once it is created.
+ base::subtle::Atomic32 current_cursor_location_;
+
+ // A handle to a shared memory buffer that is one 64 bit integer long. We
+ // share this with any connection as the same user. This buffer is lazily
+ // created on the first access.
+ mojo::ScopedSharedBufferHandle cursor_location_handle_;
+
+ // The one int32 in |cursor_location_handle_|. When we write to this
+ // location, we must always write to it atomically. (On the other side of the
+ // mojo connection, this data must be read atomically.)
+ base::subtle::Atomic32* cursor_location_memory_;
+
DISALLOW_COPY_AND_ASSIGN(UserDisplayManager);
};
« no previous file with comments | « components/mus/ws/event_dispatcher_unittest.cc ('k') | components/mus/ws/user_display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698