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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 int flags) | 65 int flags) |
66 : type_(type), | 66 : type_(type), |
67 time_stamp_(EventTimeFromNative(native_event)), | 67 time_stamp_(EventTimeFromNative(native_event)), |
68 flags_(flags), | 68 flags_(flags), |
69 delete_native_event_(false) { | 69 delete_native_event_(false) { |
70 InitWithNativeEvent(native_event); | 70 InitWithNativeEvent(native_event); |
71 } | 71 } |
72 | 72 |
73 Event::Event(const Event& copy) | 73 Event::Event(const Event& copy) |
74 : native_event_(copy.native_event_), | 74 : native_event_(copy.native_event_), |
| 75 ui_native_event_(copy.ui_native_event_), |
75 type_(copy.type_), | 76 type_(copy.type_), |
76 time_stamp_(copy.time_stamp_), | 77 time_stamp_(copy.time_stamp_), |
77 flags_(copy.flags_), | 78 flags_(copy.flags_), |
78 delete_native_event_(false) { | 79 delete_native_event_(false) { |
79 } | 80 } |
80 | 81 |
81 void Event::Init() { | 82 void Event::Init() { |
82 std::memset(&native_event_, 0, sizeof(native_event_)); | 83 std::memset(&native_event_, 0, sizeof(native_event_)); |
| 84 std::memset(&ui_native_event_, 0, sizeof(ui_native_event_)); |
83 } | 85 } |
84 | 86 |
85 void Event::InitWithNativeEvent(const base::NativeEvent& native_event) { | 87 void Event::InitWithNativeEvent(const base::NativeEvent& native_event) { |
86 native_event_ = native_event; | 88 native_event_ = native_event; |
| 89 std::memset(&ui_native_event_, 0, sizeof(ui_native_event_)); |
87 } | 90 } |
88 | 91 |
89 LocatedEvent::~LocatedEvent() { | 92 LocatedEvent::~LocatedEvent() { |
90 } | 93 } |
91 | 94 |
92 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) | 95 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) |
93 : Event(native_event, | 96 : Event(native_event, |
94 EventTypeFromNative(native_event), | 97 EventTypeFromNative(native_event), |
95 EventFlagsFromNative(native_event)), | 98 EventFlagsFromNative(native_event)), |
96 location_(EventLocationFromNative(native_event)), | 99 location_(EventLocationFromNative(native_event)), |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 int GestureEvent::GetLowestTouchId() const { | 395 int GestureEvent::GetLowestTouchId() const { |
393 if (touch_ids_bitfield_ == 0) | 396 if (touch_ids_bitfield_ == 0) |
394 return -1; | 397 return -1; |
395 int i = -1; | 398 int i = -1; |
396 // Find the index of the least significant 1 bit | 399 // Find the index of the least significant 1 bit |
397 while (!(1 << ++i & touch_ids_bitfield_)); | 400 while (!(1 << ++i & touch_ids_bitfield_)); |
398 return i; | 401 return i; |
399 } | 402 } |
400 | 403 |
401 } // namespace ui | 404 } // namespace ui |
OLD | NEW |