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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 DVLOG(3) << base::StringPrintf("Gesture Move: (%f, %f) [%f, %f]", | 263 DVLOG(3) << base::StringPrintf("Gesture Move: (%f, %f) [%f, %f]", |
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( |
274 id_, cursor_->GetLocation(), StimeToTimedelta(gesture->end_time))); | 274 MouseMoveEventParams(id_, cursor_->GetLocation(), |
| 275 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), |
| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 DispatchMouseButton(BTN_FORWARD, down, time); | 415 DispatchMouseButton(BTN_FORWARD, down, time); |
414 } | 416 } |
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(MouseButtonEventParams( |
424 MouseButtonEventParams(id_, cursor_->GetLocation(), button, down, | 426 id_, cursor_->GetLocation(), button, down, allow_remap, |
425 allow_remap, StimeToTimedelta(time))); | 427 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), |
| 428 StimeToTimedelta(time))); |
426 } | 429 } |
427 | 430 |
428 void GestureInterpreterLibevdevCros::DispatchChangedKeys( | 431 void GestureInterpreterLibevdevCros::DispatchChangedKeys( |
429 unsigned long* new_key_state, | 432 unsigned long* new_key_state, |
430 stime_t timestamp) { | 433 stime_t timestamp) { |
431 unsigned long key_state_diff[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | 434 unsigned long key_state_diff[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
432 | 435 |
433 // Find changed keys. | 436 // Find changed keys. |
434 for (unsigned long i = 0; i < arraysize(key_state_diff); ++i) | 437 for (unsigned long i = 0; i < arraysize(key_state_diff); ++i) |
435 key_state_diff[i] = new_key_state[i] ^ prev_key_state_[i]; | 438 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 | 485 |
483 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { | 486 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { |
484 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); | 487 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); |
485 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); | 488 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); |
486 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); | 489 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); |
487 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); | 490 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); |
488 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); | 491 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); |
489 } | 492 } |
490 | 493 |
491 } // namespace ui | 494 } // namespace ui |
OLD | NEW |