| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ? base::TimeDelta::FromDays(1) | 322 ? base::TimeDelta::FromDays(1) |
| 323 : GetDefaultAckTimerDelay(); | 323 : GetDefaultAckTimerDelay(); |
| 324 event_ack_timer_.Start(FROM_HERE, max_delay, this, | 324 event_ack_timer_.Start(FROM_HERE, max_delay, this, |
| 325 &WindowManagerState::OnEventAckTimeout); | 325 &WindowManagerState::OnEventAckTimeout); |
| 326 | 326 |
| 327 tree_awaiting_input_ack_ = tree; | 327 tree_awaiting_input_ack_ = tree; |
| 328 if (accelerator) { | 328 if (accelerator) { |
| 329 event_awaiting_input_ack_ = ui::Event::Clone(event); | 329 event_awaiting_input_ack_ = ui::Event::Clone(event); |
| 330 post_target_accelerator_ = accelerator; | 330 post_target_accelerator_ = accelerator; |
| 331 } | 331 } |
| 332 |
| 333 // Ignore |tree| because it will receive the event via normal dispatch. |
| 334 window_server()->SendToEventObservers(event, user_id_, tree); |
| 335 |
| 332 tree->DispatchInputEvent(target, event); | 336 tree->DispatchInputEvent(target, event); |
| 333 } | 337 } |
| 334 | 338 |
| 339 //////////////////////////////////////////////////////////////////////////////// |
| 340 // EventDispatcherDelegate: |
| 341 |
| 335 void WindowManagerState::OnAccelerator(uint32_t accelerator_id, | 342 void WindowManagerState::OnAccelerator(uint32_t accelerator_id, |
| 336 const ui::Event& event) { | 343 const ui::Event& event) { |
| 337 DCHECK(IsActive()); | 344 DCHECK(IsActive()); |
| 338 tree_->OnAccelerator(accelerator_id, event); | 345 tree_->OnAccelerator(accelerator_id, event); |
| 339 } | 346 } |
| 340 | 347 |
| 341 void WindowManagerState::SetFocusedWindowFromEventDispatcher( | 348 void WindowManagerState::SetFocusedWindowFromEventDispatcher( |
| 342 ServerWindow* new_focused_window) { | 349 ServerWindow* new_focused_window) { |
| 343 DCHECK(IsActive()); | 350 DCHECK(IsActive()); |
| 344 display_->SetFocusedWindow(new_focused_window); | 351 display_->SetFocusedWindow(new_focused_window); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 return; | 383 return; |
| 377 } | 384 } |
| 378 | 385 |
| 379 base::WeakPtr<Accelerator> weak_accelerator; | 386 base::WeakPtr<Accelerator> weak_accelerator; |
| 380 if (accelerator) | 387 if (accelerator) |
| 381 weak_accelerator = accelerator->GetWeakPtr(); | 388 weak_accelerator = accelerator->GetWeakPtr(); |
| 382 DispatchInputEventToWindowImpl(target, in_nonclient_area, event, | 389 DispatchInputEventToWindowImpl(target, in_nonclient_area, event, |
| 383 weak_accelerator); | 390 weak_accelerator); |
| 384 } | 391 } |
| 385 | 392 |
| 393 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
| 394 window_server()->SendToEventObservers(event, user_id_, |
| 395 nullptr /* ignore_tree */); |
| 396 } |
| 397 |
| 386 } // namespace ws | 398 } // namespace ws |
| 387 } // namespace mus | 399 } // namespace mus |
| OLD | NEW |