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

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

Issue 1677513002: mus Window Server: implement event capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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_impl.cc
diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree_impl.cc
index 4cdce9d6db16c866092bb502d92b33cf36e8e820..df73c46fbc683ac2ef8f7fb5b828a34bf57b2363 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree_impl.cc
@@ -607,6 +607,17 @@ bool WindowTreeImpl::ShouldRouteToWindowManager(
return is_wm ? false : true;
}
+void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window,
+ bool originated_change) {
+ if ((originated_change &&
+ connection_manager_->current_operation_type() ==
+ OperationType::RELEASE_CAPTURE) ||
+ !IsWindowKnown(old_capture_window)) {
+ return;
+ }
+ client()->OnLostCapture(WindowIdToTransportId(old_capture_window->id()));
+}
+
ClientWindowId WindowTreeImpl::ClientWindowIdForWindow(
const ServerWindow* window) const {
auto iter = window_id_to_client_id_map_.find(window->id());
@@ -995,6 +1006,38 @@ void WindowTreeImpl::GetWindowTree(
callback.Run(WindowsToWindowDatas(windows));
}
+void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ WindowTreeHostImpl* host = GetHost(window);
+ ServerWindow* current_capture_window =
+ host ? host->GetCaptureWindow() : nullptr;
+ bool success = window && access_policy_->CanSetCapture(window) && host &&
+ (!current_capture_window ||
+ access_policy_->CanSetCapture(current_capture_window)) &&
+ event_ack_id_;
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::SET_CAPTURE);
+ host->SetCapture(window, !HasRoot(window));
+ }
+ client_->OnChangeCompleted(change_id, success);
+}
+
+void WindowTreeImpl::ReleaseCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ WindowTreeHostImpl* host = GetHost(window);
+ ServerWindow* current_capture_window =
+ host ? host->GetCaptureWindow() : nullptr;
+ bool success = window && host &&
+ (!current_capture_window ||
+ access_policy_->CanSetCapture(current_capture_window)) &&
+ window == current_capture_window;
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::RELEASE_CAPTURE);
+ host->SetCapture(nullptr, false);
+ }
+ client_->OnChangeCompleted(change_id, success);
+}
+
void WindowTreeImpl::SetWindowBounds(uint32_t change_id,
Id window_id,
mojo::RectPtr bounds) {

Powered by Google App Engine
This is Rietveld 408576698