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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // so that all other EventDispatchers are updated. | 120 // so that all other EventDispatchers are updated. |
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 event_dispatcher_.ReleaseCaptureBlockedByModalWindow(modal_window); | 130 if (!capture_window() || !modal_window->is_modal() || |
| 131 !modal_window->IsDrawn()) |
| 132 return; |
| 133 |
| 134 if (modal_window->transient_parent() && |
| 135 !modal_window->transient_parent()->Contains(capture_window())) { |
| 136 return; |
| 137 } |
| 138 |
| 139 SetCapture(nullptr, false); |
131 } | 140 } |
132 | 141 |
133 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { | 142 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { |
134 event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow(); | 143 if (!capture_window() || !capture_window()->IsBlockedByModalWindow()) |
135 } | 144 return; |
136 | 145 |
137 void WindowManagerState::AddSystemModalWindow(ServerWindow* window) { | 146 SetCapture(nullptr, false); |
138 DCHECK(!window->transient_parent()); | |
139 event_dispatcher_.AddSystemModalWindow(window); | |
140 } | 147 } |
141 | 148 |
142 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { | 149 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { |
143 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); | 150 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); |
144 // TODO(sky): set work area. | 151 // TODO(sky): set work area. |
145 display_ptr->work_area = display_ptr->bounds.Clone(); | 152 display_ptr->work_area = display_ptr->bounds.Clone(); |
146 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); | 153 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); |
147 return display_ptr; | 154 return display_ptr; |
148 } | 155 } |
149 | 156 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 weak_accelerator); | 395 weak_accelerator); |
389 } | 396 } |
390 | 397 |
391 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { | 398 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
392 window_server()->SendToEventObservers(event, user_id_, | 399 window_server()->SendToEventObservers(event, user_id_, |
393 nullptr /* ignore_tree */); | 400 nullptr /* ignore_tree */); |
394 } | 401 } |
395 | 402 |
396 } // namespace ws | 403 } // namespace ws |
397 } // namespace mus | 404 } // namespace mus |
OLD | NEW |