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

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

Issue 1881253002: mus: Implement ScreenMus::GetCursorScreenPoint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows more. 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
Index: components/mus/ws/window_manager_state.h
diff --git a/components/mus/ws/window_manager_state.h b/components/mus/ws/window_manager_state.h
index d85199b5f4be81f06963dc6299e29f18a8050499..e742c9dc057c299ba8dc7ed66e74e5af44aed0ec 100644
--- a/components/mus/ws/window_manager_state.h
+++ b/components/mus/ws/window_manager_state.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "base/atomicops.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
@@ -106,6 +107,8 @@ class WindowManagerState : public EventDispatcherDelegate {
void OnWillDestroyTree(WindowTree* tree);
+ mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
+
private:
class ProcessedEventTarget;
friend class Display;
@@ -159,6 +162,7 @@ class WindowManagerState : public EventDispatcherDelegate {
void SetNativeCapture() override;
void ReleaseNativeCapture() override;
void OnServerWindowCaptureLost(ServerWindow* window) override;
+ void OnMouseCursorLocationChanged(const gfx::Point& point) override;
void DispatchInputEventToWindow(ServerWindow* target,
bool in_nonclient_area,
const ui::Event& event,
@@ -188,6 +192,20 @@ class WindowManagerState : public EventDispatcherDelegate {
EventDispatcher event_dispatcher_;
+ // 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::Atomic64 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 int64 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::Atomic64* cursor_location_memory_;
+
DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
};

Powered by Google App Engine
This is Rietveld 408576698