OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TREE_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_TREE_H_ |
6 #define SERVICES_UI_WS_WINDOW_TREE_H_ | 6 #define SERVICES_UI_WS_WINDOW_TREE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 bool CanEmbed(const ClientWindowId& window_id) const; | 330 bool CanEmbed(const ClientWindowId& window_id) const; |
331 void PrepareForEmbed(ServerWindow* window); | 331 void PrepareForEmbed(ServerWindow* window); |
332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window); | 332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window); |
333 | 333 |
334 // Generates a new event id for an accelerator or event ack, sets it in | 334 // Generates a new event id for an accelerator or event ack, sets it in |
335 // |event_ack_id_| and returns it. | 335 // |event_ack_id_| and returns it. |
336 uint32_t GenerateEventAckId(); | 336 uint32_t GenerateEventAckId(); |
337 | 337 |
338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); | 338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); |
339 | 339 |
| 340 // Returns true if the client has a pointer watcher and this event matches. |
| 341 bool EventMatchesPointerWatcher(const ui::Event& event); |
| 342 |
340 // Calls OnChangeCompleted() on the client. | 343 // Calls OnChangeCompleted() on the client. |
341 void NotifyChangeCompleted(uint32_t change_id, | 344 void NotifyChangeCompleted(uint32_t change_id, |
342 mojom::WindowManagerErrorCode error_code); | 345 mojom::WindowManagerErrorCode error_code); |
343 | 346 |
344 // WindowTree: | 347 // WindowTree: |
345 void NewWindow(uint32_t change_id, | 348 void NewWindow(uint32_t change_id, |
346 Id transport_window_id, | 349 Id transport_window_id, |
347 mojo::Map<mojo::String, mojo::Array<uint8_t>> | 350 mojo::Map<mojo::String, mojo::Array<uint8_t>> |
348 transport_properties) override; | 351 transport_properties) override; |
349 void NewTopLevelWindow(uint32_t change_id, | 352 void NewTopLevelWindow(uint32_t change_id, |
(...skipping 12 matching lines...) Expand all Loading... |
362 void ReorderWindow(uint32_t change_Id, | 365 void ReorderWindow(uint32_t change_Id, |
363 Id window_id, | 366 Id window_id, |
364 Id relative_window_id, | 367 Id relative_window_id, |
365 mojom::OrderDirection direction) override; | 368 mojom::OrderDirection direction) override; |
366 void GetWindowTree( | 369 void GetWindowTree( |
367 Id window_id, | 370 Id window_id, |
368 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) | 371 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) |
369 override; | 372 override; |
370 void SetCapture(uint32_t change_id, Id window_id) override; | 373 void SetCapture(uint32_t change_id, Id window_id) override; |
371 void ReleaseCapture(uint32_t change_id, Id window_id) override; | 374 void ReleaseCapture(uint32_t change_id, Id window_id) override; |
372 void SetEventObserver(mojom::EventMatcherPtr matcher, | 375 void StartPointerWatcher(bool want_moves, |
373 uint32_t observer_id) override; | 376 uint32_t pointer_watcher_id) override; |
| 377 void StopPointerWatcher() override; |
374 void SetWindowBounds(uint32_t change_id, | 378 void SetWindowBounds(uint32_t change_id, |
375 Id window_id, | 379 Id window_id, |
376 const gfx::Rect& bounds) override; | 380 const gfx::Rect& bounds) override; |
377 void SetWindowVisibility(uint32_t change_id, | 381 void SetWindowVisibility(uint32_t change_id, |
378 Id window_id, | 382 Id window_id, |
379 bool visible) override; | 383 bool visible) override; |
380 void SetWindowProperty(uint32_t change_id, | 384 void SetWindowProperty(uint32_t change_id, |
381 Id transport_window_id, | 385 Id transport_window_id, |
382 const mojo::String& name, | 386 const mojo::String& name, |
383 mojo::Array<uint8_t> value) override; | 387 mojo::Array<uint8_t> value) override; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // client (ClientWindowId). | 481 // client (ClientWindowId). |
478 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; | 482 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; |
479 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; | 483 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; |
480 | 484 |
481 uint32_t event_ack_id_; | 485 uint32_t event_ack_id_; |
482 | 486 |
483 // A client is considered janky if it hasn't ACK'ed input events within a | 487 // A client is considered janky if it hasn't ACK'ed input events within a |
484 // reasonable timeframe. | 488 // reasonable timeframe. |
485 bool janky_ = false; | 489 bool janky_ = false; |
486 | 490 |
487 // Set when the client is using SetEventObserver() to observe events, | 491 // Whether the client is observing pointer events. |
488 // otherwise null. | 492 bool has_pointer_watcher_ = false; |
489 std::unique_ptr<EventMatcher> event_observer_matcher_; | |
490 | 493 |
491 // The ID supplied by the client for the current event observer. | 494 // For performance reasons, only send move events if the client explicitly |
492 uint32_t event_observer_id_ = 0; | 495 // requests them. |
| 496 bool pointer_watcher_want_moves_ = false; |
| 497 |
| 498 // The ID supplied by the client for the current pointer watcher. |
| 499 uint32_t pointer_watcher_id_ = 0; |
493 | 500 |
494 // WindowManager the current event came from. | 501 // WindowManager the current event came from. |
495 WindowManagerState* event_source_wms_ = nullptr; | 502 WindowManagerState* event_source_wms_ = nullptr; |
496 | 503 |
497 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; | 504 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; |
498 | 505 |
499 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> | 506 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> |
500 window_manager_internal_client_binding_; | 507 window_manager_internal_client_binding_; |
501 mojom::WindowManager* window_manager_internal_; | 508 mojom::WindowManager* window_manager_internal_; |
502 std::unique_ptr<WindowManagerState> window_manager_state_; | 509 std::unique_ptr<WindowManagerState> window_manager_state_; |
503 | 510 |
504 std::unique_ptr<WaitingForTopLevelWindowInfo> | 511 std::unique_ptr<WaitingForTopLevelWindowInfo> |
505 waiting_for_top_level_window_info_; | 512 waiting_for_top_level_window_info_; |
506 bool embedder_intercepts_events_ = false; | 513 bool embedder_intercepts_events_ = false; |
507 | 514 |
508 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 515 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
509 }; | 516 }; |
510 | 517 |
511 } // namespace ws | 518 } // namespace ws |
512 } // namespace ui | 519 } // namespace ui |
513 | 520 |
514 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ | 521 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ |
OLD | NEW |