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

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: Actually apply the 32bit patch now that the delegate crash was fixed. 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 4af382a7048dbaabd52be2bf280e57fb20da163d..a471b4560642834a576f637edf5b72fee4b9e568 100644
--- a/components/mus/ws/window_manager_state.h
+++ b/components/mus/ws/window_manager_state.h
@@ -6,9 +6,9 @@
#define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
#include <stdint.h>
-
#include <memory>
+#include "base/atomicops.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "components/mus/public/interfaces/display.mojom.h"
@@ -107,6 +107,8 @@ class WindowManagerState : public EventDispatcherDelegate {
void OnWillDestroyTree(WindowTree* tree);
+ mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
+
private:
class ProcessedEventTarget;
friend class Display;
@@ -160,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,
@@ -190,6 +193,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::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(WindowManagerState);
};

Powered by Google App Engine
This is Rietveld 408576698