| OLD | NEW |
| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 struct QueuedEvent { | 147 struct QueuedEvent { |
| 148 QueuedEvent(); | 148 QueuedEvent(); |
| 149 ~QueuedEvent(); | 149 ~QueuedEvent(); |
| 150 | 150 |
| 151 std::unique_ptr<Event> event; | 151 std::unique_ptr<Event> event; |
| 152 std::unique_ptr<ProcessedEventTarget> processed_target; | 152 std::unique_ptr<ProcessedEventTarget> processed_target; |
| 153 int64_t display_id; | 153 int64_t display_id; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 // Tracks state associated with an event being dispatched to a client. | 156 // Tracks state associated with an event being dispatched to a client. |
| 157 struct InFlightEventDetails { | 157 struct InFlightEventDispatchDetails { |
| 158 InFlightEventDetails(WindowManagerState* window_manager_state, | 158 InFlightEventDispatchDetails(WindowManagerState* window_manager_state, |
| 159 WindowTree* tree, | 159 WindowTree* tree, |
| 160 int64_t display_id, | 160 int64_t display_id, |
| 161 const Event& event, | 161 const Event& event, |
| 162 EventDispatchPhase phase); | 162 EventDispatchPhase phase); |
| 163 ~InFlightEventDetails(); | 163 ~InFlightEventDispatchDetails(); |
| 164 | 164 |
| 165 base::OneShotTimer timer; | 165 base::OneShotTimer timer; |
| 166 WindowTree* tree; | 166 WindowTree* tree; |
| 167 int64_t display_id; | 167 int64_t display_id; |
| 168 std::unique_ptr<Event> event; | 168 std::unique_ptr<Event> event; |
| 169 EventDispatchPhase phase; | 169 EventDispatchPhase phase; |
| 170 base::WeakPtr<Accelerator> post_target_accelerator; | 170 base::WeakPtr<Accelerator> post_target_accelerator; |
| 171 // Used for callbacks/timer specific to processing |event|. | 171 // Used for callbacks/timer specific to processing |event|. |
| 172 base::WeakPtrFactory<WindowManagerState> weak_factory; | 172 base::WeakPtrFactory<WindowManagerState> weak_factory; |
| 173 }; | 173 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 // Implemenation of processing an event with a match phase of all. This | 208 // Implemenation of processing an event with a match phase of all. This |
| 209 // handles debug accelerators and forwards to EventDispatcher. | 209 // handles debug accelerators and forwards to EventDispatcher. |
| 210 void ProcessEventImpl(const Event& event, int64_t display_id); | 210 void ProcessEventImpl(const Event& event, int64_t display_id); |
| 211 | 211 |
| 212 // Schedules an event to be processed later. | 212 // Schedules an event to be processed later. |
| 213 void QueueEvent(const Event& event, | 213 void QueueEvent(const Event& event, |
| 214 std::unique_ptr<ProcessedEventTarget> processed_event_target, | 214 std::unique_ptr<ProcessedEventTarget> processed_event_target, |
| 215 int64_t display_id); | 215 int64_t display_id); |
| 216 | 216 |
| 217 // Processes the next valid event in |event_queue_|. If the event has already | |
| 218 // been processed it is dispatched, otherwise the event is passed to the | |
| 219 // EventDispatcher for processing. | |
| 220 void ProcessNextEventFromQueue(); | |
| 221 | |
| 222 // Dispatches the event to the appropriate client and starts the ack timer. | 217 // Dispatches the event to the appropriate client and starts the ack timer. |
| 223 void DispatchInputEventToWindowImpl(ServerWindow* target, | 218 void DispatchInputEventToWindowImpl(ServerWindow* target, |
| 224 ClientSpecificId client_id, | 219 ClientSpecificId client_id, |
| 225 const int64_t display_id, | 220 const int64_t display_id, |
| 226 const Event& event, | 221 const Event& event, |
| 227 base::WeakPtr<Accelerator> accelerator); | 222 base::WeakPtr<Accelerator> accelerator); |
| 228 | 223 |
| 229 // Registers accelerators used internally for debugging. | 224 // Registers accelerators used internally for debugging. |
| 230 void AddDebugAccelerators(); | 225 void AddDebugAccelerators(); |
| 231 | 226 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void UpdateNativeCursorFromDispatcher() override; | 258 void UpdateNativeCursorFromDispatcher() override; |
| 264 void OnCaptureChanged(ServerWindow* new_capture, | 259 void OnCaptureChanged(ServerWindow* new_capture, |
| 265 ServerWindow* old_capture) override; | 260 ServerWindow* old_capture) override; |
| 266 void OnMouseCursorLocationChanged(const gfx::Point& point, | 261 void OnMouseCursorLocationChanged(const gfx::Point& point, |
| 267 const int64_t display_id) override; | 262 const int64_t display_id) override; |
| 268 void DispatchInputEventToWindow(ServerWindow* target, | 263 void DispatchInputEventToWindow(ServerWindow* target, |
| 269 ClientSpecificId client_id, | 264 ClientSpecificId client_id, |
| 270 const int64_t display_id, | 265 const int64_t display_id, |
| 271 const Event& event, | 266 const Event& event, |
| 272 Accelerator* accelerator) override; | 267 Accelerator* accelerator) override; |
| 268 // Processes the next valid event in |event_queue_|. If the event has already |
| 269 // been processed it is dispatched, otherwise the event is passed to the |
| 270 // EventDispatcher for processing. |
| 271 void ProcessNextEventFromQueue() override; |
| 273 ClientSpecificId GetEventTargetClientId(const ServerWindow* window, | 272 ClientSpecificId GetEventTargetClientId(const ServerWindow* window, |
| 274 bool in_nonclient_area) override; | 273 bool in_nonclient_area) override; |
| 275 ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, | 274 ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, |
| 276 int64_t* display_id) override; | 275 int64_t* display_id) override; |
| 277 void OnEventTargetNotFound(const Event& event, | 276 void OnEventTargetNotFound(const Event& event, |
| 278 const int64_t display_id) override; | 277 const int64_t display_id) override; |
| 279 | 278 |
| 280 // ServerWindowObserver: | 279 // ServerWindowObserver: |
| 281 void OnWindowEmbeddedAppDisconnected(ServerWindow* window) override; | 280 void OnWindowEmbeddedAppDisconnected(ServerWindow* window) override; |
| 282 | 281 |
| 283 // The single WindowTree this WindowManagerState is associated with. | 282 // The single WindowTree this WindowManagerState is associated with. |
| 284 // |window_tree_| owns this. | 283 // |window_tree_| owns this. |
| 285 WindowTree* window_tree_; | 284 WindowTree* window_tree_; |
| 286 | 285 |
| 287 // Set to true the first time SetFrameDecorationValues() is called. | 286 // Set to true the first time SetFrameDecorationValues() is called. |
| 288 bool got_frame_decoration_values_ = false; | 287 bool got_frame_decoration_values_ = false; |
| 289 mojom::FrameDecorationValuesPtr frame_decoration_values_; | 288 mojom::FrameDecorationValuesPtr frame_decoration_values_; |
| 290 | 289 |
| 290 // Events can go into this queue if there's a hit-test in flight in |
| 291 // EventDispatcher or if we are actively dispatching an event. |
| 291 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; | 292 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; |
| 292 | 293 |
| 293 std::vector<DebugAccelerator> debug_accelerators_; | 294 std::vector<DebugAccelerator> debug_accelerators_; |
| 294 | 295 |
| 295 // If non-null we're actively waiting for a response from a client for an | 296 // If non-null we're actively waiting for a response from a client for an |
| 296 // event. | 297 // event. |
| 297 std::unique_ptr<InFlightEventDetails> in_flight_event_details_; | 298 std::unique_ptr<InFlightEventDispatchDetails> |
| 299 in_flight_event_dispatch_details_; |
| 298 | 300 |
| 299 EventDispatcher event_dispatcher_; | 301 EventDispatcher event_dispatcher_; |
| 300 | 302 |
| 301 // PlatformDisplay that currently has capture. | 303 // PlatformDisplay that currently has capture. |
| 302 PlatformDisplay* platform_display_with_capture_ = nullptr; | 304 PlatformDisplay* platform_display_with_capture_ = nullptr; |
| 303 | 305 |
| 304 // All the active WindowManagerDisplayRoots. | 306 // All the active WindowManagerDisplayRoots. |
| 305 WindowManagerDisplayRoots window_manager_display_roots_; | 307 WindowManagerDisplayRoots window_manager_display_roots_; |
| 306 | 308 |
| 307 // Set of WindowManagerDisplayRoots corresponding to Displays that have been | 309 // Set of WindowManagerDisplayRoots corresponding to Displays that have been |
| 308 // destroyed. WindowManagerDisplayRoots are not destroyed immediately when | 310 // destroyed. WindowManagerDisplayRoots are not destroyed immediately when |
| 309 // the Display is destroyed to allow the client to destroy the window when it | 311 // the Display is destroyed to allow the client to destroy the window when it |
| 310 // wants to. Once the client destroys the window WindowManagerDisplayRoots is | 312 // wants to. Once the client destroys the window WindowManagerDisplayRoots is |
| 311 // destroyed. | 313 // destroyed. |
| 312 WindowManagerDisplayRoots orphaned_window_manager_display_roots_; | 314 WindowManagerDisplayRoots orphaned_window_manager_display_roots_; |
| 313 | 315 |
| 314 // All state regarding what the current cursor is. | 316 // All state regarding what the current cursor is. |
| 315 CursorState cursor_state_; | 317 CursorState cursor_state_; |
| 316 | 318 |
| 317 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); | 319 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); |
| 318 }; | 320 }; |
| 319 | 321 |
| 320 } // namespace ws | 322 } // namespace ws |
| 321 } // namespace ui | 323 } // namespace ui |
| 322 | 324 |
| 323 #endif // SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_ | 325 #endif // SERVICES_UI_WS_WINDOW_MANAGER_STATE_H_ |
| OLD | NEW |