OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ozone/evdev/input_device_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/input.h> | 8 #include <linux/input.h> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Add initialized device to map. | 243 // Add initialized device to map. |
244 converters_[path] = converter.release(); | 244 converters_[path] = converter.release(); |
245 converters_[path]->Start(); | 245 converters_[path]->Start(); |
246 UpdateDirtyFlags(converters_[path]); | 246 UpdateDirtyFlags(converters_[path]); |
247 | 247 |
248 // Sync settings to new device. | 248 // Sync settings to new device. |
249 ApplyInputDeviceSettings(); | 249 ApplyInputDeviceSettings(); |
250 ApplyCapsLockLed(); | 250 ApplyCapsLockLed(); |
251 } | 251 } |
252 | 252 |
253 if (--pending_device_changes_ == 0) | 253 --pending_device_changes_; |
254 NotifyDevicesUpdated(); | 254 NotifyDevicesUpdated(); |
255 } | 255 } |
256 | 256 |
257 void InputDeviceFactoryEvdev::DetachInputDevice(const base::FilePath& path) { | 257 void InputDeviceFactoryEvdev::DetachInputDevice(const base::FilePath& path) { |
258 TRACE_EVENT1("evdev", "DetachInputDevice", "path", path.value()); | 258 TRACE_EVENT1("evdev", "DetachInputDevice", "path", path.value()); |
259 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 259 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
260 | 260 |
261 // Remove device from map. | 261 // Remove device from map. |
262 scoped_ptr<EventConverterEvdev> converter(converters_[path]); | 262 scoped_ptr<EventConverterEvdev> converter(converters_[path]); |
263 converters_.erase(path); | 263 converters_.erase(path); |
264 | 264 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 keyboard_list_dirty_ = true; | 398 keyboard_list_dirty_ = true; |
399 | 399 |
400 if (converter->HasMouse()) | 400 if (converter->HasMouse()) |
401 mouse_list_dirty_ = true; | 401 mouse_list_dirty_ = true; |
402 | 402 |
403 if (converter->HasTouchpad()) | 403 if (converter->HasTouchpad()) |
404 touchpad_list_dirty_ = true; | 404 touchpad_list_dirty_ = true; |
405 } | 405 } |
406 | 406 |
407 void InputDeviceFactoryEvdev::NotifyDevicesUpdated() { | 407 void InputDeviceFactoryEvdev::NotifyDevicesUpdated() { |
| 408 if (pending_device_changes_) |
| 409 return; // No update until pending opens complete. |
408 if (touchscreen_list_dirty_) | 410 if (touchscreen_list_dirty_) |
409 NotifyTouchscreensUpdated(); | 411 NotifyTouchscreensUpdated(); |
410 if (keyboard_list_dirty_) | 412 if (keyboard_list_dirty_) |
411 NotifyKeyboardsUpdated(); | 413 NotifyKeyboardsUpdated(); |
412 if (mouse_list_dirty_) | 414 if (mouse_list_dirty_) |
413 NotifyMouseDevicesUpdated(); | 415 NotifyMouseDevicesUpdated(); |
414 if (touchpad_list_dirty_) | 416 if (touchpad_list_dirty_) |
415 NotifyTouchpadDevicesUpdated(); | 417 NotifyTouchpadDevicesUpdated(); |
416 touchscreen_list_dirty_ = false; | 418 touchscreen_list_dirty_ = false; |
417 keyboard_list_dirty_ = false; | 419 keyboard_list_dirty_ = false; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 std::vector<int> ids; | 491 std::vector<int> ids; |
490 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 492 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
491 for (size_t i = 0; i < ids.size(); ++i) { | 493 for (size_t i = 0; i < ids.size(); ++i) { |
492 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 494 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
493 value); | 495 value); |
494 } | 496 } |
495 #endif | 497 #endif |
496 } | 498 } |
497 | 499 |
498 } // namespace ui | 500 } // namespace ui |
OLD | NEW |