| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/platform/platform_event_builder.h" | 5 #include "ui/events/platform/platform_event_builder.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 #include <X11/keysym.h> | 10 #include <X11/keysym.h> |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 key_event->set_code(CodeFromNative(native_event)); | 237 key_event->set_code(CodeFromNative(native_event)); |
| 238 key_event->set_is_char(IsCharFromNative(native_event)); | 238 key_event->set_is_char(IsCharFromNative(native_event)); |
| 239 key_event->set_platform_keycode(PlatformKeycodeFromNative(native_event)); | 239 key_event->set_platform_keycode(PlatformKeycodeFromNative(native_event)); |
| 240 | 240 |
| 241 if (IsRepeated(native_event, *key_event)) | 241 if (IsRepeated(native_event, *key_event)) |
| 242 key_event->set_flags(key_event->flags() | ui::EF_IS_REPEAT); | 242 key_event->set_flags(key_event->flags() | ui::EF_IS_REPEAT); |
| 243 | 243 |
| 244 #if defined(USE_X11) | 244 #if defined(USE_X11) |
| 245 key_event->NormalizeFlags(); | 245 key_event->NormalizeFlags(); |
| 246 #endif | 246 #endif |
| 247 #if defined(OS_WIN) | |
| 248 // Only Windows has native character events. | |
| 249 if (key_event->is_char()) | |
| 250 key_event->set_character(native_event.wParam); | |
| 251 #endif | |
| 252 } | 247 } |
| 253 | 248 |
| 254 // static | 249 // static |
| 255 void PlatformEventBuilder::FillScrollEventFrom( | 250 void PlatformEventBuilder::FillScrollEventFrom( |
| 256 const base::NativeEvent& native_event, | 251 const base::NativeEvent& native_event, |
| 257 ScrollEvent* scroll_event) { | 252 ScrollEvent* scroll_event) { |
| 258 float x_offset = 0; | 253 float x_offset = 0; |
| 259 float y_offset = 0; | 254 float y_offset = 0; |
| 260 float x_offset_ordinal = 0; | 255 float x_offset_ordinal = 0; |
| 261 float y_offset_ordinal = 0; | 256 float y_offset_ordinal = 0; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 273 &y_offset_ordinal, NULL); | 268 &y_offset_ordinal, NULL); |
| 274 scroll_event->set_offset(x_offset, y_offset); | 269 scroll_event->set_offset(x_offset, y_offset); |
| 275 scroll_event->set_offset_ordinal(x_offset_ordinal, y_offset_ordinal); | 270 scroll_event->set_offset_ordinal(x_offset_ordinal, y_offset_ordinal); |
| 276 } else { | 271 } else { |
| 277 NOTREACHED() << "Unexpected event type " << scroll_event->type() | 272 NOTREACHED() << "Unexpected event type " << scroll_event->type() |
| 278 << " when constructing a ScrollEvent."; | 273 << " when constructing a ScrollEvent."; |
| 279 } | 274 } |
| 280 } | 275 } |
| 281 | 276 |
| 282 } // namespace ui | 277 } // namespace ui |
| OLD | NEW |