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_constants.h" | 5 #include "ui/events/event_constants.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 523 } |
524 | 524 |
525 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 525 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
526 return KeyboardCodeFromXKeyEvent(native_event); | 526 return KeyboardCodeFromXKeyEvent(native_event); |
527 } | 527 } |
528 | 528 |
529 const char* CodeFromNative(const base::NativeEvent& native_event) { | 529 const char* CodeFromNative(const base::NativeEvent& native_event) { |
530 return CodeFromXEvent(native_event); | 530 return CodeFromXEvent(native_event); |
531 } | 531 } |
532 | 532 |
| 533 uint32 PlatformCodeFromNative(const base::NativeEvent& native_event) { |
| 534 KeySym keysym; |
| 535 XLookupString(&native_event->xkey, NULL, 0, &keysym, NULL); |
| 536 return keysym; |
| 537 } |
| 538 |
533 int GetChangedMouseButtonFlagsFromNative( | 539 int GetChangedMouseButtonFlagsFromNative( |
534 const base::NativeEvent& native_event) { | 540 const base::NativeEvent& native_event) { |
535 switch (native_event->type) { | 541 switch (native_event->type) { |
536 case ButtonPress: | 542 case ButtonPress: |
537 case ButtonRelease: | 543 case ButtonRelease: |
538 return GetEventFlagsFromXState(native_event->xbutton.state); | 544 return GetEventFlagsFromXState(native_event->xbutton.state); |
539 case GenericEvent: { | 545 case GenericEvent: { |
540 XIDeviceEvent* xievent = | 546 XIDeviceEvent* xievent = |
541 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 547 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
542 switch (xievent->evtype) { | 548 switch (xievent->evtype) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 DeviceDataManager::GetInstance()->GetGestureTimes( | 727 DeviceDataManager::GetInstance()->GetGestureTimes( |
722 native_event, start_time, end_time); | 728 native_event, start_time, end_time); |
723 return true; | 729 return true; |
724 } | 730 } |
725 | 731 |
726 bool IsTouchpadEvent(const base::NativeEvent& event) { | 732 bool IsTouchpadEvent(const base::NativeEvent& event) { |
727 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 733 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
728 } | 734 } |
729 | 735 |
730 } // namespace ui | 736 } // namespace ui |
OLD | NEW |