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

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

Issue 1759523002: mus: Server-side implementation of modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 4 years, 9 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/display.cc
diff --git a/components/mus/ws/display.cc b/components/mus/ws/display.cc
index ef878ead97ca64be53fc4cd3dd92951f8f1fb127..410a8359547a01a60fcc01fa3901ccf4983e8eb3 100644
--- a/components/mus/ws/display.cc
+++ b/components/mus/ws/display.cc
@@ -213,11 +213,24 @@ const WindowManagerState* Display::GetWindowManagerStateForUser(
return iter == window_manager_state_map_.end() ? nullptr : iter->second.get();
}
-void Display::SetCapture(ServerWindow* window, bool in_nonclient_area) {
+bool Display::SetCapture(ServerWindow* window, bool in_nonclient_area) {
ServerWindow* capture_window = event_dispatcher_.capture_window();
if (capture_window == window)
+ return true;
+ return event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
+}
+
+void Display::ReleaseCaptureForModalWindow(ServerWindow* window) {
+ if (!window->is_modal() || !window->IsDrawn())
+ return;
+
+ ServerWindow* capture_window = GetCaptureWindow();
+ if (window->transient_parent() &&
+ !window->transient_parent()->Contains(capture_window)) {
return;
- event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
+ }
+
+ SetCapture(nullptr, false);
}
mojom::Rotation Display::GetRotation() const {

Powered by Google App Engine
This is Rietveld 408576698