Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / ozone / events_ozone.cc
blob57892532c32374e24be8d1b0f3d256ad92ce3516
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/events/event.h"
6 #include "ui/events/event_constants.h"
7 #include "ui/events/event_utils.h"
9 namespace ui {
11 void UpdateDeviceList() { NOTIMPLEMENTED(); }
13 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
14 const ui::Event* event = static_cast<const ui::Event*>(native_event);
15 return event->time_stamp();
18 int EventFlagsFromNative(const base::NativeEvent& native_event) {
19 const ui::Event* event = static_cast<const ui::Event*>(native_event);
20 return event->flags();
23 EventType EventTypeFromNative(const base::NativeEvent& native_event) {
24 const ui::Event* event = static_cast<const ui::Event*>(native_event);
25 return event->type();
28 gfx::Point EventSystemLocationFromNative(
29 const base::NativeEvent& native_event) {
30 const ui::LocatedEvent* e =
31 static_cast<const ui::LocatedEvent*>(native_event);
32 DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() ||
33 e->IsScrollEvent());
34 return e->location();
37 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
38 return EventSystemLocationFromNative(native_event);
41 int GetChangedMouseButtonFlagsFromNative(
42 const base::NativeEvent& native_event) {
43 const ui::MouseEvent* event =
44 static_cast<const ui::MouseEvent*>(native_event);
45 DCHECK(event->IsMouseEvent());
46 return event->changed_button_flags();
49 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
50 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
51 DCHECK(event->IsKeyEvent());
52 return event->key_code();
55 const char* CodeFromNative(const base::NativeEvent& native_event) {
56 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
57 DCHECK(event->IsKeyEvent());
58 return event->code().c_str();
61 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) {
62 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
63 DCHECK(event->IsKeyEvent());
64 return event->platform_keycode();
67 bool IsCharFromNative(const base::NativeEvent& native_event) {
68 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
69 DCHECK(event->IsKeyEvent());
70 return event->is_char();
73 uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) {
74 NOTIMPLEMENTED();
75 return 0;
78 uint16 TextFromNative(const base::NativeEvent& native_event) {
79 NOTIMPLEMENTED();
80 return 0;
83 uint16 UnmodifiedTextFromNative(const base::NativeEvent& native_event) {
84 NOTIMPLEMENTED();
85 return 0;
88 gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) {
89 const ui::MouseWheelEvent* event =
90 static_cast<const ui::MouseWheelEvent*>(native_event);
91 DCHECK(event->type() == ET_MOUSEWHEEL);
92 return event->offset();
95 base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
96 return NULL;
99 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) {
102 void IncrementTouchIdRefCount(const base::NativeEvent& event) {
105 void ClearTouchIdIfReleased(const base::NativeEvent& xev) {
108 int GetTouchId(const base::NativeEvent& native_event) {
109 const ui::TouchEvent* event =
110 static_cast<const ui::TouchEvent*>(native_event);
111 DCHECK(event->IsTouchEvent());
112 return event->touch_id();
115 float GetTouchRadiusX(const base::NativeEvent& native_event) {
116 const ui::TouchEvent* event =
117 static_cast<const ui::TouchEvent*>(native_event);
118 DCHECK(event->IsTouchEvent());
119 return event->radius_x();
122 float GetTouchRadiusY(const base::NativeEvent& native_event) {
123 const ui::TouchEvent* event =
124 static_cast<const ui::TouchEvent*>(native_event);
125 DCHECK(event->IsTouchEvent());
126 return event->radius_y();
129 float GetTouchAngle(const base::NativeEvent& native_event) {
130 const ui::TouchEvent* event =
131 static_cast<const ui::TouchEvent*>(native_event);
132 DCHECK(event->IsTouchEvent());
133 return event->rotation_angle();
136 float GetTouchForce(const base::NativeEvent& native_event) {
137 const ui::TouchEvent* event =
138 static_cast<const ui::TouchEvent*>(native_event);
139 DCHECK(event->IsTouchEvent());
140 return event->force();
143 bool GetScrollOffsets(const base::NativeEvent& native_event,
144 float* x_offset,
145 float* y_offset,
146 float* x_offset_ordinal,
147 float* y_offset_ordinal,
148 int* finger_count) {
149 NOTIMPLEMENTED();
150 return false;
153 bool GetFlingData(const base::NativeEvent& native_event,
154 float* vx,
155 float* vy,
156 float* vx_ordinal,
157 float* vy_ordinal,
158 bool* is_cancel) {
159 const ui::ScrollEvent* event =
160 static_cast<const ui::ScrollEvent*>(native_event);
161 DCHECK(event->IsScrollEvent());
162 if (vx)
163 *vx = event->x_offset();
164 if (vy)
165 *vy = event->y_offset();
166 if (vx_ordinal)
167 *vx_ordinal = event->x_offset_ordinal();
168 if (vy_ordinal)
169 *vy_ordinal = event->y_offset_ordinal();
170 if (is_cancel)
171 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL;
173 return true;
176 int GetModifiersFromKeyState() {
177 NOTIMPLEMENTED();
178 return 0;
181 } // namespace ui