| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( | 804 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( |
| 805 scoped_ptr<std::set<KeyboardCode> > excepted_keys) { | 805 std::unique_ptr<std::set<KeyboardCode>> excepted_keys) { |
| 806 DCHECK(!excepted_keys.get() || | 806 DCHECK(!excepted_keys.get() || |
| 807 !blocked_keyboard_allowed_keys_.get()); | 807 !blocked_keyboard_allowed_keys_.get()); |
| 808 blocked_keyboard_allowed_keys_ = std::move(excepted_keys); | 808 blocked_keyboard_allowed_keys_ = std::move(excepted_keys); |
| 809 } | 809 } |
| 810 | 810 |
| 811 void DeviceDataManagerX11::DisableDevice(int deviceid) { | 811 void DeviceDataManagerX11::DisableDevice(int deviceid) { |
| 812 blocked_devices_.set(deviceid, true); | 812 blocked_devices_.set(deviceid, true); |
| 813 // TODO(rsadam@): Support blocking touchscreen devices. | 813 // TODO(rsadam@): Support blocking touchscreen devices. |
| 814 std::vector<KeyboardDevice> keyboards = keyboard_devices(); | 814 std::vector<KeyboardDevice> keyboards = keyboard_devices(); |
| 815 std::vector<KeyboardDevice>::iterator it = | 815 std::vector<KeyboardDevice>::iterator it = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } else { | 874 } else { |
| 875 keyboards.erase(it); | 875 keyboards.erase(it); |
| 876 ++blocked_iter; | 876 ++blocked_iter; |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 // Notify base class of updated list. | 879 // Notify base class of updated list. |
| 880 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 880 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
| 881 } | 881 } |
| 882 | 882 |
| 883 } // namespace ui | 883 } // namespace ui |
| OLD | NEW |