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/base/events.h" | 5 #include "ui/base/events.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <X11/extensions/XInput.h> | 8 #include <X11/extensions/XInput.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) | 713 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) |
714 flags |= GetEventFlagsForButton(native_event->xbutton.button); | 714 flags |= GetEventFlagsForButton(native_event->xbutton.button); |
715 return flags; | 715 return flags; |
716 } | 716 } |
717 case MotionNotify: | 717 case MotionNotify: |
718 return GetEventFlagsFromXState(native_event->xmotion.state); | 718 return GetEventFlagsFromXState(native_event->xmotion.state); |
719 case GenericEvent: { | 719 case GenericEvent: { |
720 XIDeviceEvent* xievent = | 720 XIDeviceEvent* xievent = |
721 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 721 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
722 | 722 |
723 const bool touch = | |
724 TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid); | |
725 switch (xievent->evtype) { | 723 switch (xievent->evtype) { |
| 724 #if defined(USE_XI2_MT) |
| 725 case XI_TouchBegin: |
| 726 case XI_TouchUpdate: |
| 727 case XI_TouchEnd: |
| 728 return GetButtonMaskForX2Event(xievent) | |
| 729 GetEventFlagsFromXState(xievent->mods.effective) | |
| 730 GetEventFlagsFromXState( |
| 731 XModifierStateWatcher::GetInstance()->state()); |
| 732 break; |
| 733 #endif |
726 case XI_ButtonPress: | 734 case XI_ButtonPress: |
727 case XI_ButtonRelease: { | 735 case XI_ButtonRelease: { |
| 736 const bool touch = |
| 737 TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid); |
728 int flags = GetButtonMaskForX2Event(xievent) | | 738 int flags = GetButtonMaskForX2Event(xievent) | |
729 GetEventFlagsFromXState(xievent->mods.effective); | 739 GetEventFlagsFromXState(xievent->mods.effective); |
730 if (touch) { | 740 if (touch) { |
731 flags |= GetEventFlagsFromXState( | 741 flags |= GetEventFlagsFromXState( |
732 XModifierStateWatcher::GetInstance()->state()); | 742 XModifierStateWatcher::GetInstance()->state()); |
733 } | 743 } |
734 | 744 |
735 const EventType type = EventTypeFromNative(native_event); | 745 const EventType type = EventTypeFromNative(native_event); |
736 int button = EventButtonFromNative(native_event); | 746 int button = EventButtonFromNative(native_event); |
737 if ((type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) && !touch) | 747 if ((type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) && !touch) |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 noop->xclient.format = 8; | 984 noop->xclient.format = 8; |
975 DCHECK(!noop->xclient.display); | 985 DCHECK(!noop->xclient.display); |
976 } | 986 } |
977 // Make sure we use atom from current xdisplay, which may | 987 // Make sure we use atom from current xdisplay, which may |
978 // change during the test. | 988 // change during the test. |
979 noop->xclient.message_type = GetNoopEventAtom(); | 989 noop->xclient.message_type = GetNoopEventAtom(); |
980 return noop; | 990 return noop; |
981 } | 991 } |
982 | 992 |
983 } // namespace ui | 993 } // namespace ui |
OLD | NEW |