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 "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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 // If the event is in the non-client area the event goes to the owner of | 270 // If the event is in the non-client area the event goes to the owner of |
271 // the window. Otherwise if the window is an embed root, forward to the | 271 // the window. Otherwise if the window is an embed root, forward to the |
272 // embedded window. | 272 // embedded window. |
273 WindowTree* tree = | 273 WindowTree* tree = |
274 in_nonclient_area | 274 in_nonclient_area |
275 ? connection_manager()->GetTreeWithId(target->id().connection_id) | 275 ? connection_manager()->GetTreeWithId(target->id().connection_id) |
276 : connection_manager()->GetTreeWithRoot(target); | 276 : connection_manager()->GetTreeWithRoot(target); |
277 if (!tree) { | 277 if (!tree) { |
278 DCHECK(!in_nonclient_area); | 278 if (in_nonclient_area) { |
279 tree = connection_manager()->GetTreeWithId(target->id().connection_id); | 279 // Being the root of the tree means we may get events outside the bounds |
| 280 // of the platform window. Because the root has a connection id of 0, |
| 281 // no WindowTree is found for it and we have to special case it here. |
| 282 DCHECK_EQ(target, root_.get()); |
| 283 tree = tree_; |
| 284 } else { |
| 285 tree = connection_manager()->GetTreeWithId(target->id().connection_id); |
| 286 } |
280 } | 287 } |
281 | 288 |
282 // TOOD(sad): Adjust this delay, possibly make this dynamic. | 289 // TOOD(sad): Adjust this delay, possibly make this dynamic. |
283 const base::TimeDelta max_delay = base::debug::BeingDebugged() | 290 const base::TimeDelta max_delay = base::debug::BeingDebugged() |
284 ? base::TimeDelta::FromDays(1) | 291 ? base::TimeDelta::FromDays(1) |
285 : GetDefaultAckTimerDelay(); | 292 : GetDefaultAckTimerDelay(); |
286 event_ack_timer_.Start(FROM_HERE, max_delay, this, | 293 event_ack_timer_.Start(FROM_HERE, max_delay, this, |
287 &WindowManagerState::OnEventAckTimeout); | 294 &WindowManagerState::OnEventAckTimeout); |
288 | 295 |
289 tree_awaiting_input_ack_ = tree; | 296 tree_awaiting_input_ack_ = tree; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 new ProcessedEventTarget(target, in_nonclient_area)); | 338 new ProcessedEventTarget(target, in_nonclient_area)); |
332 QueueEvent(event, std::move(processed_event_target)); | 339 QueueEvent(event, std::move(processed_event_target)); |
333 return; | 340 return; |
334 } | 341 } |
335 | 342 |
336 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); | 343 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); |
337 } | 344 } |
338 | 345 |
339 } // namespace ws | 346 } // namespace ws |
340 } // namespace mus | 347 } // namespace mus |
OLD | NEW |