| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 #endif | 104 #endif |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace | 107 } // namespace |
| 108 | 108 |
| 109 namespace ui { | 109 namespace ui { |
| 110 | 110 |
| 111 //////////////////////////////////////////////////////////////////////////////// | 111 //////////////////////////////////////////////////////////////////////////////// |
| 112 // Event | 112 // Event |
| 113 | 113 |
| 114 // static |
| 115 scoped_ptr<Event> Event::Clone(const Event& event) { |
| 116 if (event.IsKeyEvent()) { |
| 117 return scoped_ptr<Event>(new KeyEvent(static_cast<const KeyEvent&>(event))); |
| 118 } |
| 119 |
| 120 if (event.IsMouseEvent()) { |
| 121 if (event.IsMouseWheelEvent()) { |
| 122 return scoped_ptr<Event>( |
| 123 new MouseWheelEvent(static_cast<const MouseWheelEvent&>(event))); |
| 124 } |
| 125 |
| 126 return scoped_ptr<Event>( |
| 127 new MouseEvent(static_cast<const MouseEvent&>(event))); |
| 128 } |
| 129 |
| 130 if (event.IsTouchEvent()) { |
| 131 return scoped_ptr<Event>( |
| 132 new TouchEvent(static_cast<const TouchEvent&>(event))); |
| 133 } |
| 134 |
| 135 if (event.IsGestureEvent()) { |
| 136 return scoped_ptr<Event>( |
| 137 new GestureEvent(static_cast<const GestureEvent&>(event))); |
| 138 } |
| 139 |
| 140 if (event.IsScrollEvent()) { |
| 141 return scoped_ptr<Event>( |
| 142 new ScrollEvent(static_cast<const ScrollEvent&>(event))); |
| 143 } |
| 144 |
| 145 return scoped_ptr<Event>(new Event(event)); |
| 146 } |
| 147 |
| 114 Event::~Event() { | 148 Event::~Event() { |
| 115 if (delete_native_event_) | 149 if (delete_native_event_) |
| 116 ReleaseCopiedNativeEvent(native_event_); | 150 ReleaseCopiedNativeEvent(native_event_); |
| 117 } | 151 } |
| 118 | 152 |
| 119 GestureEvent* Event::AsGestureEvent() { | 153 GestureEvent* Event::AsGestureEvent() { |
| 120 CHECK(IsGestureEvent()); | 154 CHECK(IsGestureEvent()); |
| 121 return static_cast<GestureEvent*>(this); | 155 return static_cast<GestureEvent*>(this); |
| 122 } | 156 } |
| 123 | 157 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 gfx::PointF(x, y), | 858 gfx::PointF(x, y), |
| 825 time_stamp, | 859 time_stamp, |
| 826 flags | EF_FROM_TOUCH), | 860 flags | EF_FROM_TOUCH), |
| 827 details_(details) { | 861 details_(details) { |
| 828 } | 862 } |
| 829 | 863 |
| 830 GestureEvent::~GestureEvent() { | 864 GestureEvent::~GestureEvent() { |
| 831 } | 865 } |
| 832 | 866 |
| 833 } // namespace ui | 867 } // namespace ui |
| OLD | NEW |