Chromium Code Reviews| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 return NULL; | 637 return NULL; |
| 638 XEvent* copy = new XEvent; | 638 XEvent* copy = new XEvent; |
| 639 *copy = *event; | 639 *copy = *event; |
| 640 return copy; | 640 return copy; |
| 641 } | 641 } |
| 642 | 642 |
| 643 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { | 643 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { |
| 644 delete event; | 644 delete event; |
| 645 } | 645 } |
| 646 | 646 |
| 647 void IncrementTouchIdRefCount(const base::NativeEvent& xev) { | |
| 648 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | |
| 649 double tracking_id; | |
| 650 if (!manager->GetEventData( | |
| 651 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { | |
| 652 return; | |
| 653 } | |
| 654 | |
| 655 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | |
| 656 factory->AcquireSlotForTrackingID(tracking_id); | |
|
sadrul
2014/07/22 16:49:16
Should we do this automagically from GetTouchId()
tdresser
2014/07/22 20:17:08
As we just discussed in person, I think there's a
| |
| 657 } | |
| 658 | |
| 647 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 659 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
| 648 ui::EventType type = ui::EventTypeFromNative(xev); | 660 ui::EventType type = ui::EventTypeFromNative(xev); |
| 649 if (type == ui::ET_TOUCH_CANCELLED || | 661 if (type == ui::ET_TOUCH_CANCELLED || |
| 650 type == ui::ET_TOUCH_RELEASED) { | 662 type == ui::ET_TOUCH_RELEASED) { |
| 651 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 663 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
| 652 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 664 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
| 653 double tracking_id; | 665 double tracking_id; |
| 654 if (manager->GetEventData( | 666 if (manager->GetEventData( |
| 655 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { | 667 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
| 656 factory->ReleaseSlotForTrackingID(tracking_id); | 668 factory->ReleaseSlotForTrackingID(tracking_id); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 787 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
| 776 native_event, start_time, end_time); | 788 native_event, start_time, end_time); |
| 777 return true; | 789 return true; |
| 778 } | 790 } |
| 779 | 791 |
| 780 bool IsTouchpadEvent(const base::NativeEvent& event) { | 792 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 781 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); | 793 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); |
| 782 } | 794 } |
| 783 | 795 |
| 784 } // namespace ui | 796 } // namespace ui |
| OLD | NEW |