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

Side by Side Diff: ui/aura/env_input_state_controller.cc

Issue 2655303004: Add id properties to PointerEvent (Closed)
Patch Set: pointer id Created 3 years, 10 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 "ui/aura/env_input_state_controller.h" 5 #include "ui/aura/env_input_state_controller.h"
6 6
7 #include "ui/aura/client/screen_position_client.h" 7 #include "ui/aura/client/screen_position_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
(...skipping 18 matching lines...) Expand all
29 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED && 29 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED &&
30 !(event.flags() & ui::EF_IS_SYNTHESIZED)) { 30 !(event.flags() & ui::EF_IS_SYNTHESIZED)) {
31 SetLastMouseLocation(window, event.root_location()); 31 SetLastMouseLocation(window, event.root_location());
32 } 32 }
33 } 33 }
34 34
35 void EnvInputStateController::UpdateStateForTouchEvent( 35 void EnvInputStateController::UpdateStateForTouchEvent(
36 const ui::TouchEvent& event) { 36 const ui::TouchEvent& event) {
37 switch (event.type()) { 37 switch (event.type()) {
38 case ui::ET_TOUCH_PRESSED: 38 case ui::ET_TOUCH_PRESSED:
39 touch_ids_down_ |= (1 << event.touch_id()); 39 touch_ids_down_ |= (1 << event.pointer_details().id);
40 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); 40 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
41 break; 41 break;
42 42
43 // Handle ET_TOUCH_CANCELLED only if it has a native event. 43 // Handle ET_TOUCH_CANCELLED only if it has a native event.
44 case ui::ET_TOUCH_CANCELLED: 44 case ui::ET_TOUCH_CANCELLED:
45 if (!event.HasNativeEvent()) 45 if (!event.HasNativeEvent())
46 break; 46 break;
47 // fallthrough 47 // fallthrough
48 case ui::ET_TOUCH_RELEASED: 48 case ui::ET_TOUCH_RELEASED:
49 touch_ids_down_ = 49 touch_ids_down_ = (touch_ids_down_ | (1 << event.pointer_details().id)) ^
50 (touch_ids_down_ | (1 << event.touch_id())) ^ (1 << event.touch_id()); 50 (1 << event.pointer_details().id);
51 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); 51 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
52 break; 52 break;
53 53
54 case ui::ET_TOUCH_MOVED: 54 case ui::ET_TOUCH_MOVED:
55 break; 55 break;
56 56
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 break; 59 break;
60 } 60 }
61 } 61 }
62 62
63 void EnvInputStateController::SetLastMouseLocation( 63 void EnvInputStateController::SetLastMouseLocation(
64 const Window* root_window, 64 const Window* root_window,
65 const gfx::Point& location_in_root) const { 65 const gfx::Point& location_in_root) const {
66 client::ScreenPositionClient* client = 66 client::ScreenPositionClient* client =
67 client::GetScreenPositionClient(root_window); 67 client::GetScreenPositionClient(root_window);
68 if (client) { 68 if (client) {
69 gfx::Point location_in_screen = location_in_root; 69 gfx::Point location_in_screen = location_in_root;
70 client->ConvertPointToScreen(root_window, &location_in_screen); 70 client->ConvertPointToScreen(root_window, &location_in_screen);
71 Env::GetInstance()->set_last_mouse_location(location_in_screen); 71 Env::GetInstance()->set_last_mouse_location(location_in_screen);
72 } else { 72 } else {
73 Env::GetInstance()->set_last_mouse_location(location_in_root); 73 Env::GetInstance()->set_last_mouse_location(location_in_root);
74 } 74 }
75 } 75 }
76 76
77 } // namespace aura 77 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698