Index: components/mus/ws/window_tree_host_impl.cc |
diff --git a/components/mus/ws/window_tree_host_impl.cc b/components/mus/ws/window_tree_host_impl.cc |
index 7b369b7c16c3d779430a3c9a7c5597b9b4029109..c96240f44fe5f0c0d75c884687b6d90c9c7db740 100644 |
--- a/components/mus/ws/window_tree_host_impl.cc |
+++ b/components/mus/ws/window_tree_host_impl.cc |
@@ -169,6 +169,18 @@ const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { |
return display_manager_->GetViewportMetrics(); |
} |
+void WindowTreeHostImpl::SetCapture(ServerWindow* window, |
+ bool in_nonclient_area) { |
+ ServerWindow* capture_window = event_dispatcher_.capture_window(); |
+ if (capture_window == window) |
+ return; |
+ event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); |
+ if (window) |
+ display_manager_->SetCapture(); |
+ else |
+ display_manager_->ReleaseCapture(); |
+} |
+ |
mojom::Rotation WindowTreeHostImpl::GetRotation() const { |
return display_manager_->GetRotation(); |
} |
@@ -350,8 +362,6 @@ void WindowTreeHostImpl::DispatchInputEventToWindowImpl(ServerWindow* target, |
event_dispatcher_.mouse_cursor_source_window()->cursor()); |
} |
- // If the event is in the non-client area the event goes to the owner of |
- // the window. Otherwise if the window is an embed root, forward to the |
// embedded window. |
WindowTreeImpl* connection = |
in_nonclient_area |
@@ -401,6 +411,10 @@ void WindowTreeHostImpl::OnEvent(const ui::Event& event) { |
event_dispatcher_.ProcessEvent(std::move(mojo_event)); |
} |
+void WindowTreeHostImpl::OnLostCapture() { |
+ SetCapture(nullptr, false); |
+} |
+ |
void WindowTreeHostImpl::OnDisplayClosed() { |
if (delegate_) |
delegate_->OnDisplayClosed(); |
@@ -532,6 +546,11 @@ ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
return GetFocusedWindow(); |
} |
+void WindowTreeHostImpl::OnLostCapture(ServerWindow* window) { |
+ DCHECK(window); |
+ connection_manager_->ProcessLostCapture(window); |
+} |
+ |
void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
bool in_nonclient_area, |
mojom::EventPtr event) { |