OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devices/x11/device_data_manager_x11.h" | 5 #include "ui/events/devices/x11/device_data_manager_x11.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 return false; | 673 return false; |
674 } | 674 } |
675 | 675 |
676 bool DeviceDataManagerX11::GetDataRange(int deviceid, | 676 bool DeviceDataManagerX11::GetDataRange(int deviceid, |
677 const DataType type, | 677 const DataType type, |
678 double* min, | 678 double* min, |
679 double* max) { | 679 double* max) { |
680 CHECK_GE(deviceid, 0); | 680 CHECK_GE(deviceid, 0); |
681 if (deviceid >= kMaxDeviceNum) | 681 if (deviceid >= kMaxDeviceNum) |
682 return false; | 682 return false; |
| 683 if (valuator_lookup_[deviceid].empty()) |
| 684 return false; |
683 if (valuator_lookup_[deviceid][type] >= 0) { | 685 if (valuator_lookup_[deviceid][type] >= 0) { |
684 *min = valuator_min_[deviceid][type]; | 686 *min = valuator_min_[deviceid][type]; |
685 *max = valuator_max_[deviceid][type]; | 687 *max = valuator_max_[deviceid][type]; |
686 return true; | 688 return true; |
687 } | 689 } |
688 return false; | 690 return false; |
689 } | 691 } |
690 | 692 |
691 void DeviceDataManagerX11::SetDeviceListForTest( | 693 void DeviceDataManagerX11::SetDeviceListForTest( |
692 const std::vector<int>& touchscreen, | 694 const std::vector<int>& touchscreen, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } else { | 901 } else { |
900 keyboards.erase(it); | 902 keyboards.erase(it); |
901 ++blocked_iter; | 903 ++blocked_iter; |
902 } | 904 } |
903 } | 905 } |
904 // Notify base class of updated list. | 906 // Notify base class of updated list. |
905 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 907 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
906 } | 908 } |
907 | 909 |
908 } // namespace ui | 910 } // namespace ui |
OLD | NEW |