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 446b32be47d82fe872b576e6ff23e5451481278b..1fa2a97660251b2fb5ca2015dff2441fb0390cc5 100644 |
--- a/components/mus/ws/window_tree_host_impl.cc |
+++ b/components/mus/ws/window_tree_host_impl.cc |
@@ -155,6 +155,21 @@ const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { |
return display_manager_->GetViewportMetrics(); |
} |
+void WindowTreeHostImpl::SetCapture(ServerWindow* window) { |
+ ServerWindow* capture_window = event_dispatcher_.capture_window(); |
sky
2016/01/22 00:55:00
Early out if window == capture_window?
jonross
2016/01/26 18:38:50
Done.
|
+ if (capture_window) { |
+ WindowTreeImpl* connection = |
+ connection_manager_->GetConnection(capture_window->id().connection_id); |
+ if (connection) |
+ connection->ProcessLostCapture(capture_window); |
jonross
2016/01/26 18:38:50
With EventDispatcher now calling EventDispatcherDe
|
+ } |
+ event_dispatcher_.SetCaptureWindow(window); |
+ if (window) |
+ display_manager_->SetCapture(); |
+ else |
+ display_manager_->ReleaseCapture(); |
+} |
+ |
void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { |
ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); |
if (old_focused_window == new_focused_window) |
@@ -385,6 +400,10 @@ void WindowTreeHostImpl::OnEvent(const ui::Event& event) { |
event_dispatcher_.ProcessEvent(std::move(mojo_event)); |
} |
+void WindowTreeHostImpl::OnLostCapture() { |
+ SetCapture(nullptr); |
+} |
+ |
void WindowTreeHostImpl::OnDisplayClosed() { |
if (delegate_) |
delegate_->OnDisplayClosed(); |
@@ -516,6 +535,14 @@ ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
return GetFocusedWindow(); |
} |
+void WindowTreeHostImpl::OnLostCapture(ServerWindow* window) { |
+ DCHECK(window); |
+ WindowTreeImpl* connection = |
+ connection_manager_->GetConnection(window->id().connection_id); |
+ if (connection) |
+ connection->ProcessLostCapture(window); |
+} |
+ |
void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
bool in_nonclient_area, |
mojom::EventPtr event) { |