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/events/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #endif | 10 #endif |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 namespace ui { | 109 namespace ui { |
110 | 110 |
111 //////////////////////////////////////////////////////////////////////////////// | 111 //////////////////////////////////////////////////////////////////////////////// |
112 // Event | 112 // Event |
113 | 113 |
114 Event::~Event() { | 114 Event::~Event() { |
115 if (delete_native_event_) | 115 if (delete_native_event_) |
116 ReleaseCopiedNativeEvent(native_event_); | 116 ReleaseCopiedNativeEvent(native_event_); |
117 } | 117 } |
118 | 118 |
| 119 GestureEvent* Event::AsGestureEvent() { |
| 120 CHECK(IsGestureEvent()); |
| 121 return static_cast<GestureEvent*>(this); |
| 122 } |
| 123 |
| 124 const GestureEvent* Event::AsGestureEvent() const { |
| 125 CHECK(IsGestureEvent()); |
| 126 return static_cast<const GestureEvent*>(this); |
| 127 } |
| 128 |
119 bool Event::HasNativeEvent() const { | 129 bool Event::HasNativeEvent() const { |
120 base::NativeEvent null_event; | 130 base::NativeEvent null_event; |
121 std::memset(&null_event, 0, sizeof(null_event)); | 131 std::memset(&null_event, 0, sizeof(null_event)); |
122 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event)); | 132 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event)); |
123 } | 133 } |
124 | 134 |
125 void Event::StopPropagation() { | 135 void Event::StopPropagation() { |
126 // TODO(sad): Re-enable these checks once View uses dispatcher to dispatch | 136 // TODO(sad): Re-enable these checks once View uses dispatcher to dispatch |
127 // events. | 137 // events. |
128 // CHECK(phase_ != EP_PREDISPATCH && phase_ != EP_POSTDISPATCH); | 138 // CHECK(phase_ != EP_PREDISPATCH && phase_ != EP_POSTDISPATCH); |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 gfx::PointF(x, y), | 759 gfx::PointF(x, y), |
750 time_stamp, | 760 time_stamp, |
751 flags | EF_FROM_TOUCH), | 761 flags | EF_FROM_TOUCH), |
752 details_(details) { | 762 details_(details) { |
753 } | 763 } |
754 | 764 |
755 GestureEvent::~GestureEvent() { | 765 GestureEvent::~GestureEvent() { |
756 } | 766 } |
757 | 767 |
758 } // namespace ui | 768 } // namespace ui |
OLD | NEW |