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

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: 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 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 9
10 #include "base/atomicops.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
13 #include "components/mus/public/interfaces/display.mojom.h" 14 #include "components/mus/public/interfaces/display.mojom.h"
14 #include "components/mus/ws/event_dispatcher.h" 15 #include "components/mus/ws/event_dispatcher.h"
15 #include "components/mus/ws/event_dispatcher_delegate.h" 16 #include "components/mus/ws/event_dispatcher_delegate.h"
16 #include "components/mus/ws/user_id.h" 17 #include "components/mus/ws/user_id.h"
17 #include "components/mus/ws/window_server.h" 18 #include "components/mus/ws/window_server.h"
18 19
19 namespace cc { 20 namespace cc {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // received. 100 // received.
100 // TODO(sky): make this private and use a callback. 101 // TODO(sky): make this private and use a callback.
101 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result); 102 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result);
102 103
103 // Returns a mojom::Display for the specified display. WindowManager specific 104 // Returns a mojom::Display for the specified display. WindowManager specific
104 // values are not set. 105 // values are not set.
105 mojom::DisplayPtr ToMojomDisplay() const; 106 mojom::DisplayPtr ToMojomDisplay() const;
106 107
107 void OnWillDestroyTree(WindowTree* tree); 108 void OnWillDestroyTree(WindowTree* tree);
108 109
110 mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
111
109 private: 112 private:
110 class ProcessedEventTarget; 113 class ProcessedEventTarget;
111 friend class Display; 114 friend class Display;
112 friend class test::WindowManagerStateTestApi; 115 friend class test::WindowManagerStateTestApi;
113 116
114 // 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
115 // waiting for an ack from a client. 118 // waiting for an ack from a client.
116 // . 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
117 // set, but |processed_target| is null. 120 // set, but |processed_target| is null.
118 // . 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
152 const ui::Event& event, 155 const ui::Event& event,
153 base::WeakPtr<Accelerator> accelerator); 156 base::WeakPtr<Accelerator> accelerator);
154 157
155 // EventDispatcherDelegate: 158 // EventDispatcherDelegate:
156 void OnAccelerator(uint32_t accelerator_id, const ui::Event& event) override; 159 void OnAccelerator(uint32_t accelerator_id, const ui::Event& event) override;
157 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; 160 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
158 ServerWindow* GetFocusedWindowForEventDispatcher() override; 161 ServerWindow* GetFocusedWindowForEventDispatcher() override;
159 void SetNativeCapture() override; 162 void SetNativeCapture() override;
160 void ReleaseNativeCapture() override; 163 void ReleaseNativeCapture() override;
161 void OnServerWindowCaptureLost(ServerWindow* window) override; 164 void OnServerWindowCaptureLost(ServerWindow* window) override;
165 void OnMouseCursorLocationChanged(const gfx::Point& point) override;
162 void DispatchInputEventToWindow(ServerWindow* target, 166 void DispatchInputEventToWindow(ServerWindow* target,
163 bool in_nonclient_area, 167 bool in_nonclient_area,
164 const ui::Event& event, 168 const ui::Event& event,
165 Accelerator* accelerator) override; 169 Accelerator* accelerator) override;
166 170
167 Display* display_; 171 Display* display_;
168 PlatformDisplay* platform_display_; 172 PlatformDisplay* platform_display_;
169 // If this was created implicitly by a call 173 // If this was created implicitly by a call
170 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_| 174 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_|
171 // is false. 175 // is false.
172 const bool is_user_id_valid_; 176 const bool is_user_id_valid_;
173 const UserId user_id_; 177 const UserId user_id_;
174 // Root ServerWindow of this WindowManagerState. |root_| has a parent, the 178 // Root ServerWindow of this WindowManagerState. |root_| has a parent, the
175 // root ServerWindow of the Display. 179 // root ServerWindow of the Display.
176 scoped_ptr<ServerWindow> root_; 180 scoped_ptr<ServerWindow> root_;
177 WindowTree* tree_ = nullptr; 181 WindowTree* tree_ = nullptr;
178 182
179 // Set to true the first time SetFrameDecorationValues() is received. 183 // Set to true the first time SetFrameDecorationValues() is received.
180 bool got_frame_decoration_values_ = false; 184 bool got_frame_decoration_values_ = false;
181 mojom::FrameDecorationValuesPtr frame_decoration_values_; 185 mojom::FrameDecorationValuesPtr frame_decoration_values_;
182 186
183 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; 187 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr;
184 scoped_ptr<ui::Event> event_awaiting_input_ack_; 188 scoped_ptr<ui::Event> event_awaiting_input_ack_;
185 base::WeakPtr<Accelerator> post_target_accelerator_; 189 base::WeakPtr<Accelerator> post_target_accelerator_;
186 std::queue<scoped_ptr<QueuedEvent>> event_queue_; 190 std::queue<scoped_ptr<QueuedEvent>> event_queue_;
187 base::OneShotTimer event_ack_timer_; 191 base::OneShotTimer event_ack_timer_;
188 192
189 EventDispatcher event_dispatcher_; 193 EventDispatcher event_dispatcher_;
190 194
195 // The current location of the cursor. This is always kept up to date so we
196 // can atomically write this to |cursor_location_memory_| once it is created.
197 base::subtle::Atomic64 current_cursor_location_;
198
199 // A handle to a shared memory buffer that is one 64 bit integer long. We
200 // share this with any connection as the same user. This buffer is lazily
201 // created on the first access.
202 mojo::ScopedSharedBufferHandle cursor_location_handle_;
203
204 // The one int64 in |cursor_location_handle_|. When we write to this
205 // location, we must always write to it atomically. (On the other side of the
206 // mojo connection, this data must be read atomically.)
207 base::subtle::Atomic64* cursor_location_memory_;
208
191 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); 209 DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
192 }; 210 };
193 211
194 } // namespace ws 212 } // namespace ws
195 } // namespace mus 213 } // namespace mus
196 214
197 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ 215 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698