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/events/event.h" | 5 #include "ui/base/events/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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 const gfx::Point& location, | 608 const gfx::Point& location, |
609 int flags, | 609 int flags, |
610 float x_offset, | 610 float x_offset, |
611 float y_offset) | 611 float y_offset) |
612 : MouseEvent(type, location, location, flags), | 612 : MouseEvent(type, location, location, flags), |
613 x_offset_(x_offset), | 613 x_offset_(x_offset), |
614 y_offset_(y_offset) { | 614 y_offset_(y_offset) { |
615 CHECK(IsScrollEvent()); | 615 CHECK(IsScrollEvent()); |
616 } | 616 } |
617 | 617 |
| 618 void ScrollEvent::Scale(const float factor) { |
| 619 x_offset_ *= factor; |
| 620 y_offset_ *= factor; |
| 621 } |
| 622 |
618 //////////////////////////////////////////////////////////////////////////////// | 623 //////////////////////////////////////////////////////////////////////////////// |
619 // GestureEvent | 624 // GestureEvent |
620 | 625 |
621 GestureEvent::GestureEvent(EventType type, | 626 GestureEvent::GestureEvent(EventType type, |
622 int x, | 627 int x, |
623 int y, | 628 int y, |
624 int flags, | 629 int flags, |
625 base::TimeDelta time_stamp, | 630 base::TimeDelta time_stamp, |
626 const GestureEventDetails& details, | 631 const GestureEventDetails& details, |
627 unsigned int touch_ids_bitfield) | 632 unsigned int touch_ids_bitfield) |
628 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), time_stamp, flags), | 633 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), time_stamp, flags), |
629 details_(details), | 634 details_(details), |
630 touch_ids_bitfield_(touch_ids_bitfield) { | 635 touch_ids_bitfield_(touch_ids_bitfield) { |
631 } | 636 } |
632 | 637 |
633 GestureEvent::~GestureEvent() { | 638 GestureEvent::~GestureEvent() { |
634 } | 639 } |
635 | 640 |
636 int GestureEvent::GetLowestTouchId() const { | 641 int GestureEvent::GetLowestTouchId() const { |
637 if (touch_ids_bitfield_ == 0) | 642 if (touch_ids_bitfield_ == 0) |
638 return -1; | 643 return -1; |
639 int i = -1; | 644 int i = -1; |
640 // Find the index of the least significant 1 bit | 645 // Find the index of the least significant 1 bit |
641 while (!(1 << ++i & touch_ids_bitfield_)); | 646 while (!(1 << ++i & touch_ids_bitfield_)); |
642 return i; | 647 return i; |
643 } | 648 } |
644 | 649 |
645 } // namespace ui | 650 } // namespace ui |
OLD | NEW |