Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: ui/events/devices/x11/device_data_manager_x11.cc

Issue 1792623003: Changed DeviceDataManagerX11 to use xinput1 for low resolution scroll devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed code comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 valuator_min_[deviceid][data_type] = valuator_class_info->min; 764 valuator_min_[deviceid][data_type] = valuator_class_info->min;
765 valuator_max_[deviceid][data_type] = valuator_class_info->max; 765 valuator_max_[deviceid][data_type] = valuator_class_info->max;
766 return IsCMTDataType(data_type); 766 return IsCMTDataType(data_type);
767 } 767 }
768 768
769 void DeviceDataManagerX11::UpdateScrollClassDevice( 769 void DeviceDataManagerX11::UpdateScrollClassDevice(
770 XIScrollClassInfo* scroll_class_info, 770 XIScrollClassInfo* scroll_class_info,
771 int deviceid) { 771 int deviceid) {
772 DCHECK(deviceid >= 0 && deviceid < kMaxDeviceNum); 772 DCHECK(deviceid >= 0 && deviceid < kMaxDeviceNum);
773 ScrollInfo& info = scroll_data_[deviceid]; 773 ScrollInfo& info = scroll_data_[deviceid];
774
775 bool legacy_scroll_available =
776 (scroll_class_info->flags & XIScrollFlagNoEmulation) == 0;
777 // If the device's highest resolution is lower than the resolution of xinput1
778 // then use xinput1's events instead (ie. don't configure smooth scrolling).
779 if (legacy_scroll_available &&
780 std::abs(scroll_class_info->increment) <= 1.0) {
781 return;
782 }
783
774 switch (scroll_class_info->scroll_type) { 784 switch (scroll_class_info->scroll_type) {
775 case XIScrollTypeVertical: 785 case XIScrollTypeVertical:
776 info.vertical.number = scroll_class_info->number; 786 info.vertical.number = scroll_class_info->number;
777 info.vertical.increment = scroll_class_info->increment; 787 info.vertical.increment = scroll_class_info->increment;
778 info.vertical.position = 0; 788 info.vertical.position = 0;
779 info.vertical.seen = false; 789 info.vertical.seen = false;
780 break; 790 break;
781 case XIScrollTypeHorizontal: 791 case XIScrollTypeHorizontal:
782 info.horizontal.number = scroll_class_info->number; 792 info.horizontal.number = scroll_class_info->number;
783 info.horizontal.increment = scroll_class_info->increment; 793 info.horizontal.increment = scroll_class_info->increment;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } else { 881 } else {
872 keyboards.erase(it); 882 keyboards.erase(it);
873 ++blocked_iter; 883 ++blocked_iter;
874 } 884 }
875 } 885 }
876 // Notify base class of updated list. 886 // Notify base class of updated list.
877 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); 887 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
878 } 888 }
879 889
880 } // namespace ui 890 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698