OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/window_tree_host_impl.h" | 5 #include "components/mus/ws/window_tree_host_impl.h" |
6 | 6 |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/mus/common/types.h" | 9 #include "components/mus/common/types.h" |
10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" | 10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 if (windows_needing_frame_destruction_.count(window)) | 160 if (windows_needing_frame_destruction_.count(window)) |
161 return; | 161 return; |
162 windows_needing_frame_destruction_.insert(window); | 162 windows_needing_frame_destruction_.insert(window); |
163 window->AddObserver(this); | 163 window->AddObserver(this); |
164 } | 164 } |
165 | 165 |
166 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { | 166 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { |
167 return display_manager_->GetViewportMetrics(); | 167 return display_manager_->GetViewportMetrics(); |
168 } | 168 } |
169 | 169 |
170 void WindowTreeHostImpl::SetCapture(ServerWindow* window, | |
171 bool in_nonclient_area) { | |
172 ServerWindow* capture_window = event_dispatcher_.capture_window(); | |
173 if (capture_window == window) | |
174 return; | |
175 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); | |
176 if (window) | |
177 display_manager_->SetCapture(); | |
sky
2016/02/08 16:57:11
I think this is the wrong place for setting/releas
jonross
2016/02/10 15:57:57
Updated EventDispatcherDelegate to have Set/Releas
| |
178 else | |
179 display_manager_->ReleaseCapture(); | |
180 } | |
181 | |
170 mojom::Rotation WindowTreeHostImpl::GetRotation() const { | 182 mojom::Rotation WindowTreeHostImpl::GetRotation() const { |
171 return display_manager_->GetRotation(); | 183 return display_manager_->GetRotation(); |
172 } | 184 } |
173 | 185 |
174 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { | 186 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { |
175 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); | 187 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); |
176 if (old_focused_window == new_focused_window) | 188 if (old_focused_window == new_focused_window) |
177 return; | 189 return; |
178 DCHECK(root_window()->Contains(new_focused_window)); | 190 DCHECK(root_window()->Contains(new_focused_window)); |
179 focus_controller_->SetFocusedWindow(new_focused_window); | 191 focus_controller_->SetFocusedWindow(new_focused_window); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 event_queue_.back()->event = CoalesceEvents( | 404 event_queue_.back()->event = CoalesceEvents( |
393 std::move(event_queue_.back()->event), std::move(mojo_event)); | 405 std::move(event_queue_.back()->event), std::move(mojo_event)); |
394 return; | 406 return; |
395 } | 407 } |
396 QueueEvent(std::move(mojo_event), nullptr); | 408 QueueEvent(std::move(mojo_event), nullptr); |
397 return; | 409 return; |
398 } | 410 } |
399 event_dispatcher_.ProcessEvent(std::move(mojo_event)); | 411 event_dispatcher_.ProcessEvent(std::move(mojo_event)); |
400 } | 412 } |
401 | 413 |
414 void WindowTreeHostImpl::OnLostCapture() { | |
415 SetCapture(nullptr, false); | |
416 } | |
417 | |
402 void WindowTreeHostImpl::OnDisplayClosed() { | 418 void WindowTreeHostImpl::OnDisplayClosed() { |
403 if (delegate_) | 419 if (delegate_) |
404 delegate_->OnDisplayClosed(); | 420 delegate_->OnDisplayClosed(); |
405 } | 421 } |
406 | 422 |
407 void WindowTreeHostImpl::OnViewportMetricsChanged( | 423 void WindowTreeHostImpl::OnViewportMetricsChanged( |
408 const mojom::ViewportMetrics& old_metrics, | 424 const mojom::ViewportMetrics& old_metrics, |
409 const mojom::ViewportMetrics& new_metrics) { | 425 const mojom::ViewportMetrics& new_metrics) { |
410 if (!root_) { | 426 if (!root_) { |
411 root_.reset(connection_manager_->CreateServerWindow( | 427 root_.reset(connection_manager_->CreateServerWindow( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 | 539 |
524 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( | 540 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( |
525 ServerWindow* new_focused_window) { | 541 ServerWindow* new_focused_window) { |
526 SetFocusedWindow(new_focused_window); | 542 SetFocusedWindow(new_focused_window); |
527 } | 543 } |
528 | 544 |
529 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { | 545 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
530 return GetFocusedWindow(); | 546 return GetFocusedWindow(); |
531 } | 547 } |
532 | 548 |
549 void WindowTreeHostImpl::OnLostCapture(ServerWindow* window) { | |
550 DCHECK(window); | |
551 connection_manager_->ProcessLostCapture(window); | |
552 } | |
553 | |
533 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, | 554 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
534 bool in_nonclient_area, | 555 bool in_nonclient_area, |
535 mojom::EventPtr event) { | 556 mojom::EventPtr event) { |
536 if (event_ack_timer_.IsRunning()) { | 557 if (event_ack_timer_.IsRunning()) { |
537 scoped_ptr<ProcessedEventTarget> processed_event_target( | 558 scoped_ptr<ProcessedEventTarget> processed_event_target( |
538 new ProcessedEventTarget(target, in_nonclient_area)); | 559 new ProcessedEventTarget(target, in_nonclient_area)); |
539 QueueEvent(std::move(event), std::move(processed_event_target)); | 560 QueueEvent(std::move(event), std::move(processed_event_target)); |
540 return; | 561 return; |
541 } | 562 } |
542 | 563 |
543 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); | 564 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); |
544 } | 565 } |
545 | 566 |
546 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 567 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
547 windows_needing_frame_destruction_.erase(window); | 568 windows_needing_frame_destruction_.erase(window); |
548 window->RemoveObserver(this); | 569 window->RemoveObserver(this); |
549 } | 570 } |
550 | 571 |
551 } // namespace ws | 572 } // namespace ws |
552 } // namespace mus | 573 } // namespace mus |
OLD | NEW |