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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 ScrollInfo::AxisInfo* axis, | 794 ScrollInfo::AxisInfo* axis, |
795 double valuator) const { | 795 double valuator) const { |
796 double offset = 0; | 796 double offset = 0; |
797 if (axis->seen) | 797 if (axis->seen) |
798 offset = axis->position - valuator; | 798 offset = axis->position - valuator; |
799 axis->seen = true; | 799 axis->seen = true; |
800 axis->position = valuator; | 800 axis->position = valuator; |
801 return offset / axis->increment; | 801 return offset / axis->increment; |
802 } | 802 } |
803 | 803 |
804 bool DeviceDataManagerX11::TouchEventNeedsCalibrate(int touch_device_id) const { | |
805 #if defined(OS_CHROMEOS) | |
806 if (!base::SysInfo::IsRunningOnChromeOS()) | |
807 return false; | |
808 | |
809 const std::vector<TouchscreenDevice>& touch_devices = | |
810 ui::DeviceDataManager::GetInstance()->touchscreen_devices(); | |
811 std::vector<TouchscreenDevice>::const_iterator it = FindDeviceWithId( | |
812 touch_devices.begin(), touch_devices.end(), touch_device_id); | |
813 return it != touch_devices.end() && it->type == INPUT_DEVICE_INTERNAL; | |
814 #endif // defined(OS_CHROMEOS) | |
815 return false; | |
816 } | |
817 | |
818 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( | 804 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( |
819 scoped_ptr<std::set<KeyboardCode> > excepted_keys) { | 805 scoped_ptr<std::set<KeyboardCode> > excepted_keys) { |
820 DCHECK(!excepted_keys.get() || | 806 DCHECK(!excepted_keys.get() || |
821 !blocked_keyboard_allowed_keys_.get()); | 807 !blocked_keyboard_allowed_keys_.get()); |
822 blocked_keyboard_allowed_keys_ = std::move(excepted_keys); | 808 blocked_keyboard_allowed_keys_ = std::move(excepted_keys); |
823 } | 809 } |
824 | 810 |
825 void DeviceDataManagerX11::DisableDevice(int deviceid) { | 811 void DeviceDataManagerX11::DisableDevice(int deviceid) { |
826 blocked_devices_.set(deviceid, true); | 812 blocked_devices_.set(deviceid, true); |
827 // TODO(rsadam@): Support blocking touchscreen devices. | 813 // TODO(rsadam@): Support blocking touchscreen devices. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 } else { | 874 } else { |
889 keyboards.erase(it); | 875 keyboards.erase(it); |
890 ++blocked_iter; | 876 ++blocked_iter; |
891 } | 877 } |
892 } | 878 } |
893 // Notify base class of updated list. | 879 // Notify base class of updated list. |
894 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 880 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
895 } | 881 } |
896 | 882 |
897 } // namespace ui | 883 } // namespace ui |
OLD | NEW |