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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 case XI_Motion: | 751 case XI_Motion: |
752 return GetButtonMaskForX2Event(xievent) | | 752 return GetButtonMaskForX2Event(xievent) | |
753 GetEventFlagsFromXState(xievent->mods.effective); | 753 GetEventFlagsFromXState(xievent->mods.effective); |
754 } | 754 } |
755 } | 755 } |
756 } | 756 } |
757 return 0; | 757 return 0; |
758 } | 758 } |
759 | 759 |
760 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { | 760 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { |
761 // Synthetic events don't have native events. | |
762 if (!native_event) | |
763 return base::TimeDelta(); | |
764 | |
765 switch(native_event->type) { | 761 switch(native_event->type) { |
766 case KeyPress: | 762 case KeyPress: |
767 case KeyRelease: | 763 case KeyRelease: |
768 return base::TimeDelta::FromMilliseconds(native_event->xkey.time); | 764 return base::TimeDelta::FromMilliseconds(native_event->xkey.time); |
769 case ButtonPress: | 765 case ButtonPress: |
770 case ButtonRelease: | 766 case ButtonRelease: |
771 return base::TimeDelta::FromMilliseconds(native_event->xbutton.time); | 767 return base::TimeDelta::FromMilliseconds(native_event->xbutton.time); |
772 break; | 768 break; |
773 case MotionNotify: | 769 case MotionNotify: |
774 return base::TimeDelta::FromMilliseconds(native_event->xmotion.time); | 770 return base::TimeDelta::FromMilliseconds(native_event->xmotion.time); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 noop->xclient.format = 8; | 1007 noop->xclient.format = 8; |
1012 DCHECK(!noop->xclient.display); | 1008 DCHECK(!noop->xclient.display); |
1013 } | 1009 } |
1014 // Make sure we use atom from current xdisplay, which may | 1010 // Make sure we use atom from current xdisplay, which may |
1015 // change during the test. | 1011 // change during the test. |
1016 noop->xclient.message_type = GetNoopEventAtom(); | 1012 noop->xclient.message_type = GetNoopEventAtom(); |
1017 return noop; | 1013 return noop; |
1018 } | 1014 } |
1019 | 1015 |
1020 } // namespace ui | 1016 } // namespace ui |
OLD | NEW |