Chromium Code Reviews| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 valuator_min_[deviceid][data_type] = valuator_class_info->min; | 766 valuator_min_[deviceid][data_type] = valuator_class_info->min; |
| 767 valuator_max_[deviceid][data_type] = valuator_class_info->max; | 767 valuator_max_[deviceid][data_type] = valuator_class_info->max; |
| 768 return IsCMTDataType(data_type); | 768 return IsCMTDataType(data_type); |
| 769 } | 769 } |
| 770 | 770 |
| 771 void DeviceDataManagerX11::UpdateScrollClassDevice( | 771 void DeviceDataManagerX11::UpdateScrollClassDevice( |
| 772 XIScrollClassInfo* scroll_class_info, | 772 XIScrollClassInfo* scroll_class_info, |
| 773 int deviceid) { | 773 int deviceid) { |
| 774 DCHECK(deviceid >= 0 && deviceid < kMaxDeviceNum); | 774 DCHECK(deviceid >= 0 && deviceid < kMaxDeviceNum); |
| 775 ScrollInfo& info = scroll_data_[deviceid]; | 775 ScrollInfo& info = scroll_data_[deviceid]; |
| 776 | |
| 777 if ((scroll_class_info->flags & XIScrollFlagNoEmulation) == 0 && | |
| 778 (scroll_class_info->increment == 0.0 || | |
| 779 scroll_class_info->increment == 1.0 || | |
| 780 scroll_class_info->increment == -1.0)) { | |
| 781 return; | |
| 782 } | |
|
sadrul
2016/04/19 14:40:50
Add a comment here. The code could be more readabl
| |
| 783 | |
| 776 switch (scroll_class_info->scroll_type) { | 784 switch (scroll_class_info->scroll_type) { |
| 777 case XIScrollTypeVertical: | 785 case XIScrollTypeVertical: |
| 778 info.vertical.number = scroll_class_info->number; | 786 info.vertical.number = scroll_class_info->number; |
| 779 info.vertical.increment = scroll_class_info->increment; | 787 info.vertical.increment = scroll_class_info->increment; |
| 780 info.vertical.position = 0; | 788 info.vertical.position = 0; |
| 781 info.vertical.seen = false; | 789 info.vertical.seen = false; |
| 782 break; | 790 break; |
| 783 case XIScrollTypeHorizontal: | 791 case XIScrollTypeHorizontal: |
| 784 info.horizontal.number = scroll_class_info->number; | 792 info.horizontal.number = scroll_class_info->number; |
| 785 info.horizontal.increment = scroll_class_info->increment; | 793 info.horizontal.increment = scroll_class_info->increment; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 } else { | 882 } else { |
| 875 keyboards.erase(it); | 883 keyboards.erase(it); |
| 876 ++blocked_iter; | 884 ++blocked_iter; |
| 877 } | 885 } |
| 878 } | 886 } |
| 879 // Notify base class of updated list. | 887 // Notify base class of updated list. |
| 880 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 888 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
| 881 } | 889 } |
| 882 | 890 |
| 883 } // namespace ui | 891 } // namespace ui |
| OLD | NEW |