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