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

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

Issue 10916210: events: Inlcude the event-phase and event-result in Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test 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
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 target_(NULL),
66 phase_(EP_NONE),
67 result_(ER_UNHANDLED) {
66 Init(); 68 Init();
67 } 69 }
68 70
69 Event::Event(const base::NativeEvent& native_event, 71 Event::Event(const base::NativeEvent& native_event,
70 EventType type, 72 EventType type,
71 int flags) 73 int flags)
72 : type_(type), 74 : type_(type),
73 time_stamp_(EventTimeFromNative(native_event)), 75 time_stamp_(EventTimeFromNative(native_event)),
74 flags_(flags), 76 flags_(flags),
75 delete_native_event_(false), 77 delete_native_event_(false),
76 target_(NULL) { 78 target_(NULL),
79 phase_(EP_NONE),
80 result_(ER_UNHANDLED) {
77 InitWithNativeEvent(native_event); 81 InitWithNativeEvent(native_event);
78 } 82 }
79 83
80 Event::Event(const Event& copy) 84 Event::Event(const Event& copy)
81 : native_event_(::CopyNativeEvent(copy.native_event_)), 85 : native_event_(::CopyNativeEvent(copy.native_event_)),
82 type_(copy.type_), 86 type_(copy.type_),
83 time_stamp_(copy.time_stamp_), 87 time_stamp_(copy.time_stamp_),
84 flags_(copy.flags_), 88 flags_(copy.flags_),
85 delete_native_event_(false), 89 delete_native_event_(false),
86 target_(NULL) { 90 target_(NULL),
91 phase_(EP_NONE),
92 result_(ER_UNHANDLED) {
87 #if defined(USE_X11) 93 #if defined(USE_X11)
88 if (native_event_) 94 if (native_event_)
89 delete_native_event_ = true; 95 delete_native_event_ = true;
90 #endif 96 #endif
91 } 97 }
92 98
93 void Event::Init() { 99 void Event::Init() {
94 std::memset(&native_event_, 0, sizeof(native_event_)); 100 std::memset(&native_event_, 0, sizeof(native_event_));
95 } 101 }
96 102
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 int GestureEvent::GetLowestTouchId() const { 498 int GestureEvent::GetLowestTouchId() const {
493 if (touch_ids_bitfield_ == 0) 499 if (touch_ids_bitfield_ == 0)
494 return -1; 500 return -1;
495 int i = -1; 501 int i = -1;
496 // Find the index of the least significant 1 bit 502 // Find the index of the least significant 1 bit
497 while (!(1 << ++i & touch_ids_bitfield_)); 503 while (!(1 << ++i & touch_ids_bitfield_));
498 return i; 504 return i;
499 } 505 }
500 506
501 } // namespace ui 507 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698