Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Side by Side Diff: services/ui/ws/window_manager_state.cc

Issue 2183163002: mus: Change PointerWatcher to observe all pointer events, with moves optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ifs Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698