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 <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/XKBlib.h> | 10 #include <X11/XKBlib.h> |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 return NULL; | 732 return NULL; |
733 XEvent* copy = new XEvent; | 733 XEvent* copy = new XEvent; |
734 *copy = *event; | 734 *copy = *event; |
735 return copy; | 735 return copy; |
736 } | 736 } |
737 | 737 |
738 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { | 738 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { |
739 delete event; | 739 delete event; |
740 } | 740 } |
741 | 741 |
742 void IncrementTouchIdRefCount(const base::NativeEvent& xev) { | |
743 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | |
744 double tracking_id; | |
745 if (!manager->GetEventData( | |
746 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { | |
747 return; | |
748 } | |
749 | |
750 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | |
751 factory->AcquireSlotForTrackingID(tracking_id); | |
752 } | |
753 | |
754 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 742 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
755 ui::EventType type = ui::EventTypeFromNative(xev); | 743 ui::EventType type = ui::EventTypeFromNative(xev); |
756 if (type == ui::ET_TOUCH_CANCELLED || | 744 if (type == ui::ET_TOUCH_CANCELLED || |
757 type == ui::ET_TOUCH_RELEASED) { | 745 type == ui::ET_TOUCH_RELEASED) { |
758 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 746 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
759 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 747 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
760 double tracking_id; | 748 double tracking_id; |
761 if (manager->GetEventData( | 749 if (manager->GetEventData( |
762 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { | 750 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
763 factory->ReleaseSlotForTrackingID(tracking_id); | 751 factory->ReleaseSlotForTrackingID(tracking_id); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 xievent->detail = | 902 xievent->detail = |
915 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); | 903 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); |
916 break; | 904 break; |
917 } | 905 } |
918 default: | 906 default: |
919 break; | 907 break; |
920 } | 908 } |
921 } | 909 } |
922 | 910 |
923 } // namespace ui | 911 } // namespace ui |
OLD | NEW |