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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 NotifyTouchpadDevicesUpdated(); | 433 NotifyTouchpadDevicesUpdated(); |
434 } | 434 } |
435 | 435 |
436 void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() { | 436 void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() { |
437 std::vector<TouchscreenDevice> touchscreens; | 437 std::vector<TouchscreenDevice> touchscreens; |
438 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 438 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
439 if (it->second->HasTouchscreen()) { | 439 if (it->second->HasTouchscreen()) { |
440 // TODO(spang): Extract the number of touch-points supported by the | 440 // TODO(spang): Extract the number of touch-points supported by the |
441 // device. | 441 // device. |
442 const int touch_points = 11; | 442 const int touch_points = 11; |
443 touchscreens.push_back(TouchscreenDevice( | 443 touchscreens.push_back( |
444 it->second->id(), it->second->type(), std::string() /* Device name */, | 444 TouchscreenDevice(it->second->id(), it->second->type(), |
445 it->second->GetTouchscreenSize(), touch_points)); | 445 it->second->GetTouchscreenSize(), touch_points)); |
446 } | 446 } |
447 } | 447 } |
448 | 448 |
449 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); | 449 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); |
450 } | 450 } |
451 | 451 |
452 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { | 452 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { |
453 std::vector<KeyboardDevice> keyboards; | 453 std::vector<KeyboardDevice> keyboards; |
454 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 454 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
455 if (it->second->HasKeyboard()) { | 455 if (it->second->HasKeyboard()) { |
456 keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type(), | 456 keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type())); |
457 std::string() /* Device name */)); | |
458 } | 457 } |
459 } | 458 } |
460 | 459 |
461 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); | 460 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); |
462 } | 461 } |
463 | 462 |
464 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { | 463 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { |
465 std::vector<InputDevice> mice; | 464 std::vector<InputDevice> mice; |
466 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 465 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
467 if (it->second->HasMouse()) { | 466 if (it->second->HasMouse()) |
468 mice.push_back(InputDevice(it->second->id(), it->second->type(), | 467 mice.push_back(InputDevice(it->second->id(), it->second->type())); |
469 std::string() /* Device name */)); | |
470 } | |
471 } | 468 } |
472 | 469 |
473 dispatcher_->DispatchMouseDevicesUpdated(mice); | 470 dispatcher_->DispatchMouseDevicesUpdated(mice); |
474 } | 471 } |
475 | 472 |
476 void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() { | 473 void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() { |
477 std::vector<InputDevice> touchpads; | 474 std::vector<InputDevice> touchpads; |
478 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 475 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
479 if (it->second->HasTouchpad()) { | 476 if (it->second->HasTouchpad()) |
480 touchpads.push_back(InputDevice(it->second->id(), it->second->type(), | 477 touchpads.push_back(InputDevice(it->second->id(), it->second->type())); |
481 std::string() /* Device name */)); | |
482 } | |
483 } | 478 } |
484 | 479 |
485 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); | 480 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); |
486 } | 481 } |
487 | 482 |
488 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( | 483 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( |
489 const EventDeviceType type, | 484 const EventDeviceType type, |
490 const std::string& name, | 485 const std::string& name, |
491 int value) { | 486 int value) { |
492 #if defined(USE_EVDEV_GESTURES) | 487 #if defined(USE_EVDEV_GESTURES) |
(...skipping 17 matching lines...) Expand all Loading... |
510 std::vector<int> ids; | 505 std::vector<int> ids; |
511 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 506 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
512 for (size_t i = 0; i < ids.size(); ++i) { | 507 for (size_t i = 0; i < ids.size(); ++i) { |
513 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 508 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
514 value); | 509 value); |
515 } | 510 } |
516 #endif | 511 #endif |
517 } | 512 } |
518 | 513 |
519 } // namespace ui | 514 } // namespace ui |
OLD | NEW |