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

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

Issue 10908127: events: Move EventTarget into Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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/base/events/event_dispatcher.h » ('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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool Event::HasNativeEvent() const { 54 bool Event::HasNativeEvent() const {
55 base::NativeEvent null_event; 55 base::NativeEvent null_event;
56 std::memset(&null_event, 0, sizeof(null_event)); 56 std::memset(&null_event, 0, sizeof(null_event));
57 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event)); 57 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event));
58 } 58 }
59 59
60 Event::Event(EventType type, int flags) 60 Event::Event(EventType type, int flags)
61 : type_(type), 61 : type_(type),
62 time_stamp_(base::Time::NowFromSystemTime() - base::Time()), 62 time_stamp_(base::Time::NowFromSystemTime() - base::Time()),
63 flags_(flags), 63 flags_(flags),
64 delete_native_event_(false) { 64 delete_native_event_(false),
65 target_(NULL) {
65 Init(); 66 Init();
66 } 67 }
67 68
68 Event::Event(const base::NativeEvent& native_event, 69 Event::Event(const base::NativeEvent& native_event,
69 EventType type, 70 EventType type,
70 int flags) 71 int flags)
71 : type_(type), 72 : type_(type),
72 time_stamp_(EventTimeFromNative(native_event)), 73 time_stamp_(EventTimeFromNative(native_event)),
73 flags_(flags), 74 flags_(flags),
74 delete_native_event_(false) { 75 delete_native_event_(false),
76 target_(NULL) {
75 InitWithNativeEvent(native_event); 77 InitWithNativeEvent(native_event);
76 } 78 }
77 79
78 Event::Event(const Event& copy) 80 Event::Event(const Event& copy)
79 : native_event_(::CopyNativeEvent(copy.native_event_)), 81 : native_event_(::CopyNativeEvent(copy.native_event_)),
80 type_(copy.type_), 82 type_(copy.type_),
81 time_stamp_(copy.time_stamp_), 83 time_stamp_(copy.time_stamp_),
82 flags_(copy.flags_), 84 flags_(copy.flags_),
83 delete_native_event_(false) { 85 delete_native_event_(false),
86 target_(NULL) {
84 #if defined(USE_X11) 87 #if defined(USE_X11)
85 if (native_event_) 88 if (native_event_)
86 delete_native_event_ = true; 89 delete_native_event_ = true;
87 #endif 90 #endif
88 } 91 }
89 92
90 void Event::Init() { 93 void Event::Init() {
91 std::memset(&native_event_, 0, sizeof(native_event_)); 94 std::memset(&native_event_, 0, sizeof(native_event_));
92 } 95 }
93 96
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 int GestureEvent::GetLowestTouchId() const { 492 int GestureEvent::GetLowestTouchId() const {
490 if (touch_ids_bitfield_ == 0) 493 if (touch_ids_bitfield_ == 0)
491 return -1; 494 return -1;
492 int i = -1; 495 int i = -1;
493 // Find the index of the least significant 1 bit 496 // Find the index of the least significant 1 bit
494 while (!(1 << ++i & touch_ids_bitfield_)); 497 while (!(1 << ++i & touch_ids_bitfield_));
495 return i; 498 return i;
496 } 499 }
497 500
498 } // namespace ui 501 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event.h ('k') | ui/base/events/event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698