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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return NULL; | 668 return NULL; |
669 XEvent* copy = new XEvent; | 669 XEvent* copy = new XEvent; |
670 *copy = *event; | 670 *copy = *event; |
671 return copy; | 671 return copy; |
672 } | 672 } |
673 | 673 |
674 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { | 674 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { |
675 delete event; | 675 delete event; |
676 } | 676 } |
677 | 677 |
| 678 void IncrementTouchIdRefCount(const base::NativeEvent& xev) { |
| 679 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
| 680 double tracking_id; |
| 681 if (!manager->GetEventData( |
| 682 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
| 683 return; |
| 684 } |
| 685 |
| 686 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
| 687 factory->AcquireSlotForTrackingID(tracking_id); |
| 688 } |
| 689 |
678 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 690 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
679 ui::EventType type = ui::EventTypeFromNative(xev); | 691 ui::EventType type = ui::EventTypeFromNative(xev); |
680 if (type == ui::ET_TOUCH_CANCELLED || | 692 if (type == ui::ET_TOUCH_CANCELLED || |
681 type == ui::ET_TOUCH_RELEASED) { | 693 type == ui::ET_TOUCH_RELEASED) { |
682 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 694 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
683 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 695 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
684 double tracking_id; | 696 double tracking_id; |
685 if (manager->GetEventData( | 697 if (manager->GetEventData( |
686 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { | 698 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
687 factory->ReleaseSlotForTrackingID(tracking_id); | 699 factory->ReleaseSlotForTrackingID(tracking_id); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 start_time = &start_time_; | 814 start_time = &start_time_; |
803 if (!end_time) | 815 if (!end_time) |
804 end_time = &end_time_; | 816 end_time = &end_time_; |
805 | 817 |
806 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 818 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
807 native_event, start_time, end_time); | 819 native_event, start_time, end_time); |
808 return true; | 820 return true; |
809 } | 821 } |
810 | 822 |
811 } // namespace ui | 823 } // namespace ui |
OLD | NEW |