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

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

Issue 2884463002: Make event-targeting asynchronous in window server. (Closed)
Patch Set: comments Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/event_dispatcher.h" 5 #include "services/ui/ws/event_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 while (!pointer_targets_.empty()) 76 while (!pointer_targets_.empty())
77 StopTrackingPointer(pointer_targets_.begin()->first); 77 StopTrackingPointer(pointer_targets_.begin()->first);
78 78
79 mouse_button_down_ = false; 79 mouse_button_down_ = false;
80 } 80 }
81 81
82 void EventDispatcher::SetMousePointerDisplayLocation( 82 void EventDispatcher::SetMousePointerDisplayLocation(
83 const gfx::Point& display_location, 83 const gfx::Point& display_location,
84 const int64_t display_id) { 84 const int64_t display_id) {
85 DCHECK(pointer_targets_.empty()); 85 DCHECK(pointer_targets_.empty());
86 mouse_pointer_last_location_ = display_location; 86 UpdateMousePointerLocation(display_location, display_id);
87 mouse_pointer_display_id_ = display_id;
88 UpdateCursorProviderByLastKnownLocation(); 87 UpdateCursorProviderByLastKnownLocation();
89 // Write our initial location back to our shared screen coordinate. This 88 // Write our initial location back to our shared screen coordinate. This
90 // shouldn't cause problems because we already read the cursor before we 89 // shouldn't cause problems because we already read the cursor before we
91 // process any events in views during window construction. 90 // process any events in views during window construction.
92 delegate_->OnMouseCursorLocationChanged(display_location, display_id); 91 delegate_->OnMouseCursorLocationChanged(display_location, display_id);
93 } 92 }
94 93
95 ui::CursorData EventDispatcher::GetCurrentMouseCursor() const { 94 ui::CursorData EventDispatcher::GetCurrentMouseCursor() const {
96 if (drag_controller_) 95 if (drag_controller_)
97 return drag_controller_->current_cursor(); 96 return drag_controller_->current_cursor();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const ClientSpecificId target_client_id = delegate_->GetEventTargetClientId( 216 const ClientSpecificId target_client_id = delegate_->GetEventTargetClientId(
218 mouse_cursor_source_window_, mouse_cursor_in_non_client_area_); 217 mouse_cursor_source_window_, mouse_cursor_in_non_client_area_);
219 const ServerWindow* window = mouse_cursor_source_window_; 218 const ServerWindow* window = mouse_cursor_source_window_;
220 while (window && window->id().client_id == target_client_id) 219 while (window && window->id().client_id == target_client_id)
221 window = window->parent(); 220 window = window->parent();
222 return window; 221 return window;
223 } 222 }
224 223
225 void EventDispatcher::UpdateNonClientAreaForCurrentWindow() { 224 void EventDispatcher::UpdateNonClientAreaForCurrentWindow() {
226 if (mouse_cursor_source_window_) { 225 if (mouse_cursor_source_window_) {
227 DeepestWindow deepest_window = 226 event_targeter_->FindDeepestVisibleWindowForEvents(
228 event_targeter_->FindDeepestVisibleWindowForEvents( 227 mouse_pointer_last_location_, mouse_pointer_display_id_,
229 &mouse_pointer_last_location_, &mouse_pointer_display_id_); 228 base::BindOnce(
230 if (deepest_window.window == mouse_cursor_source_window_) { 229 &EventDispatcher::UpdateNonClientAreaForCurrentWindowOnFoundWindow,
231 mouse_cursor_in_non_client_area_ = mouse_cursor_source_window_ 230 base::Unretained(this)));
232 ? deepest_window.in_non_client_area
233 : false;
234 }
235 } 231 }
236 } 232 }
237 233
238 void EventDispatcher::UpdateCursorProviderByLastKnownLocation() { 234 void EventDispatcher::UpdateCursorProviderByLastKnownLocation() {
239 if (!mouse_button_down_) { 235 if (!mouse_button_down_) {
240 DeepestWindow deepest_window = 236 event_targeter_->FindDeepestVisibleWindowForEvents(
241 event_targeter_->FindDeepestVisibleWindowForEvents( 237 mouse_pointer_last_location_, mouse_pointer_display_id_,
242 &mouse_pointer_last_location_, &mouse_pointer_display_id_); 238 base::BindOnce(&EventDispatcher::
243 SetMouseCursorSourceWindow(deepest_window.window); 239 UpdateCursorProviderByLastKnownLocationOnFoundWindow,
244 if (mouse_cursor_source_window_) { 240 base::Unretained(this)));
245 mouse_cursor_in_non_client_area_ = deepest_window.in_non_client_area;
246 } else {
247 SetMouseCursorSourceWindow(delegate_->GetRootWindowContaining(
248 &mouse_pointer_last_location_, &mouse_pointer_display_id_));
249 mouse_cursor_in_non_client_area_ = true;
250 }
251 } 241 }
252 } 242 }
253 243
254 bool EventDispatcher::AddAccelerator(uint32_t id, 244 bool EventDispatcher::AddAccelerator(uint32_t id,
255 mojom::EventMatcherPtr event_matcher) { 245 mojom::EventMatcherPtr event_matcher) {
256 std::unique_ptr<Accelerator> accelerator(new Accelerator(id, *event_matcher)); 246 std::unique_ptr<Accelerator> accelerator(new Accelerator(id, *event_matcher));
257 // If an accelerator with the same id or matcher already exists, then abort. 247 // If an accelerator with the same id or matcher already exists, then abort.
258 for (const auto& pair : accelerators_) { 248 for (const auto& pair : accelerators_) {
259 if (pair.first == id) { 249 if (pair.first == id) {
260 DVLOG(1) << "duplicate accelerator. Accelerator id=" << accelerator->id() 250 DVLOG(1) << "duplicate accelerator. Accelerator id=" << accelerator->id()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 pre_target->id(), event_display_id_, event, 296 pre_target->id(), event_display_id_, event,
307 EventDispatcherDelegate::AcceleratorPhase::PRE); 297 EventDispatcherDelegate::AcceleratorPhase::PRE);
308 return; 298 return;
309 } 299 }
310 } 300 }
311 ProcessKeyEvent(*key_event, match_phase); 301 ProcessKeyEvent(*key_event, match_phase);
312 return; 302 return;
313 } 303 }
314 304
315 DCHECK(event.IsPointerEvent()); 305 DCHECK(event.IsPointerEvent());
316 ProcessPointerEvent(*event.AsPointerEvent()); 306 event_targeter_->PointerTargetForEvent(
317 return; 307 *event.AsPointerEvent(), event_display_id_,
308 base::BindOnce(&EventDispatcher::ProcessPointerEventOnFoundTarget,
309 base::Unretained(this), *event.AsPointerEvent()));
318 } 310 }
319 311
320 void EventDispatcher::SetMouseCursorSourceWindow(ServerWindow* window) { 312 void EventDispatcher::SetMouseCursorSourceWindow(ServerWindow* window) {
321 if (mouse_cursor_source_window_ == window) 313 if (mouse_cursor_source_window_ == window)
322 return; 314 return;
323 315
324 if (mouse_cursor_source_window_) 316 if (mouse_cursor_source_window_)
325 UnobserveWindow(mouse_cursor_source_window_); 317 UnobserveWindow(mouse_cursor_source_window_);
326 mouse_cursor_source_window_ = window; 318 mouse_cursor_source_window_ = window;
327 if (mouse_cursor_source_window_) 319 if (mouse_cursor_source_window_)
328 ObserveWindow(mouse_cursor_source_window_); 320 ObserveWindow(mouse_cursor_source_window_);
329 } 321 }
330 322
323 void EventDispatcher::UpdateMousePointerLocation(
324 const gfx::Point& new_mouse_location,
325 const int64_t new_mouse_display_id) {
326 mouse_pointer_last_location_ = new_mouse_location;
327 mouse_pointer_display_id_ = new_mouse_display_id;
328 }
329
331 void EventDispatcher::ProcessKeyEvent(const ui::KeyEvent& event, 330 void EventDispatcher::ProcessKeyEvent(const ui::KeyEvent& event,
332 AcceleratorMatchPhase match_phase) { 331 AcceleratorMatchPhase match_phase) {
333 Accelerator* post_target = 332 Accelerator* post_target =
334 FindAccelerator(event, ui::mojom::AcceleratorPhase::POST_TARGET); 333 FindAccelerator(event, ui::mojom::AcceleratorPhase::POST_TARGET);
335 if (drag_controller_ && event.type() == ui::ET_KEY_PRESSED && 334 if (drag_controller_ && event.type() == ui::ET_KEY_PRESSED &&
336 event.key_code() == ui::VKEY_ESCAPE) { 335 event.key_code() == ui::VKEY_ESCAPE) {
337 drag_controller_->Cancel(); 336 drag_controller_->Cancel();
338 return; 337 return;
339 } 338 }
340 ServerWindow* focused_window = 339 ServerWindow* focused_window =
341 delegate_->GetFocusedWindowForEventDispatcher(event_display_id_); 340 delegate_->GetFocusedWindowForEventDispatcher(event_display_id_);
342 if (focused_window) { 341 if (focused_window) {
343 // Assume key events are for the client area. 342 // Assume key events are for the client area.
344 const bool in_nonclient_area = false; 343 const bool in_nonclient_area = false;
345 const ClientSpecificId client_id = 344 const ClientSpecificId client_id =
346 delegate_->GetEventTargetClientId(focused_window, in_nonclient_area); 345 delegate_->GetEventTargetClientId(focused_window, in_nonclient_area);
347 delegate_->DispatchInputEventToWindow( 346 delegate_->DispatchInputEventToWindow(
348 focused_window, client_id, event_display_id_, event, post_target); 347 focused_window, client_id, event_display_id_, event, post_target);
349 return; 348 return;
350 } 349 }
351 delegate_->OnEventTargetNotFound(event, event_display_id_); 350 delegate_->OnEventTargetNotFound(event, event_display_id_);
352 if (post_target) 351 if (post_target)
353 delegate_->OnAccelerator(post_target->id(), event_display_id_, event, 352 delegate_->OnAccelerator(post_target->id(), event_display_id_, event,
354 EventDispatcherDelegate::AcceleratorPhase::POST); 353 EventDispatcherDelegate::AcceleratorPhase::POST);
355 } 354 }
356 355
357 void EventDispatcher::ProcessPointerEvent(const ui::PointerEvent& event) { 356 void EventDispatcher::ProcessPointerEventOnFoundTarget(
358 DCHECK(event.IsPointerEvent()); 357 const ui::PointerEvent& event,
358 const PointerTarget& pointer_target_found,
359 const DeepestWindow& deepest_window,
360 const gfx::Point& location_in_display,
361 const int64_t display_id) {
362 event_targeter_->ProcessNextHittesetRequestFromQueue();
363
364 std::unique_ptr<ui::Event> cloned_event = ui::Event::Clone(event);
365 if (display_id != event_display_id_) {
366 event_display_id_ = display_id;
367 cloned_event->AsLocatedEvent()->set_root_location(location_in_display);
368 }
369
359 const bool is_mouse_event = event.IsMousePointerEvent(); 370 const bool is_mouse_event = event.IsMousePointerEvent();
360 371
361 if (is_mouse_event) { 372 if (is_mouse_event) {
362 mouse_pointer_last_location_ = event.root_location(); 373 UpdateMousePointerLocation(location_in_display, display_id);
363 mouse_pointer_display_id_ = event_display_id_; 374 delegate_->OnMouseCursorLocationChanged(location_in_display, display_id);
364 delegate_->OnMouseCursorLocationChanged(event.root_location(),
365 event_display_id_);
366 } 375 }
367 376
368 // Release capture on pointer up. For mouse we only release if there are 377 // Release capture on pointer up. For mouse we only release if there are
369 // no buttons down. 378 // no buttons down.
370 const bool is_pointer_going_up = 379 const bool is_pointer_going_up =
371 (event.type() == ui::ET_POINTER_UP || 380 (event.type() == ui::ET_POINTER_UP ||
372 event.type() == ui::ET_POINTER_CANCELLED) && 381 event.type() == ui::ET_POINTER_CANCELLED) &&
373 (!is_mouse_event || IsOnlyOneMouseButtonDown(event.flags())); 382 (!is_mouse_event || IsOnlyOneMouseButtonDown(event.flags()));
374 383
375 // Update mouse down state upon events which change it. 384 // Update mouse down state upon events which change it.
376 if (is_mouse_event) { 385 if (is_mouse_event) {
377 if (event.type() == ui::ET_POINTER_DOWN) 386 if (event.type() == ui::ET_POINTER_DOWN)
378 mouse_button_down_ = true; 387 mouse_button_down_ = true;
379 else if (is_pointer_going_up) 388 else if (is_pointer_going_up)
380 mouse_button_down_ = false; 389 mouse_button_down_ = false;
381 } 390 }
382 391
383 if (drag_controller_) { 392 if (drag_controller_) {
384 const PointerTarget target = 393 if (drag_controller_->DispatchPointerEvent(*cloned_event->AsPointerEvent(),
385 event_targeter_->PointerTargetForEvent(event, &event_display_id_); 394 pointer_target_found.window))
386 if (drag_controller_->DispatchPointerEvent(event, target.window))
387 return; 395 return;
388 } 396 }
389 397
390 if (capture_window_) { 398 if (capture_window_) {
391 SetMouseCursorSourceWindow(capture_window_); 399 SetMouseCursorSourceWindow(capture_window_);
392 DispatchToClient(capture_window_, capture_window_client_id_, event); 400 DispatchToClient(capture_window_, capture_window_client_id_,
401 *cloned_event->AsPointerEvent());
393 return; 402 return;
394 } 403 }
395 404
396 const int32_t pointer_id = event.pointer_details().id; 405 const int32_t pointer_id = event.pointer_details().id;
397 if (!IsTrackingPointer(pointer_id) || 406 if (!IsTrackingPointer(pointer_id) ||
398 !pointer_targets_[pointer_id].is_pointer_down) { 407 !pointer_targets_[pointer_id].is_pointer_down) {
399 const bool any_pointers_down = AreAnyPointersDown(); 408 const bool any_pointers_down = AreAnyPointersDown();
400 UpdateTargetForPointer(pointer_id, event); 409 UpdateTargetForPointer(pointer_id, *cloned_event->AsPointerEvent(),
410 pointer_target_found);
401 if (is_mouse_event) 411 if (is_mouse_event)
402 SetMouseCursorSourceWindow(pointer_targets_[pointer_id].window); 412 SetMouseCursorSourceWindow(pointer_targets_[pointer_id].window);
403 413
404 PointerTarget& pointer_target = pointer_targets_[pointer_id]; 414 PointerTarget& pointer_target = pointer_targets_[pointer_id];
405 if (pointer_target.is_pointer_down) { 415 if (pointer_target.is_pointer_down) {
406 if (is_mouse_event) 416 if (is_mouse_event)
407 SetMouseCursorSourceWindow(pointer_target.window); 417 SetMouseCursorSourceWindow(pointer_target.window);
408 if (!any_pointers_down) { 418 if (!any_pointers_down) {
409 if (pointer_target.window) 419 if (pointer_target.window)
410 delegate_->SetFocusedWindowFromEventDispatcher(pointer_target.window); 420 delegate_->SetFocusedWindowFromEventDispatcher(pointer_target.window);
411 ServerWindow* capture_window = pointer_target.window; 421 ServerWindow* capture_window = pointer_target.window;
412 if (!capture_window) { 422 if (!capture_window) {
413 gfx::Point event_location = event.root_location(); 423 gfx::Point event_location =
424 cloned_event->AsPointerEvent()->root_location();
414 int64_t event_display_id = event_display_id_; 425 int64_t event_display_id = event_display_id_;
415 capture_window = delegate_->GetRootWindowContaining( 426 capture_window = delegate_->GetRootWindowContaining(
416 &event_location, &event_display_id); 427 &event_location, &event_display_id);
417 } 428 }
418 delegate_->SetNativeCapture(capture_window); 429 delegate_->SetNativeCapture(capture_window);
419 } 430 }
420 } 431 }
421 } 432 }
422 433
423 // When we release the mouse button, we want the cursor to be sourced from 434 // When we release the mouse button, we want the cursor to be sourced from
424 // the window under the mouse pointer, even though we're sending the button 435 // the window under the mouse pointer, even though we're sending the button
425 // up event to the window that had implicit capture. We have to set this 436 // up event to the window that had implicit capture. We have to set this
426 // before we perform dispatch because the Delegate is going to read this 437 // before we perform dispatch because the Delegate is going to read this
427 // information from us. 438 // information from us.
428 if (is_pointer_going_up && is_mouse_event) 439 if (is_pointer_going_up && is_mouse_event) {
429 UpdateCursorProviderByLastKnownLocation(); 440 UpdateCursorProviderByLastKnownLocationWithWindow(
441 deepest_window, location_in_display, display_id);
442 }
430 443
431 DispatchToPointerTarget(pointer_targets_[pointer_id], event); 444 DispatchToPointerTarget(pointer_targets_[pointer_id],
445 *cloned_event->AsPointerEvent());
432 446
433 if (is_pointer_going_up) { 447 if (is_pointer_going_up) {
434 if (is_mouse_event) 448 if (is_mouse_event)
435 pointer_targets_[pointer_id].is_pointer_down = false; 449 pointer_targets_[pointer_id].is_pointer_down = false;
436 else 450 else
437 StopTrackingPointer(pointer_id); 451 StopTrackingPointer(pointer_id);
438 if (!AreAnyPointersDown()) 452 if (!AreAnyPointersDown())
439 delegate_->ReleaseNativeCapture(); 453 delegate_->ReleaseNativeCapture();
440 } 454 }
441 } 455 }
442 456
457 void EventDispatcher::UpdateNonClientAreaForCurrentWindowOnFoundWindow(
458 const DeepestWindow& deepest_window,
459 const gfx::Point& location_in_display,
460 const int64_t display_id) {
461 event_targeter_->ProcessNextHittesetRequestFromQueue();
sky 2017/06/02 21:17:51 Because this code is now processed async, I think
sky 2017/06/02 21:17:51 Why does this code need to call back to event_targ
riajiang 2017/06/02 22:56:17 Yes! Done.
riajiang 2017/06/02 22:56:17 I was thinking ui::ws::FindDeepestVisibleWindowFor
462
463 if (deepest_window.window == mouse_cursor_source_window_) {
464 mouse_cursor_in_non_client_area_ =
465 mouse_cursor_source_window_ ? deepest_window.in_non_client_area : false;
466 }
467 UpdateMousePointerLocation(location_in_display, display_id);
468 delegate_->UpdateNativeCursorFromDispatcher();
469 }
470
471 void EventDispatcher::UpdateCursorProviderByLastKnownLocationOnFoundWindow(
472 const DeepestWindow& deepest_window,
473 const gfx::Point& location_in_display,
474 const int64_t display_id) {
475 event_targeter_->ProcessNextHittesetRequestFromQueue();
476 UpdateCursorProviderByLastKnownLocationWithWindow(
477 deepest_window, location_in_display, display_id);
478 }
479
480 void EventDispatcher::UpdateCursorProviderByLastKnownLocationWithWindow(
sky 2017/06/02 21:17:51 It's not clear what 'WithWindow' means here. Maybe
riajiang 2017/06/02 22:56:17 Since event_targeter_->ProcessNextHittesetRequestF
481 const DeepestWindow& deepest_window,
482 const gfx::Point& location_in_display,
483 const int64_t display_id) {
484 SetMouseCursorSourceWindow(deepest_window.window);
sky 2017/06/02 21:17:51 Similar comment here about early out if mouse_butt
riajiang 2017/06/02 22:56:16 Done.
485 if (mouse_cursor_source_window_) {
486 mouse_cursor_in_non_client_area_ = deepest_window.in_non_client_area;
487 } else {
488 SetMouseCursorSourceWindow(delegate_->GetRootWindowContaining(
489 &mouse_pointer_last_location_, &mouse_pointer_display_id_));
490 mouse_cursor_in_non_client_area_ = true;
491 }
492 UpdateMousePointerLocation(location_in_display, display_id);
493 delegate_->UpdateNativeCursorFromDispatcher();
494 }
495
443 void EventDispatcher::StartTrackingPointer( 496 void EventDispatcher::StartTrackingPointer(
444 int32_t pointer_id, 497 int32_t pointer_id,
445 const PointerTarget& pointer_target) { 498 const PointerTarget& pointer_target) {
446 DCHECK(!IsTrackingPointer(pointer_id)); 499 DCHECK(!IsTrackingPointer(pointer_id));
447 if (pointer_target.window) 500 if (pointer_target.window)
448 ObserveWindow(pointer_target.window); 501 ObserveWindow(pointer_target.window);
449 pointer_targets_[pointer_id] = pointer_target; 502 pointer_targets_[pointer_id] = pointer_target;
450 } 503 }
451 504
452 void EventDispatcher::StopTrackingPointer(int32_t pointer_id) { 505 void EventDispatcher::StopTrackingPointer(int32_t pointer_id) {
453 DCHECK(IsTrackingPointer(pointer_id)); 506 DCHECK(IsTrackingPointer(pointer_id));
454 ServerWindow* window = pointer_targets_[pointer_id].window; 507 ServerWindow* window = pointer_targets_[pointer_id].window;
455 pointer_targets_.erase(pointer_id); 508 pointer_targets_.erase(pointer_id);
456 if (window) 509 if (window)
457 UnobserveWindow(window); 510 UnobserveWindow(window);
458 } 511 }
459 512
460 void EventDispatcher::UpdateTargetForPointer(int32_t pointer_id, 513 void EventDispatcher::UpdateTargetForPointer(
461 const ui::LocatedEvent& event) { 514 int32_t pointer_id,
515 const ui::PointerEvent& event,
516 const PointerTarget& pointer_target_found) {
sky 2017/06/02 21:17:51 pointer_target_found -> pointer_target
riajiang 2017/06/02 22:56:16 Done.
462 if (!IsTrackingPointer(pointer_id)) { 517 if (!IsTrackingPointer(pointer_id)) {
463 StartTrackingPointer(pointer_id, event_targeter_->PointerTargetForEvent( 518 StartTrackingPointer(pointer_id, pointer_target_found);
464 event, &event_display_id_));
465 return; 519 return;
466 } 520 }
467 521
468 const PointerTarget pointer_target = 522 if (pointer_target_found.window == pointer_targets_[pointer_id].window &&
469 event_targeter_->PointerTargetForEvent(event, &event_display_id_); 523 pointer_target_found.in_nonclient_area ==
470 if (pointer_target.window == pointer_targets_[pointer_id].window &&
471 pointer_target.in_nonclient_area ==
472 pointer_targets_[pointer_id].in_nonclient_area) { 524 pointer_targets_[pointer_id].in_nonclient_area) {
473 // The targets are the same, only set the down state to true if necessary. 525 // The targets are the same, only set the down state to true if necessary.
474 // Down going to up is handled by ProcessLocatedEvent(). 526 // Down going to up is handled by ProcessLocatedEvent().
475 if (pointer_target.is_pointer_down) 527 if (pointer_target_found.is_pointer_down)
476 pointer_targets_[pointer_id].is_pointer_down = true; 528 pointer_targets_[pointer_id].is_pointer_down = true;
477 return; 529 return;
478 } 530 }
479 531
480 // The targets are changing. Send an exit if appropriate. 532 // The targets are changing. Send an exit if appropriate.
481 if (event.IsMousePointerEvent()) { 533 if (event.IsMousePointerEvent()) {
482 ui::PointerEvent exit_event( 534 ui::PointerEvent exit_event(
483 ui::ET_POINTER_EXITED, event.location(), event.root_location(), 535 ui::ET_POINTER_EXITED, event.location(), event.root_location(),
484 event.flags(), 0 /* changed_button_flags */, 536 event.flags(), 0 /* changed_button_flags */,
485 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, 537 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
486 ui::MouseEvent::kMousePointerId), 538 ui::MouseEvent::kMousePointerId),
487 event.time_stamp()); 539 event.time_stamp());
488 DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event); 540 DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event);
489 } 541 }
490 542
491 // Technically we're updating in place, but calling start then stop makes for 543 // Technically we're updating in place, but calling start then stop makes for
492 // simpler code. 544 // simpler code.
493 StopTrackingPointer(pointer_id); 545 StopTrackingPointer(pointer_id);
494 StartTrackingPointer(pointer_id, pointer_target); 546 StartTrackingPointer(pointer_id, pointer_target_found);
495 } 547 }
496 548
497 bool EventDispatcher::AreAnyPointersDown() const { 549 bool EventDispatcher::AreAnyPointersDown() const {
498 for (const auto& pair : pointer_targets_) { 550 for (const auto& pair : pointer_targets_) {
499 if (pair.second.is_pointer_down) 551 if (pair.second.is_pointer_down)
500 return true; 552 return true;
501 } 553 }
502 return false; 554 return false;
503 } 555 }
504 556
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (mouse_cursor_source_window_ == window) 697 if (mouse_cursor_source_window_ == window)
646 SetMouseCursorSourceWindow(nullptr); 698 SetMouseCursorSourceWindow(nullptr);
647 } 699 }
648 700
649 void EventDispatcher::OnDragCursorUpdated() { 701 void EventDispatcher::OnDragCursorUpdated() {
650 delegate_->UpdateNativeCursorFromDispatcher(); 702 delegate_->UpdateNativeCursorFromDispatcher();
651 } 703 }
652 704
653 } // namespace ws 705 } // namespace ws
654 } // namespace ui 706 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698