Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: components/mus/ws/window_tree_host_impl.cc

Issue 1352043005: mus: Implement Window Server Capture Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added capture unit tests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6f84e0e7ce9a551682956f3cc26a1a966f61c071..a14b962244b2b9a527deee59329f782778975b9f 100644
--- a/components/mus/ws/window_tree_host_impl.cc
+++ b/components/mus/ws/window_tree_host_impl.cc
@@ -83,6 +83,21 @@ const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const {
return display_manager_->GetViewportMetrics();
}
+void WindowTreeHostImpl::SetCapture(ServerWindow* window) {
+ ServerWindow* capture_window = event_dispatcher_.capture_window();
+ if (capture_window) {
+ WindowTreeImpl* connection =
+ connection_manager_->GetConnection(capture_window->id().connection_id);
+ if (connection)
+ connection->ProcessLostCapture(capture_window);
+ }
+ 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)
@@ -150,6 +165,10 @@ void WindowTreeHostImpl::OnEvent(mojom::EventPtr event) {
event_dispatcher_.OnEvent(event.Pass());
}
+void WindowTreeHostImpl::OnLostCapture() {
+ SetCapture(nullptr);
+}
+
void WindowTreeHostImpl::OnDisplayClosed() {
if (delegate_)
delegate_->OnDisplayClosed();
@@ -261,6 +280,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) {

Powered by Google App Engine
This is Rietveld 408576698