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

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

Issue 2753163004: Remove ID from ui::PointerEvent's constructors (Closed)
Patch Set: Created 3 years, 9 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // Down going to up is handled by ProcessLocatedEvent(). 458 // Down going to up is handled by ProcessLocatedEvent().
459 if (pointer_target.is_pointer_down) 459 if (pointer_target.is_pointer_down)
460 pointer_targets_[pointer_id].is_pointer_down = true; 460 pointer_targets_[pointer_id].is_pointer_down = true;
461 return; 461 return;
462 } 462 }
463 463
464 // The targets are changing. Send an exit if appropriate. 464 // The targets are changing. Send an exit if appropriate.
465 if (event.IsMousePointerEvent()) { 465 if (event.IsMousePointerEvent()) {
466 ui::PointerEvent exit_event( 466 ui::PointerEvent exit_event(
467 ui::ET_POINTER_EXITED, event.location(), event.root_location(), 467 ui::ET_POINTER_EXITED, event.location(), event.root_location(),
468 event.flags(), ui::PointerEvent::kMousePointerId, 468 event.flags(), 0 /* changed_button_flags */,
469 0 /* changed_button_flags */, 469 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
470 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE), 470 ui::PointerEvent::kMousePointerId),
471 event.time_stamp()); 471 event.time_stamp());
472 DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event); 472 DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event);
473 } 473 }
474 474
475 // Technically we're updating in place, but calling start then stop makes for 475 // Technically we're updating in place, but calling start then stop makes for
476 // simpler code. 476 // simpler code.
477 StopTrackingPointer(pointer_id); 477 StopTrackingPointer(pointer_id);
478 StartTrackingPointer(pointer_id, pointer_target); 478 StartTrackingPointer(pointer_id, pointer_target);
479 } 479 }
480 480
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 611
612 ui::EventType event_type = pair.second.is_mouse_event 612 ui::EventType event_type = pair.second.is_mouse_event
613 ? ui::ET_POINTER_EXITED 613 ? ui::ET_POINTER_EXITED
614 : ui::ET_POINTER_CANCELLED; 614 : ui::ET_POINTER_CANCELLED;
615 ui::EventPointerType pointer_type = 615 ui::EventPointerType pointer_type =
616 pair.second.is_mouse_event ? ui::EventPointerType::POINTER_TYPE_MOUSE 616 pair.second.is_mouse_event ? ui::EventPointerType::POINTER_TYPE_MOUSE
617 : ui::EventPointerType::POINTER_TYPE_TOUCH; 617 : ui::EventPointerType::POINTER_TYPE_TOUCH;
618 // TODO(jonross): Track previous location in PointerTarget for sending 618 // TODO(jonross): Track previous location in PointerTarget for sending
619 // cancels. 619 // cancels.
620 ui::PointerEvent event(event_type, gfx::Point(), gfx::Point(), ui::EF_NONE, 620 ui::PointerEvent event(event_type, gfx::Point(), gfx::Point(), ui::EF_NONE,
621 pair.first, 0 /* changed_button_flags */, 621 0 /* changed_button_flags */,
622 ui::PointerDetails(pointer_type), 622 ui::PointerDetails(pointer_type, pair.first),
623 ui::EventTimeForNow()); 623 ui::EventTimeForNow());
624 DispatchToPointerTarget(pair.second, event); 624 DispatchToPointerTarget(pair.second, event);
625 } 625 }
626 pointer_targets_.clear(); 626 pointer_targets_.clear();
627 } 627 }
628 628
629 void EventDispatcher::OnWillChangeWindowHierarchy(ServerWindow* window, 629 void EventDispatcher::OnWillChangeWindowHierarchy(ServerWindow* window,
630 ServerWindow* new_parent, 630 ServerWindow* new_parent,
631 ServerWindow* old_parent) { 631 ServerWindow* old_parent) {
632 // TODO(sky): moving to a different root likely needs to transfer capture. 632 // TODO(sky): moving to a different root likely needs to transfer capture.
(...skipping 20 matching lines...) Expand all
653 if (mouse_cursor_source_window_ == window) 653 if (mouse_cursor_source_window_ == window)
654 SetMouseCursorSourceWindow(nullptr); 654 SetMouseCursorSourceWindow(nullptr);
655 } 655 }
656 656
657 void EventDispatcher::OnDragCursorUpdated() { 657 void EventDispatcher::OnDragCursorUpdated() {
658 delegate_->UpdateNativeCursorFromDispatcher(); 658 delegate_->UpdateNativeCursorFromDispatcher();
659 } 659 }
660 660
661 } // namespace ws 661 } // namespace ws
662 } // namespace ui 662 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/drag_controller_unittest.cc ('k') | services/ui/ws/window_manager_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698