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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 return base::TimeDelta::FromMilliseconds(native_event->xkey.time); | 765 return base::TimeDelta::FromMilliseconds(native_event->xkey.time); |
766 case ButtonPress: | 766 case ButtonPress: |
767 case ButtonRelease: | 767 case ButtonRelease: |
768 return base::TimeDelta::FromMilliseconds(native_event->xbutton.time); | 768 return base::TimeDelta::FromMilliseconds(native_event->xbutton.time); |
769 break; | 769 break; |
770 case MotionNotify: | 770 case MotionNotify: |
771 return base::TimeDelta::FromMilliseconds(native_event->xmotion.time); | 771 return base::TimeDelta::FromMilliseconds(native_event->xmotion.time); |
772 break; | 772 break; |
773 case GenericEvent: { | 773 case GenericEvent: { |
774 double start, end; | 774 double start, end; |
| 775 float touch_timestamp; |
775 if (GetGestureTimes(native_event, &start, &end)) { | 776 if (GetGestureTimes(native_event, &start, &end)) { |
776 // If the driver supports gesture times, use them. | 777 // If the driver supports gesture times, use them. |
777 return base::TimeDelta::FromMicroseconds(end * 1000000); | 778 return base::TimeDelta::FromMicroseconds(end * 1000000); |
| 779 } else if (ValuatorTracker::GetInstance()->ExtractValuator(*native_event, |
| 780 ValuatorTracker::VAL_TOUCH_RAW_TIMESTAMP, &touch_timestamp)) { |
| 781 return base::TimeDelta::FromMicroseconds(touch_timestamp * 1000000); |
778 } else { | 782 } else { |
779 XIDeviceEvent* xide = | 783 XIDeviceEvent* xide = |
780 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 784 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
781 return base::TimeDelta::FromMilliseconds(xide->time); | 785 return base::TimeDelta::FromMilliseconds(xide->time); |
782 } | 786 } |
783 break; | 787 break; |
784 } | 788 } |
785 } | 789 } |
786 NOTREACHED(); | 790 NOTREACHED(); |
787 return base::TimeDelta(); | 791 return base::TimeDelta(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 noop->xclient.format = 8; | 1034 noop->xclient.format = 8; |
1031 DCHECK(!noop->xclient.display); | 1035 DCHECK(!noop->xclient.display); |
1032 } | 1036 } |
1033 // Make sure we use atom from current xdisplay, which may | 1037 // Make sure we use atom from current xdisplay, which may |
1034 // change during the test. | 1038 // change during the test. |
1035 noop->xclient.message_type = GetNoopEventAtom(); | 1039 noop->xclient.message_type = GetNoopEventAtom(); |
1036 return noop; | 1040 return noop; |
1037 } | 1041 } |
1038 | 1042 |
1039 } // namespace ui | 1043 } // namespace ui |
OLD | NEW |