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

Side by Side Diff: ui/base/events/event.cc

Issue 12088015: Add ability for EventGenerator to generate Scroll events asynchronously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Free any leftover events in destructor Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/events/event.h ('k') | ui/views/widget/widget_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 (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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 bool is_cancel; 633 bool is_cancel;
634 GetFlingData(native_event, &x_offset_, &y_offset_, &is_cancel); 634 GetFlingData(native_event, &x_offset_, &y_offset_, &is_cancel);
635 } else { 635 } else {
636 NOTREACHED() << "Unexpected event type " << type() 636 NOTREACHED() << "Unexpected event type " << type()
637 << " when constructing a ScrollEvent."; 637 << " when constructing a ScrollEvent.";
638 } 638 }
639 } 639 }
640 640
641 ScrollEvent::ScrollEvent(EventType type, 641 ScrollEvent::ScrollEvent(EventType type,
642 const gfx::Point& location, 642 const gfx::Point& location,
643 base::TimeDelta time_stamp,
643 int flags, 644 int flags,
644 float x_offset, 645 float x_offset,
645 float y_offset) 646 float y_offset,
647 int finger_count)
646 : MouseEvent(type, location, location, flags), 648 : MouseEvent(type, location, location, flags),
647 x_offset_(x_offset), 649 x_offset_(x_offset),
648 y_offset_(y_offset) { 650 y_offset_(y_offset),
651 finger_count_(finger_count) {
652 set_time_stamp(time_stamp);
649 CHECK(IsScrollEvent()); 653 CHECK(IsScrollEvent());
650 } 654 }
651 655
652 void ScrollEvent::Scale(const float factor) { 656 void ScrollEvent::Scale(const float factor) {
653 x_offset_ *= factor; 657 x_offset_ *= factor;
654 y_offset_ *= factor; 658 y_offset_ *= factor;
655 } 659 }
656 660
657 //////////////////////////////////////////////////////////////////////////////// 661 ////////////////////////////////////////////////////////////////////////////////
658 // GestureEvent 662 // GestureEvent
659 663
660 GestureEvent::GestureEvent(EventType type, 664 GestureEvent::GestureEvent(EventType type,
661 int x, 665 int x,
662 int y, 666 int y,
663 int flags, 667 int flags,
664 base::TimeDelta time_stamp, 668 base::TimeDelta time_stamp,
665 const GestureEventDetails& details, 669 const GestureEventDetails& details,
666 unsigned int touch_ids_bitfield) 670 unsigned int touch_ids_bitfield)
667 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), time_stamp, flags), 671 : LocatedEvent(type,
672 gfx::Point(x, y),
673 gfx::Point(x, y),
674 time_stamp,
675 flags | EF_FROM_TOUCH),
668 details_(details), 676 details_(details),
669 touch_ids_bitfield_(touch_ids_bitfield) { 677 touch_ids_bitfield_(touch_ids_bitfield) {
670 } 678 }
671 679
672 GestureEvent::~GestureEvent() { 680 GestureEvent::~GestureEvent() {
673 } 681 }
674 682
675 int GestureEvent::GetLowestTouchId() const { 683 int GestureEvent::GetLowestTouchId() const {
676 if (touch_ids_bitfield_ == 0) 684 if (touch_ids_bitfield_ == 0)
677 return -1; 685 return -1;
678 int i = -1; 686 int i = -1;
679 // Find the index of the least significant 1 bit 687 // Find the index of the least significant 1 bit
680 while (!(1 << ++i & touch_ids_bitfield_)); 688 while (!(1 << ++i & touch_ids_bitfield_));
681 return i; 689 return i;
682 } 690 }
683 691
684 } // namespace ui 692 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698