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 "services/ui/ws/window_manager_state.h" | 5 #include "services/ui/ws/window_manager_state.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "services/shell/public/interfaces/connector.mojom.h" | 8 #include "services/shell/public/interfaces/connector.mojom.h" |
9 #include "services/ui/common/event_matcher_util.h" | 9 #include "services/ui/common/event_matcher_util.h" |
10 #include "services/ui/ws/accelerator.h" | 10 #include "services/ui/ws/accelerator.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 event_ack_timer_.Stop(); | 234 event_ack_timer_.Stop(); |
235 event_dispatch_phase_ = EventDispatchPhase::NONE; | 235 event_dispatch_phase_ = EventDispatchPhase::NONE; |
236 std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_); | 236 std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_); |
237 | 237 |
238 if (result == mojom::EventResult::UNHANDLED) { | 238 if (result == mojom::EventResult::UNHANDLED) { |
239 event_dispatcher_.ProcessEvent( | 239 event_dispatcher_.ProcessEvent( |
240 *event, EventDispatcher::AcceleratorMatchPhase::POST_ONLY); | 240 *event, EventDispatcher::AcceleratorMatchPhase::POST_ONLY); |
241 } else { | 241 } else { |
242 // We're not going to process the event any further, notify event observers. | 242 // We're not going to process the event any further, notify event observers. |
243 // We don't do this first to ensure we don't send an event twice to clients. | 243 // We don't do this first to ensure we don't send an event twice to clients. |
244 window_server()->SendToEventObservers(*event, user_id(), nullptr); | 244 window_server()->SendToPointerWatchers(*event, user_id(), nullptr); |
245 ProcessNextEventFromQueue(); | 245 ProcessNextEventFromQueue(); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 const WindowServer* WindowManagerState::window_server() const { | 249 const WindowServer* WindowManagerState::window_server() const { |
250 return window_tree_->window_server(); | 250 return window_tree_->window_server(); |
251 } | 251 } |
252 | 252 |
253 WindowServer* WindowManagerState::window_server() { | 253 WindowServer* WindowManagerState::window_server() { |
254 return window_tree_->window_server(); | 254 return window_tree_->window_server(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 WindowTree* tree = window_server()->GetTreeWithId(client_id); | 352 WindowTree* tree = window_server()->GetTreeWithId(client_id); |
353 DCHECK(tree); | 353 DCHECK(tree); |
354 ScheduleInputEventTimeout(tree); | 354 ScheduleInputEventTimeout(tree); |
355 | 355 |
356 if (accelerator) { | 356 if (accelerator) { |
357 event_awaiting_input_ack_ = ui::Event::Clone(event); | 357 event_awaiting_input_ack_ = ui::Event::Clone(event); |
358 post_target_accelerator_ = accelerator; | 358 post_target_accelerator_ = accelerator; |
359 } | 359 } |
360 | 360 |
361 // Ignore |tree| because it will receive the event via normal dispatch. | 361 // Ignore |tree| because it will receive the event via normal dispatch. |
362 window_server()->SendToEventObservers(event, user_id(), tree); | 362 window_server()->SendToPointerWatchers(event, user_id(), tree); |
363 | 363 |
364 tree->DispatchInputEvent(target, event); | 364 tree->DispatchInputEvent(target, event); |
365 } | 365 } |
366 | 366 |
367 void WindowManagerState::AddDebugAccelerators() { | 367 void WindowManagerState::AddDebugAccelerators() { |
368 const DebugAccelerator accelerator = { | 368 const DebugAccelerator accelerator = { |
369 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S, | 369 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S, |
370 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN}; | 370 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN}; |
371 debug_accelerators_.push_back(accelerator); | 371 debug_accelerators_.push_back(accelerator); |
372 } | 372 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 528 |
529 // TODO(sky): this isn't right. To correctly implement need bounds of | 529 // TODO(sky): this isn't right. To correctly implement need bounds of |
530 // Display, which we aren't tracking yet. For now, use the first display. | 530 // Display, which we aren't tracking yet. For now, use the first display. |
531 Display* display = *(display_manager()->displays().begin()); | 531 Display* display = *(display_manager()->displays().begin()); |
532 WindowManagerDisplayRoot* display_root = | 532 WindowManagerDisplayRoot* display_root = |
533 display->GetWindowManagerDisplayRootForUser(user_id()); | 533 display->GetWindowManagerDisplayRootForUser(user_id()); |
534 return display_root ? display_root->root() : nullptr; | 534 return display_root ? display_root->root() : nullptr; |
535 } | 535 } |
536 | 536 |
537 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { | 537 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
538 window_server()->SendToEventObservers(event, user_id(), | 538 window_server()->SendToPointerWatchers(event, user_id(), |
539 nullptr /* ignore_tree */); | 539 nullptr /* ignore_tree */); |
540 } | 540 } |
541 | 541 |
542 } // namespace ws | 542 } // namespace ws |
543 } // namespace ui | 543 } // namespace ui |
OLD | NEW |