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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/ws/window_manager_state.h" 5 #include "components/mus/ws/window_manager_state.h"
6 6
7 #include "components/mus/ws/connection_manager.h" 7 #include "components/mus/ws/connection_manager.h"
8 #include "components/mus/ws/display_manager.h" 8 #include "components/mus/ws/display_manager.h"
9 #include "components/mus/ws/platform_display.h" 9 #include "components/mus/ws/platform_display.h"
10 #include "components/mus/ws/server_window.h" 10 #include "components/mus/ws/server_window.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void WindowManagerState::SetFrameDecorationValues( 100 void WindowManagerState::SetFrameDecorationValues(
101 mojom::FrameDecorationValuesPtr values) { 101 mojom::FrameDecorationValuesPtr values) {
102 got_frame_decoration_values_ = true; 102 got_frame_decoration_values_ = true;
103 frame_decoration_values_ = values.Clone(); 103 frame_decoration_values_ = values.Clone();
104 display_->display_manager() 104 display_->display_manager()
105 ->GetUserDisplayManager(user_id_) 105 ->GetUserDisplayManager(user_id_)
106 ->OnFrameDecorationValuesChanged(this); 106 ->OnFrameDecorationValuesChanged(this);
107 } 107 }
108 108
109 void WindowManagerState::SetCapture(ServerWindow* window, 109 bool WindowManagerState::SetCapture(ServerWindow* window,
110 bool in_nonclient_area) { 110 bool in_nonclient_area) {
111 // TODO(sky): capture should be a singleton. Need to route to 111 // TODO(sky): capture should be a singleton. Need to route to
112 // ConnectionManager so that all other EventDispatchers are updated. 112 // ConnectionManager so that all other EventDispatchers are updated.
113 DCHECK(IsActive()); 113 DCHECK(IsActive());
114 if (capture_window() == window) 114 if (capture_window() == window)
115 return true;
116 DCHECK(!window || root_->Contains(window));
117 return event_dispatcher_.SetCaptureWindow(window, in_nonclient_area);
118 }
119
120 void WindowManagerState::ReleaseCaptureBlockedByModalWindow(
121 const ServerWindow* modal_window) {
122 if (!capture_window() || !modal_window->is_modal() ||
123 !modal_window->IsDrawn())
115 return; 124 return;
116 DCHECK(!window || root_->Contains(window)); 125
117 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); 126 if (modal_window->transient_parent() &&
127 !modal_window->transient_parent()->Contains(capture_window())) {
128 return;
129 }
130
131 SetCapture(nullptr, false);
132 }
133
134 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() {
135 if (!capture_window() || !capture_window()->IsBlockedByModalWindow())
136 return;
137
138 SetCapture(nullptr, false);
118 } 139 }
119 140
120 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { 141 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const {
121 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); 142 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay();
122 // TODO(sky): set work area. 143 // TODO(sky): set work area.
123 display_ptr->work_area = display_ptr->bounds.Clone(); 144 display_ptr->work_area = display_ptr->bounds.Clone();
124 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); 145 display_ptr->frame_decoration_values = frame_decoration_values_.Clone();
125 return display_ptr; 146 return display_ptr;
126 } 147 }
127 148
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 new ProcessedEventTarget(target, in_nonclient_area)); 331 new ProcessedEventTarget(target, in_nonclient_area));
311 QueueEvent(event, std::move(processed_event_target)); 332 QueueEvent(event, std::move(processed_event_target));
312 return; 333 return;
313 } 334 }
314 335
315 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); 336 DispatchInputEventToWindowImpl(target, in_nonclient_area, event);
316 } 337 }
317 338
318 } // namespace ws 339 } // namespace ws
319 } // namespace mus 340 } // namespace mus
OLDNEW
« 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