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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 event_ack_timer_.Stop(); | 235 event_ack_timer_.Stop(); |
236 event_dispatch_phase_ = EventDispatchPhase::NONE; | 236 event_dispatch_phase_ = EventDispatchPhase::NONE; |
237 | 237 |
238 if (result == mojom::EventResult::UNHANDLED) { | 238 if (result == mojom::EventResult::UNHANDLED) { |
239 event_dispatcher_.ProcessEvent( | 239 event_dispatcher_.ProcessEvent( |
240 *event_awaiting_input_ack_, | 240 *event_awaiting_input_ack_, |
241 EventDispatcher::AcceleratorMatchPhase::POST_ONLY); | 241 EventDispatcher::AcceleratorMatchPhase::POST_ONLY); |
242 } else { | 242 } else { |
243 // We're not going to process the event any further, notify event observers. | 243 // We're not going to process the event any further, notify event observers. |
244 // We don't do this first to ensure we don't send an event twice to clients. | 244 // We don't do this first to ensure we don't send an event twice to clients. |
245 window_server()->SendToEventObservers(*event_awaiting_input_ack_, user_id(), | 245 window_server()->SendToPointerWatchers(*event_awaiting_input_ack_, |
246 nullptr); | 246 user_id(), nullptr); |
247 ProcessNextEventFromQueue(); | 247 ProcessNextEventFromQueue(); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 const WindowServer* WindowManagerState::window_server() const { | 251 const WindowServer* WindowManagerState::window_server() const { |
252 return window_tree_->window_server(); | 252 return window_tree_->window_server(); |
253 } | 253 } |
254 | 254 |
255 WindowServer* WindowManagerState::window_server() { | 255 WindowServer* WindowManagerState::window_server() { |
256 return window_tree_->window_server(); | 256 return window_tree_->window_server(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 WindowTree* tree = window_server()->GetTreeWithId(client_id); | 348 WindowTree* tree = window_server()->GetTreeWithId(client_id); |
349 | 349 |
350 ScheduleInputEventTimeout(tree); | 350 ScheduleInputEventTimeout(tree); |
351 | 351 |
352 if (accelerator) { | 352 if (accelerator) { |
353 event_awaiting_input_ack_ = ui::Event::Clone(event); | 353 event_awaiting_input_ack_ = ui::Event::Clone(event); |
354 post_target_accelerator_ = accelerator; | 354 post_target_accelerator_ = accelerator; |
355 } | 355 } |
356 | 356 |
357 // Ignore |tree| because it will receive the event via normal dispatch. | 357 // Ignore |tree| because it will receive the event via normal dispatch. |
358 window_server()->SendToEventObservers(event, user_id(), tree); | 358 window_server()->SendToPointerWatchers(event, user_id(), tree); |
359 | 359 |
360 tree->DispatchInputEvent(target, event); | 360 tree->DispatchInputEvent(target, event); |
361 } | 361 } |
362 | 362 |
363 void WindowManagerState::AddDebugAccelerators() { | 363 void WindowManagerState::AddDebugAccelerators() { |
364 // Always register the accelerators, even if they only work in debug, so that | 364 // Always register the accelerators, even if they only work in debug, so that |
365 // keyboard behavior is the same in release and debug builds. | 365 // keyboard behavior is the same in release and debug builds. |
366 mojom::EventMatcherPtr matcher = CreateKeyMatcher( | 366 mojom::EventMatcherPtr matcher = CreateKeyMatcher( |
367 ui::mojom::KeyboardCode::S, ui::mojom::kEventFlagControlDown | | 367 ui::mojom::KeyboardCode::S, ui::mojom::kEventFlagControlDown | |
368 ui::mojom::kEventFlagAltDown | | 368 ui::mojom::kEventFlagAltDown | |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 // TODO(sky): this isn't right. To correctly implement need bounds of | 521 // TODO(sky): this isn't right. To correctly implement need bounds of |
522 // Display, which we aren't tracking yet. For now, use the first display. | 522 // Display, which we aren't tracking yet. For now, use the first display. |
523 Display* display = *(display_manager()->displays().begin()); | 523 Display* display = *(display_manager()->displays().begin()); |
524 WindowManagerDisplayRoot* display_root = | 524 WindowManagerDisplayRoot* display_root = |
525 display->GetWindowManagerDisplayRootForUser(user_id()); | 525 display->GetWindowManagerDisplayRootForUser(user_id()); |
526 return display_root ? display_root->root() : nullptr; | 526 return display_root ? display_root->root() : nullptr; |
527 } | 527 } |
528 | 528 |
529 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { | 529 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
530 window_server()->SendToEventObservers(event, user_id(), | 530 window_server()->SendToPointerWatchers(event, user_id(), |
531 nullptr /* ignore_tree */); | 531 nullptr /* ignore_tree */); |
532 } | 532 } |
533 | 533 |
534 } // namespace ws | 534 } // namespace ws |
535 } // namespace ui | 535 } // namespace ui |
OLD | NEW |