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 #include "services/ui/ws/window_server.h" | 5 #include "services/ui/ws/window_server.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 namespace ui { | 31 namespace ui { |
32 namespace ws { | 32 namespace ws { |
33 | 33 |
34 struct WindowServer::CurrentMoveLoopState { | 34 struct WindowServer::CurrentMoveLoopState { |
35 uint32_t change_id; | 35 uint32_t change_id; |
36 ServerWindow* window; | 36 ServerWindow* window; |
37 WindowTree* initiator; | 37 WindowTree* initiator; |
38 gfx::Rect revert_bounds; | 38 gfx::Rect revert_bounds; |
39 }; | 39 }; |
40 | 40 |
41 struct WindowServer::CurrentDragLoopState { | |
42 uint32_t change_id; | |
43 ServerWindow* window; | |
44 WindowTree* initiator; | |
45 }; | |
46 | |
41 WindowServer::WindowServer(WindowServerDelegate* delegate) | 47 WindowServer::WindowServer(WindowServerDelegate* delegate) |
42 : delegate_(delegate), | 48 : delegate_(delegate), |
43 surfaces_state_(new SurfacesState()), | 49 surfaces_state_(new SurfacesState()), |
44 next_client_id_(1), | 50 next_client_id_(1), |
45 display_manager_(new DisplayManager(this, &user_id_tracker_)), | 51 display_manager_(new DisplayManager(this, &user_id_tracker_)), |
46 current_operation_(nullptr), | 52 current_operation_(nullptr), |
47 in_destructor_(false), | 53 in_destructor_(false), |
48 next_wm_change_id_(0), | 54 next_wm_change_id_(0), |
49 gpu_proxy_(new GpuServiceProxy(this)), | 55 gpu_proxy_(new GpuServiceProxy(this)), |
50 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { | 56 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 return current_move_loop_->initiator; | 483 return current_move_loop_->initiator; |
478 return nullptr; | 484 return nullptr; |
479 } | 485 } |
480 | 486 |
481 gfx::Rect WindowServer::GetCurrentMoveLoopRevertBounds() { | 487 gfx::Rect WindowServer::GetCurrentMoveLoopRevertBounds() { |
482 if (current_move_loop_) | 488 if (current_move_loop_) |
483 return current_move_loop_->revert_bounds; | 489 return current_move_loop_->revert_bounds; |
484 return gfx::Rect(); | 490 return gfx::Rect(); |
485 } | 491 } |
486 | 492 |
493 void WindowServer::StartDragLoop(uint32_t change_id, | |
494 ServerWindow* window, | |
495 WindowTree* initiator) { | |
496 current_drag_loop_.reset( | |
497 new CurrentDragLoopState{change_id, window, initiator}); | |
498 } | |
499 | |
500 void WindowServer::EndDragLoop() { | |
501 current_drag_loop_.reset(); | |
502 } | |
503 | |
504 uint32_t WindowServer::GetCurrentDragLoopChangeId() { | |
sky
2016/09/13 18:15:32
Why does this information need to be held by the W
Elliot Glaysher
2016/09/14 22:19:16
Parallelism with storing the move loop for the saf
sky
2016/09/14 22:52:02
Isn't this information seldomly used? If so, can y
Elliot Glaysher
2016/09/15 17:12:40
WindowServer doesn't publicly expose the WindowTre
sky
2016/09/15 18:10:46
Fair enough.
| |
505 if (current_drag_loop_) | |
506 return current_drag_loop_->change_id; | |
507 return 0u; | |
508 } | |
509 | |
510 ServerWindow* WindowServer::GetCurrentDragLoopWindow() { | |
511 if (current_drag_loop_) | |
512 return current_drag_loop_->window; | |
513 return nullptr; | |
514 } | |
515 | |
516 WindowTree* WindowServer::GetCurrentDragLoopInitiator() { | |
517 if (current_drag_loop_) | |
518 return current_drag_loop_->initiator; | |
519 return nullptr; | |
520 } | |
521 | |
487 void WindowServer::OnDisplayReady(Display* display, bool is_first) { | 522 void WindowServer::OnDisplayReady(Display* display, bool is_first) { |
488 if (gpu_channel_) | 523 if (gpu_channel_) |
489 display->platform_display()->OnGpuChannelEstablished(gpu_channel_); | 524 display->platform_display()->OnGpuChannelEstablished(gpu_channel_); |
490 if (is_first) | 525 if (is_first) |
491 delegate_->OnFirstDisplayReady(); | 526 delegate_->OnFirstDisplayReady(); |
492 } | 527 } |
493 | 528 |
494 void WindowServer::OnNoMoreDisplays() { | 529 void WindowServer::OnNoMoreDisplays() { |
495 delegate_->OnNoMoreDisplays(); | 530 delegate_->OnNoMoreDisplays(); |
496 } | 531 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); | 828 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); |
794 } | 829 } |
795 | 830 |
796 void WindowServer::OnUserIdRemoved(const UserId& id) { | 831 void WindowServer::OnUserIdRemoved(const UserId& id) { |
797 activity_monitor_map_.erase(id); | 832 activity_monitor_map_.erase(id); |
798 clipboard_map_.erase(id); | 833 clipboard_map_.erase(id); |
799 } | 834 } |
800 | 835 |
801 } // namespace ws | 836 } // namespace ws |
802 } // namespace ui | 837 } // namespace ui |
OLD | NEW |