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

Side by Side Diff: services/ui/ws/window_manager_state.h

Issue 2778943005: Keep root_location to be in pixels and display coordinates in WS. (Closed)
Patch Set: drop events Created 3 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
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_ 5 #ifndef SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_
6 #define SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_ 6 #define SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // TODO(sky): EventDispatcher is really an implementation detail and should 90 // TODO(sky): EventDispatcher is really an implementation detail and should
91 // not be exposed. 91 // not be exposed.
92 EventDispatcher* event_dispatcher() { return &event_dispatcher_; } 92 EventDispatcher* event_dispatcher() { return &event_dispatcher_; }
93 93
94 CursorState& cursor_state() { return cursor_state_; } 94 CursorState& cursor_state() { return cursor_state_; }
95 95
96 // Returns true if this is the WindowManager of the active user. 96 // Returns true if this is the WindowManager of the active user.
97 bool IsActive() const; 97 bool IsActive() const;
98 98
99 void Activate(const gfx::Point& mouse_location_on_screen); 99 void Activate(const gfx::Point& mouse_location_on_display,
100 const int64_t display_id);
100 void Deactivate(); 101 void Deactivate();
101 102
102 // Processes an event from PlatformDisplay. 103 // Processes an event from PlatformDisplay.
103 void ProcessEvent(const Event& event, int64_t display_id); 104 void ProcessEvent(const Event& event, int64_t display_id);
104 105
105 private: 106 private:
106 class ProcessedEventTarget; 107 class ProcessedEventTarget;
107 friend class Display; 108 friend class Display;
108 friend class test::WindowManagerStateTestApi; 109 friend class test::WindowManagerStateTestApi;
109 110
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 int64_t display_id); 215 int64_t display_id);
215 216
216 // Processes the next valid event in |event_queue_|. If the event has already 217 // Processes the next valid event in |event_queue_|. If the event has already
217 // been processed it is dispatched, otherwise the event is passed to the 218 // been processed it is dispatched, otherwise the event is passed to the
218 // EventDispatcher for processing. 219 // EventDispatcher for processing.
219 void ProcessNextEventFromQueue(); 220 void ProcessNextEventFromQueue();
220 221
221 // Dispatches the event to the appropriate client and starts the ack timer. 222 // Dispatches the event to the appropriate client and starts the ack timer.
222 void DispatchInputEventToWindowImpl(ServerWindow* target, 223 void DispatchInputEventToWindowImpl(ServerWindow* target,
223 ClientSpecificId client_id, 224 ClientSpecificId client_id,
225 const int64_t display_id,
224 const Event& event, 226 const Event& event,
225 base::WeakPtr<Accelerator> accelerator); 227 base::WeakPtr<Accelerator> accelerator);
226 228
227 // Registers accelerators used internally for debugging. 229 // Registers accelerators used internally for debugging.
228 void AddDebugAccelerators(); 230 void AddDebugAccelerators();
229 231
230 // Finds the debug accelerator for |event| and if one is found calls 232 // Finds the debug accelerator for |event| and if one is found calls
231 // HandleDebugAccelerator(). 233 // HandleDebugAccelerator().
232 void ProcessDebugAccelerator(const Event& event); 234 void ProcessDebugAccelerator(const Event& event, const int64_t display_id);
233 235
234 // Runs the specified debug accelerator. 236 // Runs the specified debug accelerator.
235 void HandleDebugAccelerator(DebugAcceleratorType type); 237 void HandleDebugAccelerator(DebugAcceleratorType type,
238 const int64_t display_id);
236 239
237 // Called when waiting for an event or accelerator to be processed by |tree|. 240 // Called when waiting for an event or accelerator to be processed by |tree|.
238 void ScheduleInputEventTimeout(WindowTree* tree, 241 void ScheduleInputEventTimeout(WindowTree* tree,
239 ServerWindow* target, 242 ServerWindow* target,
243 const int64_t display_id,
240 const Event& event, 244 const Event& event,
241 EventDispatchPhase phase); 245 EventDispatchPhase phase);
242 246
247 // Helper function to update |point| to be in screen coordinates. Return true
248 // if |point| is successfully updated, false otherwise.
sadrul 2017/05/26 18:04:49 Can you add a comment that |point| as the input sh
riajiang 2017/05/26 18:35:30 Done.
249 bool ConvertPointToScreen(const int64_t display_id, gfx::Point* point);
250
243 // EventDispatcherDelegate: 251 // EventDispatcherDelegate:
244 void OnAccelerator(uint32_t accelerator_id, 252 void OnAccelerator(uint32_t accelerator_id,
253 const int64_t display_id,
245 const Event& event, 254 const Event& event,
246 AcceleratorPhase phase) override; 255 AcceleratorPhase phase) override;
247 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; 256 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
248 ServerWindow* GetFocusedWindowForEventDispatcher() override; 257 ServerWindow* GetFocusedWindowForEventDispatcher(int64_t display_id) override;
249 void SetNativeCapture(ServerWindow* window) override; 258 void SetNativeCapture(ServerWindow* window) override;
250 void ReleaseNativeCapture() override; 259 void ReleaseNativeCapture() override;
251 void UpdateNativeCursorFromDispatcher() override; 260 void UpdateNativeCursorFromDispatcher() override;
252 void OnCaptureChanged(ServerWindow* new_capture, 261 void OnCaptureChanged(ServerWindow* new_capture,
253 ServerWindow* old_capture) override; 262 ServerWindow* old_capture) override;
254 void OnMouseCursorLocationChanged(const gfx::Point& point) override; 263 void OnMouseCursorLocationChanged(const gfx::Point& point,
264 const int64_t display_id) override;
255 void DispatchInputEventToWindow(ServerWindow* target, 265 void DispatchInputEventToWindow(ServerWindow* target,
256 ClientSpecificId client_id, 266 ClientSpecificId client_id,
267 const int64_t display_id,
257 const Event& event, 268 const Event& event,
258 Accelerator* accelerator) override; 269 Accelerator* accelerator) override;
259 ClientSpecificId GetEventTargetClientId(const ServerWindow* window, 270 ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
260 bool in_nonclient_area) override; 271 bool in_nonclient_area) override;
261 ServerWindow* GetRootWindowContaining(gfx::Point* location) override; 272 ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display,
262 void OnEventTargetNotFound(const Event& event) override; 273 int64_t* display_id) override;
274 void OnEventTargetNotFound(const Event& event,
275 const int64_t display_id) override;
263 276
264 // ServerWindowObserver: 277 // ServerWindowObserver:
265 void OnWindowEmbeddedAppDisconnected(ServerWindow* window) override; 278 void OnWindowEmbeddedAppDisconnected(ServerWindow* window) override;
266 279
267 // The single WindowTree this WindowManagerState is associated with. 280 // The single WindowTree this WindowManagerState is associated with.
268 // |window_tree_| owns this. 281 // |window_tree_| owns this.
269 WindowTree* window_tree_; 282 WindowTree* window_tree_;
270 283
271 // Set to true the first time SetFrameDecorationValues() is called. 284 // Set to true the first time SetFrameDecorationValues() is called.
272 bool got_frame_decoration_values_ = false; 285 bool got_frame_decoration_values_ = false;
273 mojom::FrameDecorationValuesPtr frame_decoration_values_; 286 mojom::FrameDecorationValuesPtr frame_decoration_values_;
274 287
275 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; 288 std::queue<std::unique_ptr<QueuedEvent>> event_queue_;
276 289
277 std::vector<DebugAccelerator> debug_accelerators_; 290 std::vector<DebugAccelerator> debug_accelerators_;
278 291
279 // If non-null we're actively waiting for a response from a client for an 292 // If non-null we're actively waiting for a response from a client for an
280 // event. 293 // event.
281 std::unique_ptr<InFlightEventDetails> in_flight_event_details_; 294 std::unique_ptr<InFlightEventDetails> in_flight_event_details_;
282 295
283 EventDispatcher event_dispatcher_; 296 EventDispatcher event_dispatcher_;
284 297
285 // PlatformDisplay that currently has capture. 298 // PlatformDisplay that currently has capture.
286 PlatformDisplay* platform_display_with_capture_ = nullptr; 299 PlatformDisplay* platform_display_with_capture_ = nullptr;
287 300
288 // All the active WindowManagerDisplayRoots. 301 // All the active WindowManagerDisplayRoots.
289 WindowManagerDisplayRoots window_manager_display_roots_; 302 WindowManagerDisplayRoots window_manager_display_roots_;
290 303
291 // Id of the display the current event being processed originated from.
292 int64_t event_processing_display_id_ = 0;
293
294 // Set of WindowManagerDisplayRoots corresponding to Displays that have been 304 // Set of WindowManagerDisplayRoots corresponding to Displays that have been
295 // destroyed. WindowManagerDisplayRoots are not destroyed immediately when 305 // destroyed. WindowManagerDisplayRoots are not destroyed immediately when
296 // the Display is destroyed to allow the client to destroy the window when it 306 // the Display is destroyed to allow the client to destroy the window when it
297 // wants to. Once the client destroys the window WindowManagerDisplayRoots is 307 // wants to. Once the client destroys the window WindowManagerDisplayRoots is
298 // destroyed. 308 // destroyed.
299 WindowManagerDisplayRoots orphaned_window_manager_display_roots_; 309 WindowManagerDisplayRoots orphaned_window_manager_display_roots_;
300 310
301 // All state regarding what the current cursor is. 311 // All state regarding what the current cursor is.
302 CursorState cursor_state_; 312 CursorState cursor_state_;
303 313
304 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); 314 DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
305 }; 315 };
306 316
307 } // namespace ws 317 } // namespace ws
308 } // namespace ui 318 } // namespace ui
309 319
310 #endif // SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_ 320 #endif // SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698