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

Side by Side Diff: components/mus/gesture_manager.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « components/mus/event_dispatcher.cc ('k') | components/mus/gesture_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/mus/gesture_manager.h" 5 #include "components/mus/gesture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "components/mus/gesture_manager_delegate.h" 9 #include "components/mus/gesture_manager_delegate.h"
10 #include "components/mus/public/cpp/keys.h" 10 #include "components/mus/public/cpp/keys.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // TODO(sky): I'm doing this until things are converted. Seems as though we 48 // TODO(sky): I'm doing this until things are converted. Seems as though we
49 // shouldn't do this long term. 49 // shouldn't do this long term.
50 if (result.empty()) 50 if (result.empty())
51 result.push_back(deepest); 51 result.push_back(deepest);
52 return result; 52 return result;
53 } 53 }
54 54
55 mojo::EventPtr CloneEventForView(const mojo::Event& event, 55 mojo::EventPtr CloneEventForView(const mojo::Event& event,
56 const ServerView* view) { 56 const ServerView* view) {
57 mojo::EventPtr result(event.Clone()); 57 mojo::EventPtr result(event.Clone());
58 const gfx::PointF location(event.pointer_data->location->x, 58 const gfx::PointF location(event.pointer_data->x, event.pointer_data->y);
59 event.pointer_data->location->y);
60 const gfx::PointF target_location( 59 const gfx::PointF target_location(
61 ConvertPointFBetweenViews(view->GetRoot(), view, location)); 60 ConvertPointFBetweenViews(view->GetRoot(), view, location));
62 result->pointer_data->location->x = target_location.x(); 61 result->pointer_data->x = target_location.x();
63 result->pointer_data->location->y = target_location.y(); 62 result->pointer_data->y = target_location.y();
64 return result.Pass(); 63 return result.Pass();
65 } 64 }
66 65
67 } // namespace 66 } // namespace
68 67
69 // GestureStateChange ---------------------------------------------------------- 68 // GestureStateChange ----------------------------------------------------------
70 69
71 GestureStateChange::GestureStateChange() 70 GestureStateChange::GestureStateChange()
72 : chosen_gesture(GestureManager::kInvalidGestureId) {} 71 : chosen_gesture(GestureManager::kInvalidGestureId) {}
73 72
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // Explicitly delete the pointers first as this may result in calling back to 531 // Explicitly delete the pointers first as this may result in calling back to
533 // us to cleanup and delete gestures. 532 // us to cleanup and delete gestures.
534 active_pointers_.clear(); 533 active_pointers_.clear();
535 } 534 }
536 535
537 bool GestureManager::ProcessEvent(const mojo::Event& event) { 536 bool GestureManager::ProcessEvent(const mojo::Event& event) {
538 if (!event.pointer_data) 537 if (!event.pointer_data)
539 return false; 538 return false;
540 539
541 ScheduledDeleteProcessor delete_processor(this); 540 ScheduledDeleteProcessor delete_processor(this);
542 const gfx::Point location(static_cast<int>(event.pointer_data->location->x), 541 const gfx::Point location(static_cast<int>(event.pointer_data->x),
543 static_cast<int>(event.pointer_data->location->y)); 542 static_cast<int>(event.pointer_data->y));
544 switch (event.action) { 543 switch (event.action) {
545 case mojo::EVENT_TYPE_POINTER_DOWN: { 544 case mojo::EVENT_TYPE_POINTER_DOWN: {
546 if (GetPointerById(event.pointer_data->pointer_id)) { 545 if (GetPointerById(event.pointer_data->pointer_id)) {
547 DVLOG(1) << "received more than one down for a pointer without a " 546 DVLOG(1) << "received more than one down for a pointer without a "
548 << "corresponding up, id=" << event.pointer_data->pointer_id; 547 << "corresponding up, id=" << event.pointer_data->pointer_id;
549 NOTREACHED(); 548 NOTREACHED();
550 return true; 549 return true;
551 } 550 }
552 551
553 const ServerView* deepest = FindDeepestVisibleView(root_view_, location); 552 const ServerView* deepest = FindDeepestVisibleView(root_view_, location);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 void GestureManager::ScheduleDelete(Pointer* pointer) { 686 void GestureManager::ScheduleDelete(Pointer* pointer) {
688 auto iter = 687 auto iter =
689 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); 688 std::find(active_pointers_.begin(), active_pointers_.end(), pointer);
690 if (iter != active_pointers_.end()) { 689 if (iter != active_pointers_.end()) {
691 active_pointers_.weak_erase(iter); 690 active_pointers_.weak_erase(iter);
692 pointers_to_delete_.push_back(pointer); 691 pointers_to_delete_.push_back(pointer);
693 } 692 }
694 } 693 }
695 694
696 } // namespace view_manager 695 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/mus/event_dispatcher.cc ('k') | components/mus/gesture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698