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

Side by Side 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, 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <memory> 9 #include <memory>
11 10
11 #include "base/atomicops.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "components/mus/public/interfaces/display.mojom.h" 14 #include "components/mus/public/interfaces/display.mojom.h"
15 #include "components/mus/ws/event_dispatcher.h" 15 #include "components/mus/ws/event_dispatcher.h"
16 #include "components/mus/ws/event_dispatcher_delegate.h" 16 #include "components/mus/ws/event_dispatcher_delegate.h"
17 #include "components/mus/ws/user_id.h" 17 #include "components/mus/ws/user_id.h"
18 #include "components/mus/ws/window_server.h" 18 #include "components/mus/ws/window_server.h"
19 19
20 namespace cc { 20 namespace cc {
21 struct SurfaceId; 21 struct SurfaceId;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // received. 100 // received.
101 // TODO(sky): make this private and use a callback. 101 // TODO(sky): make this private and use a callback.
102 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result); 102 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result);
103 103
104 // Returns a mojom::Display for the specified display. WindowManager specific 104 // Returns a mojom::Display for the specified display. WindowManager specific
105 // values are not set. 105 // values are not set.
106 mojom::DisplayPtr ToMojomDisplay() const; 106 mojom::DisplayPtr ToMojomDisplay() const;
107 107
108 void OnWillDestroyTree(WindowTree* tree); 108 void OnWillDestroyTree(WindowTree* tree);
109 109
110 mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
111
110 private: 112 private:
111 class ProcessedEventTarget; 113 class ProcessedEventTarget;
112 friend class Display; 114 friend class Display;
113 friend class test::WindowManagerStateTestApi; 115 friend class test::WindowManagerStateTestApi;
114 116
115 // There are two types of events that may be queued, both occur only when 117 // There are two types of events that may be queued, both occur only when
116 // waiting for an ack from a client. 118 // waiting for an ack from a client.
117 // . We get an event from the PlatformDisplay. This results in |event| being 119 // . We get an event from the PlatformDisplay. This results in |event| being
118 // set, but |processed_target| is null. 120 // set, but |processed_target| is null.
119 // . We get an event from the EventDispatcher. In this case both |event| and 121 // . We get an event from the EventDispatcher. In this case both |event| and
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const ui::Event& event, 155 const ui::Event& event,
154 base::WeakPtr<Accelerator> accelerator); 156 base::WeakPtr<Accelerator> accelerator);
155 157
156 // EventDispatcherDelegate: 158 // EventDispatcherDelegate:
157 void OnAccelerator(uint32_t accelerator_id, const ui::Event& event) override; 159 void OnAccelerator(uint32_t accelerator_id, const ui::Event& event) override;
158 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; 160 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
159 ServerWindow* GetFocusedWindowForEventDispatcher() override; 161 ServerWindow* GetFocusedWindowForEventDispatcher() override;
160 void SetNativeCapture() override; 162 void SetNativeCapture() override;
161 void ReleaseNativeCapture() override; 163 void ReleaseNativeCapture() override;
162 void OnServerWindowCaptureLost(ServerWindow* window) override; 164 void OnServerWindowCaptureLost(ServerWindow* window) override;
165 void OnMouseCursorLocationChanged(const gfx::Point& point) override;
163 void DispatchInputEventToWindow(ServerWindow* target, 166 void DispatchInputEventToWindow(ServerWindow* target,
164 bool in_nonclient_area, 167 bool in_nonclient_area,
165 const ui::Event& event, 168 const ui::Event& event,
166 Accelerator* accelerator) override; 169 Accelerator* accelerator) override;
167 void OnEventTargetNotFound(const ui::Event& event) override; 170 void OnEventTargetNotFound(const ui::Event& event) override;
168 171
169 Display* display_; 172 Display* display_;
170 PlatformDisplay* platform_display_; 173 PlatformDisplay* platform_display_;
171 // If this was created implicitly by a call 174 // If this was created implicitly by a call
172 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_| 175 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_|
(...skipping 10 matching lines...) Expand all
183 mojom::FrameDecorationValuesPtr frame_decoration_values_; 186 mojom::FrameDecorationValuesPtr frame_decoration_values_;
184 187
185 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; 188 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr;
186 std::unique_ptr<ui::Event> event_awaiting_input_ack_; 189 std::unique_ptr<ui::Event> event_awaiting_input_ack_;
187 base::WeakPtr<Accelerator> post_target_accelerator_; 190 base::WeakPtr<Accelerator> post_target_accelerator_;
188 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; 191 std::queue<std::unique_ptr<QueuedEvent>> event_queue_;
189 base::OneShotTimer event_ack_timer_; 192 base::OneShotTimer event_ack_timer_;
190 193
191 EventDispatcher event_dispatcher_; 194 EventDispatcher event_dispatcher_;
192 195
196 // The current location of the cursor. This is always kept up to date so we
197 // can atomically write this to |cursor_location_memory_| once it is created.
198 base::subtle::Atomic32 current_cursor_location_;
199
200 // A handle to a shared memory buffer that is one 64 bit integer long. We
201 // share this with any connection as the same user. This buffer is lazily
202 // created on the first access.
203 mojo::ScopedSharedBufferHandle cursor_location_handle_;
204
205 // The one int32 in |cursor_location_handle_|. When we write to this
206 // location, we must always write to it atomically. (On the other side of the
207 // mojo connection, this data must be read atomically.)
208 base::subtle::Atomic32* cursor_location_memory_;
209
193 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); 210 DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
194 }; 211 };
195 212
196 } // namespace ws 213 } // namespace ws
197 } // namespace mus 214 } // namespace mus
198 215
199 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ 216 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698