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

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

Issue 1759523002: mus: Server-side implementation of modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetAsModal -> SetModal + Other review comments addressed 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
« no previous file with comments | « components/mus/ws/window_manager_state.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/window_manager_state.cc
diff --git a/components/mus/ws/window_manager_state.cc b/components/mus/ws/window_manager_state.cc
index 2a6d983767f48ad8f153bdcce3d3bb6aeb78cbba..2ae1a24ce0bcd481884120702555e8db3bc334eb 100644
--- a/components/mus/ws/window_manager_state.cc
+++ b/components/mus/ws/window_manager_state.cc
@@ -106,15 +106,36 @@ void WindowManagerState::SetFrameDecorationValues(
->OnFrameDecorationValuesChanged(this);
}
-void WindowManagerState::SetCapture(ServerWindow* window,
+bool WindowManagerState::SetCapture(ServerWindow* window,
bool in_nonclient_area) {
// TODO(sky): capture should be a singleton. Need to route to
// ConnectionManager so that all other EventDispatchers are updated.
DCHECK(IsActive());
if (capture_window() == window)
- return;
+ return true;
DCHECK(!window || root_->Contains(window));
- event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
+ return event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
+}
+
+void WindowManagerState::ReleaseCaptureBlockedByModalWindow(
+ const ServerWindow* modal_window) {
+ if (!capture_window() || !modal_window->is_modal() ||
+ !modal_window->IsDrawn())
+ return;
+
+ if (modal_window->transient_parent() &&
+ !modal_window->transient_parent()->Contains(capture_window())) {
+ return;
+ }
+
+ SetCapture(nullptr, false);
+}
+
+void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() {
+ if (!capture_window() || !capture_window()->IsBlockedByModalWindow())
+ return;
+
+ SetCapture(nullptr, false);
}
mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const {
« no previous file with comments | « components/mus/ws/window_manager_state.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698