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

Side by Side Diff: ui/events/mojo/event_struct_traits.cc

Issue 2270143002: ui/events: Add changed_button_flags_ in ui::PointerEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 | « ui/events/mojo/event.mojom ('k') | ui/events/mojo/struct_traits_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 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/events/mojo/event_struct_traits.h" 5 #include "ui/events/mojo/event_struct_traits.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/events/keycodes/dom/keycode_converter.h" 9 #include "ui/events/keycodes/dom/keycode_converter.h"
10 #include "ui/events/mojo/event_constants.mojom.h" 10 #include "ui/events/mojo/event_constants.mojom.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const EventUniquePtr& event) { 160 const EventUniquePtr& event) {
161 if (!event->IsPointerEvent() && !event->IsMouseWheelEvent()) 161 if (!event->IsPointerEvent() && !event->IsMouseWheelEvent())
162 return nullptr; 162 return nullptr;
163 163
164 ui::mojom::PointerDataPtr pointer_data(ui::mojom::PointerData::New()); 164 ui::mojom::PointerDataPtr pointer_data(ui::mojom::PointerData::New());
165 165
166 const ui::PointerDetails* pointer_details = nullptr; 166 const ui::PointerDetails* pointer_details = nullptr;
167 if (event->IsPointerEvent()) { 167 if (event->IsPointerEvent()) {
168 const ui::PointerEvent* pointer_event = event->AsPointerEvent(); 168 const ui::PointerEvent* pointer_event = event->AsPointerEvent();
169 pointer_data->pointer_id = pointer_event->pointer_id(); 169 pointer_data->pointer_id = pointer_event->pointer_id();
170 pointer_data->changed_button_flags = pointer_event->changed_button_flags();
170 pointer_details = &pointer_event->pointer_details(); 171 pointer_details = &pointer_event->pointer_details();
171 } else { 172 } else {
172 const ui::MouseWheelEvent* wheel_event = event->AsMouseWheelEvent(); 173 const ui::MouseWheelEvent* wheel_event = event->AsMouseWheelEvent();
173 pointer_data->pointer_id = ui::PointerEvent::kMousePointerId; 174 pointer_data->pointer_id = ui::PointerEvent::kMousePointerId;
174 pointer_details = &wheel_event->pointer_details(); 175 pointer_details = &wheel_event->pointer_details();
175 } 176 }
176 177
177 switch (pointer_details->pointer_type) { 178 switch (pointer_details->pointer_type) {
178 case ui::EventPointerType::POINTER_TYPE_MOUSE: 179 case ui::EventPointerType::POINTER_TYPE_MOUSE:
179 pointer_data->kind = ui::mojom::PointerKind::MOUSE; 180 pointer_data->kind = ui::mojom::PointerKind::MOUSE;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 gfx::Vector2d( 281 gfx::Vector2d(
281 static_cast<int>(pointer_data->wheel_data->delta_x), 282 static_cast<int>(pointer_data->wheel_data->delta_x),
282 static_cast<int>(pointer_data->wheel_data->delta_y)), 283 static_cast<int>(pointer_data->wheel_data->delta_y)),
283 location, screen_location, ui::EventTimeForNow(), 284 location, screen_location, ui::EventTimeForNow(),
284 ui::EventFlags(event.flags()), ui::EventFlags(event.flags()))); 285 ui::EventFlags(event.flags()), ui::EventFlags(event.flags())));
285 return true; 286 return true;
286 } 287 }
287 out->reset(new ui::PointerEvent( 288 out->reset(new ui::PointerEvent(
288 MojoPointerEventTypeToUIEvent(event.action()), location, 289 MojoPointerEventTypeToUIEvent(event.action()), location,
289 screen_location, event.flags(), ui::PointerEvent::kMousePointerId, 290 screen_location, event.flags(), ui::PointerEvent::kMousePointerId,
291 pointer_data->changed_button_flags,
290 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE), 292 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE),
291 ui::EventTimeForNow())); 293 ui::EventTimeForNow()));
292 return true; 294 return true;
293 } 295 }
294 case ui::mojom::PointerKind::TOUCH: { 296 case ui::mojom::PointerKind::TOUCH: {
295 out->reset(new ui::PointerEvent( 297 out->reset(new ui::PointerEvent(
296 MojoPointerEventTypeToUIEvent(event.action()), location, 298 MojoPointerEventTypeToUIEvent(event.action()), location,
297 screen_location, event.flags(), pointer_data->pointer_id, 299 screen_location, event.flags(), pointer_data->pointer_id,
300 pointer_data->changed_button_flags,
298 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 301 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
299 pointer_data->brush_data->width, 302 pointer_data->brush_data->width,
300 pointer_data->brush_data->height, 303 pointer_data->brush_data->height,
301 pointer_data->brush_data->pressure, 304 pointer_data->brush_data->pressure,
302 pointer_data->brush_data->tilt_x, 305 pointer_data->brush_data->tilt_x,
303 pointer_data->brush_data->tilt_y), 306 pointer_data->brush_data->tilt_y),
304 ui::EventTimeForNow())); 307 ui::EventTimeForNow()));
305 return true; 308 return true;
306 } 309 }
307 case ui::mojom::PointerKind::PEN: 310 case ui::mojom::PointerKind::PEN:
308 NOTIMPLEMENTED(); 311 NOTIMPLEMENTED();
309 return false; 312 return false;
310 } 313 }
311 } 314 }
312 case ui::mojom::EventType::UNKNOWN: 315 case ui::mojom::EventType::UNKNOWN:
313 return false; 316 return false;
314 } 317 }
315 318
316 return false; 319 return false;
317 } 320 }
318 321
319 } // namespace mojo 322 } // namespace mojo
OLDNEW
« no previous file with comments | « ui/events/mojo/event.mojom ('k') | ui/events/mojo/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698