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

Side by Side Diff: ui/android/view_client.cc

Issue 2708613002: Add EventForwarder for routing touch events (Closed)
Patch Set: unittests 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
« ui/android/view_client.h ('K') | « ui/android/view_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/android/view_client.h"
6
7 namespace ui {
8
9 MotionEventData::MotionEventData(float dip_scale,
10 jobject jevent,
11 long time_ms,
12 int android_action,
13 int pointer_count,
14 int history_size,
15 int action_index,
16 float pos_x_0,
17 float pos_y_0,
18 float pos_x_1,
19 float pos_y_1,
20 int pointer_id_0,
21 int pointer_id_1,
22 float touch_major_0,
23 float touch_major_1,
24 float touch_minor_0,
25 float touch_minor_1,
26 float orientation_0,
27 float orientation_1,
28 float tilt_0,
29 float tilt_1,
30 float raw_pos_x,
31 float raw_pos_y,
32 float pressure,
33 int android_tool_type_0,
34 int android_tool_type_1,
35 int android_action_button,
36 int android_button_state,
37 int android_meta_state,
38 bool is_touch_handle_event)
39 : dip_scale(dip_scale),
40 jevent(jevent),
41 time_ms(time_ms),
42 android_action(android_action),
43 pointer_count(pointer_count),
44 history_size(history_size),
45 action_index(action_index),
46 pos_x_0(pos_x_0),
47 pos_y_0(pos_y_0),
48 pos_x_1(pos_x_1),
49 pos_y_1(pos_y_1),
50 pointer_id_0(pointer_id_0),
51 pointer_id_1(pointer_id_1),
52 touch_major_0(touch_major_0),
53 touch_major_1(touch_major_1),
54 touch_minor_0(touch_minor_0),
55 touch_minor_1(touch_minor_1),
56 orientation_0(orientation_0),
57 orientation_1(orientation_1),
58 tilt_0(tilt_0),
59 tilt_1(tilt_1),
60 raw_pos_x(raw_pos_x),
61 raw_pos_y(raw_pos_y),
62 pressure(pressure),
63 android_tool_type_0(android_tool_type_0),
64 android_tool_type_1(android_tool_type_1),
65 android_action_button(android_action_button),
66 android_button_state(android_button_state),
67 android_meta_state(android_meta_state),
68 is_touch_handle_event(is_touch_handle_event) {}
69
70 MotionEventData::MotionEventData(const MotionEventData& other)
71 : dip_scale(other.dip_scale),
72 jevent(other.jevent),
73 time_ms(other.time_ms),
74 android_action(other.android_action),
75 pointer_count(other.pointer_count),
76 history_size(other.history_size),
77 action_index(other.action_index),
78 pos_x_0(other.pos_x_0),
79 pos_y_0(other.pos_y_0),
80 pos_x_1(other.pos_x_1),
81 pos_y_1(other.pos_y_1),
82 pointer_id_0(other.pointer_id_0),
83 pointer_id_1(other.pointer_id_1),
84 touch_major_0(other.touch_major_0),
85 touch_major_1(other.touch_major_1),
86 touch_minor_0(other.touch_minor_0),
87 touch_minor_1(other.touch_minor_1),
88 orientation_0(other.orientation_0),
89 orientation_1(other.orientation_1),
90 tilt_0(other.tilt_0),
91 tilt_1(other.tilt_1),
92 raw_pos_x(other.raw_pos_x),
93 raw_pos_y(other.raw_pos_y),
94 pressure(other.pressure),
95 android_tool_type_0(other.android_tool_type_0),
96 android_tool_type_1(other.android_tool_type_1),
97 android_action_button(other.android_action_button),
98 android_button_state(other.android_button_state),
99 android_meta_state(other.android_meta_state),
100 is_touch_handle_event(other.is_touch_handle_event) {}
101
102 MotionEventData MotionEventData::Offset(float delta_x, float delta_y) const {
103 return MotionEventData(
104 dip_scale, jevent, time_ms, android_action, pointer_count, history_size,
105 action_index, pos_x_0 + delta_x, pos_y_0 + delta_y, pos_x_1 + delta_x,
106 pos_y_1 + delta_y, pointer_id_0, pointer_id_1, touch_major_0,
107 touch_major_1, touch_minor_0, touch_minor_1, orientation_0, orientation_1,
108 tilt_0, tilt_1, raw_pos_x, raw_pos_y, pressure, android_tool_type_0,
109 android_tool_type_1, android_action_button, android_button_state,
110 android_meta_state, is_touch_handle_event);
111 }
112
113 // static
114 MotionEventData MotionEventData::ForTouch(float dip_scale,
115 jobject jevent,
116 long time,
117 int action,
118 int pointer_count,
119 int history_size,
120 int action_index,
121 float pos_x0,
122 float pos_y0,
123 float pos_x1,
124 float pos_y1,
125 int pointer_id_0,
126 int pointer_id_1,
127 float touch_major_0,
128 float touch_major_1,
129 float touch_minor_0,
130 float touch_minor_1,
131 float orientation_0,
132 float orientation_1,
133 float tilt_0,
134 float tilt_1,
135 float raw_pos_x,
136 float raw_pos_y,
137 int tool_type_0,
138 int tool_type_1,
139 int button_state,
140 int meta_state,
141 bool is_touch_handle_event) {
142 return MotionEventData(
143 dip_scale, jevent, time, action, pointer_count, history_size,
144 action_index, pos_x0, pos_y0, pos_x1, pos_y1, pointer_id_0, pointer_id_1,
145 touch_major_0, touch_major_1, touch_minor_0, touch_minor_1, orientation_0,
146 orientation_1, tilt_0, tilt_1, raw_pos_x, raw_pos_y, 0.f, tool_type_0,
147 tool_type_1, 0, button_state, meta_state, is_touch_handle_event);
148 }
149
150 MotionEventData MotionEventData::ForMouse(float dip_scale,
151 long time_ms,
152 int android_action,
153 float pos_x,
154 float pos_y,
155 int pointer_id,
156 float orientation,
157 float pressure,
158 float tilt,
159 int android_tool_type,
160 int android_action_button,
161 int android_button_state,
162 int android_meta_state) {
163 return MotionEventData(dip_scale, nullptr, time_ms, android_action, 0, 0, 0,
164 pos_x, pos_y, 0.f, 0.f, pointer_id, 0, 0.f, 0.f, 0.f,
165 0.f, orientation, 0.f, tilt, 0.f, 0.f, 0.f, pressure,
166 android_tool_type, 0, android_action_button,
167 android_button_state, android_meta_state, false);
168 }
169
170 bool ViewClient::OnTouchEvent(const MotionEventData& m) {
171 return false;
172 }
173
174 bool ViewClient::OnMouseEvent(const MotionEventData& m) {
175 return false;
176 }
177
178 } // namespace ui
OLDNEW
« ui/android/view_client.h ('K') | « ui/android/view_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698