OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/event.h" | 5 #include "ui/base/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } else if (type() == ET_SCROLL_FLING_START) { | 370 } else if (type() == ET_SCROLL_FLING_START) { |
371 bool is_cancel; | 371 bool is_cancel; |
372 GetFlingData(native_event, &x_offset_, &y_offset_, &is_cancel); | 372 GetFlingData(native_event, &x_offset_, &y_offset_, &is_cancel); |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 GestureEvent::GestureEvent(EventType type, | 376 GestureEvent::GestureEvent(EventType type, |
377 int x, | 377 int x, |
378 int y, | 378 int y, |
379 int flags, | 379 int flags, |
380 base::Time time_stamp, | 380 base::TimeDelta time_stamp, |
381 const GestureEventDetails& details, | 381 const GestureEventDetails& details, |
382 unsigned int touch_ids_bitfield) | 382 unsigned int touch_ids_bitfield) |
383 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), flags), | 383 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), flags), |
384 details_(details), | 384 details_(details), |
385 touch_ids_bitfield_(touch_ids_bitfield) { | 385 touch_ids_bitfield_(touch_ids_bitfield) { |
386 set_time_stamp(base::TimeDelta::FromSeconds(time_stamp.ToDoubleT())); | 386 set_time_stamp(time_stamp); |
387 } | 387 } |
388 | 388 |
389 GestureEvent::~GestureEvent() { | 389 GestureEvent::~GestureEvent() { |
390 } | 390 } |
391 | 391 |
392 int GestureEvent::GetLowestTouchId() const { | 392 int GestureEvent::GetLowestTouchId() const { |
393 if (touch_ids_bitfield_ == 0) | 393 if (touch_ids_bitfield_ == 0) |
394 return -1; | 394 return -1; |
395 int i = -1; | 395 int i = -1; |
396 // Find the index of the least significant 1 bit | 396 // Find the index of the least significant 1 bit |
397 while (!(1 << ++i & touch_ids_bitfield_)); | 397 while (!(1 << ++i & touch_ids_bitfield_)); |
398 return i; | 398 return i; |
399 } | 399 } |
400 | 400 |
401 } // namespace ui | 401 } // namespace ui |
OLD | NEW |