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