OLD | NEW |
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 "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "components/mus/ws/accelerator.h" | 8 #include "components/mus/ws/accelerator.h" |
9 #include "components/mus/ws/display_manager.h" | 9 #include "components/mus/ws/display_manager.h" |
10 #include "components/mus/ws/platform_display.h" | 10 #include "components/mus/ws/platform_display.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 DCHECK(IsActive()); | 121 DCHECK(IsActive()); |
122 if (capture_window() == window) | 122 if (capture_window() == window) |
123 return true; | 123 return true; |
124 DCHECK(!window || root_->Contains(window)); | 124 DCHECK(!window || root_->Contains(window)); |
125 return event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); | 125 return event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); |
126 } | 126 } |
127 | 127 |
128 void WindowManagerState::ReleaseCaptureBlockedByModalWindow( | 128 void WindowManagerState::ReleaseCaptureBlockedByModalWindow( |
129 const ServerWindow* modal_window) { | 129 const ServerWindow* modal_window) { |
130 if (!capture_window() || !modal_window->is_modal() || | 130 if (!capture_window() || !modal_window->is_modal() || |
131 !modal_window->IsDrawn()) | 131 !modal_window->IsDrawn()) { |
132 return; | 132 return; |
| 133 } |
133 | 134 |
134 if (modal_window->transient_parent() && | 135 if (modal_window->transient_parent() && |
135 !modal_window->transient_parent()->Contains(capture_window())) { | 136 !modal_window->transient_parent()->Contains(capture_window())) { |
136 return; | 137 return; |
137 } | 138 } |
138 | 139 |
139 SetCapture(nullptr, false); | 140 SetCapture(nullptr, false); |
140 } | 141 } |
141 | 142 |
142 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { | 143 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { |
143 if (!capture_window() || !capture_window()->IsBlockedByModalWindow()) | 144 if (!capture_window()) |
| 145 return; |
| 146 |
| 147 bool has_system_modal = |
| 148 system_modal_window() && system_modal_window()->IsDrawn(); |
| 149 |
| 150 if (!has_system_modal && !capture_window()->IsBlockedByModalWindow()) |
144 return; | 151 return; |
145 | 152 |
146 SetCapture(nullptr, false); | 153 SetCapture(nullptr, false); |
147 } | 154 } |
148 | 155 |
| 156 bool WindowManagerState::SetSystemModalWindow(ServerWindow* window) { |
| 157 DCHECK(!window->transient_parent()); |
| 158 if (system_modal_window() == window) |
| 159 return true; |
| 160 return event_dispatcher_.SetSystemModalWindow(window); |
| 161 } |
| 162 |
149 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { | 163 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { |
150 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); | 164 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); |
151 // TODO(sky): set work area. | 165 // TODO(sky): set work area. |
152 display_ptr->work_area = display_ptr->bounds.Clone(); | 166 display_ptr->work_area = display_ptr->bounds.Clone(); |
153 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); | 167 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); |
154 return display_ptr; | 168 return display_ptr; |
155 } | 169 } |
156 | 170 |
157 void WindowManagerState::OnWillDestroyTree(WindowTree* tree) { | 171 void WindowManagerState::OnWillDestroyTree(WindowTree* tree) { |
158 if (tree_awaiting_input_ack_ != tree) | 172 if (tree_awaiting_input_ack_ != tree) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 392 |
379 base::WeakPtr<Accelerator> weak_accelerator; | 393 base::WeakPtr<Accelerator> weak_accelerator; |
380 if (accelerator) | 394 if (accelerator) |
381 weak_accelerator = accelerator->GetWeakPtr(); | 395 weak_accelerator = accelerator->GetWeakPtr(); |
382 DispatchInputEventToWindowImpl(target, in_nonclient_area, event, | 396 DispatchInputEventToWindowImpl(target, in_nonclient_area, event, |
383 weak_accelerator); | 397 weak_accelerator); |
384 } | 398 } |
385 | 399 |
386 } // namespace ws | 400 } // namespace ws |
387 } // namespace mus | 401 } // namespace mus |
OLD | NEW |