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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 int EventButtonFromNative(const base::NativeEvent& native_event) { | 529 int EventButtonFromNative(const base::NativeEvent& native_event) { |
530 CHECK_EQ(GenericEvent, native_event->type); | 530 CHECK_EQ(GenericEvent, native_event->type); |
531 XIDeviceEvent* xievent = | 531 XIDeviceEvent* xievent = |
532 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 532 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
533 int button = xievent->detail; | 533 int button = xievent->detail; |
534 | 534 |
535 return (xievent->sourceid == xievent->deviceid) ? | 535 return (xievent->sourceid == xievent->deviceid) ? |
536 DeviceDataManagerX11::GetInstance()->GetMappedButton(button) : button; | 536 DeviceDataManagerX11::GetInstance()->GetMappedButton(button) : button; |
537 } | 537 } |
538 | 538 |
| 539 gfx::AcceleratedWidget EventTargetFromNative( |
| 540 const base::NativeEvent& native_event) { |
| 541 return (native_event->type == GenericEvent) ? |
| 542 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->event : |
| 543 native_event->xany.window; |
| 544 } |
| 545 |
539 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 546 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
540 return KeyboardCodeFromXKeyEvent(native_event); | 547 return KeyboardCodeFromXKeyEvent(native_event); |
541 } | 548 } |
542 | 549 |
543 const char* CodeFromNative(const base::NativeEvent& native_event) { | 550 const char* CodeFromNative(const base::NativeEvent& native_event) { |
544 return CodeFromXEvent(native_event); | 551 return CodeFromXEvent(native_event); |
545 } | 552 } |
546 | 553 |
547 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { | 554 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { |
548 KeySym keysym; | 555 KeySym keysym; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 748 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
742 native_event, start_time, end_time); | 749 native_event, start_time, end_time); |
743 return true; | 750 return true; |
744 } | 751 } |
745 | 752 |
746 bool IsTouchpadEvent(const base::NativeEvent& event) { | 753 bool IsTouchpadEvent(const base::NativeEvent& event) { |
747 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); | 754 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); |
748 } | 755 } |
749 | 756 |
750 } // namespace ui | 757 } // namespace ui |
OLD | NEW |