OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
6 | 6 |
7 #include <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 #include <linux/input.h> | 9 #include <linux/input.h> |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 move->dx, | 264 move->dx, |
265 move->dy, | 265 move->dy, |
266 move->ordinal_dx, | 266 move->ordinal_dx, |
267 move->ordinal_dy); | 267 move->ordinal_dy); |
268 if (!cursor_) | 268 if (!cursor_) |
269 return; // No cursor! | 269 return; // No cursor! |
270 | 270 |
271 cursor_->MoveCursor(gfx::Vector2dF(move->dx, move->dy)); | 271 cursor_->MoveCursor(gfx::Vector2dF(move->dx, move->dy)); |
272 // TODO(spang): Use move->ordinal_dx, move->ordinal_dy | 272 // TODO(spang): Use move->ordinal_dx, move->ordinal_dy |
273 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( | 273 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( |
274 id_, cursor_->GetLocation(), StimeToTimedelta(gesture->end_time))); | 274 id_, cursor_->GetLocation(), EventPointerType::POINTER_TYPE_MOUSE, |
| 275 /* force */ 0.0f, /* tilt_x */ 0.0f, /* tilt_y */ 0.0f, |
| 276 StimeToTimedelta(gesture->end_time))); |
275 } | 277 } |
276 | 278 |
277 void GestureInterpreterLibevdevCros::OnGestureScroll( | 279 void GestureInterpreterLibevdevCros::OnGestureScroll( |
278 const Gesture* gesture, | 280 const Gesture* gesture, |
279 const GestureScroll* scroll) { | 281 const GestureScroll* scroll) { |
280 DVLOG(3) << base::StringPrintf("Gesture Scroll: (%f, %f) [%f, %f]", | 282 DVLOG(3) << base::StringPrintf("Gesture Scroll: (%f, %f) [%f, %f]", |
281 scroll->dx, | 283 scroll->dx, |
282 scroll->dy, | 284 scroll->dy, |
283 scroll->ordinal_dx, | 285 scroll->ordinal_dx, |
284 scroll->ordinal_dy); | 286 scroll->ordinal_dy); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 417 |
416 void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int button, | 418 void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int button, |
417 bool down, | 419 bool down, |
418 stime_t time) { | 420 stime_t time) { |
419 if (!SetMouseButtonState(button, down)) | 421 if (!SetMouseButtonState(button, down)) |
420 return; // No change. | 422 return; // No change. |
421 | 423 |
422 bool allow_remap = is_mouse_; | 424 bool allow_remap = is_mouse_; |
423 dispatcher_->DispatchMouseButtonEvent( | 425 dispatcher_->DispatchMouseButtonEvent( |
424 MouseButtonEventParams(id_, cursor_->GetLocation(), button, down, | 426 MouseButtonEventParams(id_, cursor_->GetLocation(), button, down, |
425 allow_remap, StimeToTimedelta(time))); | 427 allow_remap, EventPointerType::POINTER_TYPE_MOUSE, |
| 428 /* force */ 0.0f, /* tilt_x */ 0.0f, |
| 429 /* tilt_y */ 0.0f, StimeToTimedelta(time))); |
426 } | 430 } |
427 | 431 |
428 void GestureInterpreterLibevdevCros::DispatchChangedKeys( | 432 void GestureInterpreterLibevdevCros::DispatchChangedKeys( |
429 unsigned long* new_key_state, | 433 unsigned long* new_key_state, |
430 stime_t timestamp) { | 434 stime_t timestamp) { |
431 unsigned long key_state_diff[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | 435 unsigned long key_state_diff[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
432 | 436 |
433 // Find changed keys. | 437 // Find changed keys. |
434 for (unsigned long i = 0; i < arraysize(key_state_diff); ++i) | 438 for (unsigned long i = 0; i < arraysize(key_state_diff); ++i) |
435 key_state_diff[i] = new_key_state[i] ^ prev_key_state_[i]; | 439 key_state_diff[i] = new_key_state[i] ^ prev_key_state_[i]; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 486 |
483 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { | 487 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { |
484 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); | 488 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); |
485 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); | 489 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); |
486 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); | 490 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); |
487 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); | 491 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); |
488 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); | 492 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); |
489 } | 493 } |
490 | 494 |
491 } // namespace ui | 495 } // namespace ui |
OLD | NEW |