| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 params.id, params.cursor, params.gesture_property_provider, | 94 params.id, params.cursor, params.gesture_property_provider, |
| 95 params.dispatcher)); | 95 params.dispatcher)); |
| 96 return make_scoped_ptr(new EventReaderLibevdevCros( | 96 return make_scoped_ptr(new EventReaderLibevdevCros( |
| 97 fd, params.path, params.id, type, devinfo, gesture_interp.Pass())); | 97 fd, params.path, params.id, type, devinfo, gesture_interp.Pass())); |
| 98 } | 98 } |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 // Touchscreen: use TouchEventConverterEvdev. | 101 // Touchscreen: use TouchEventConverterEvdev. |
| 102 if (devinfo.HasTouchscreen()) { | 102 if (devinfo.HasTouchscreen()) { |
| 103 scoped_ptr<TouchEventConverterEvdev> converter(new TouchEventConverterEvdev( | 103 scoped_ptr<TouchEventConverterEvdev> converter(new TouchEventConverterEvdev( |
| 104 fd, params.path, params.id, type, devinfo, params.dispatcher)); | 104 fd, params.path, params.id, type, params.dispatcher)); |
| 105 converter->Initialize(devinfo); | 105 converter->Initialize(devinfo); |
| 106 return converter.Pass(); | 106 return converter.Pass(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Graphics tablet | 109 // Graphics tablet |
| 110 if (devinfo.HasTablet()) | 110 if (devinfo.HasTablet()) |
| 111 return make_scoped_ptr<EventConverterEvdev>(new TabletEventConverterEvdev( | 111 return make_scoped_ptr<EventConverterEvdev>(new TabletEventConverterEvdev( |
| 112 fd, params.path, params.id, type, params.cursor, devinfo, | 112 fd, params.path, params.id, type, params.cursor, devinfo, |
| 113 params.dispatcher)); | 113 params.dispatcher)); |
| 114 | 114 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 touchscreen_list_dirty_ = false; | 416 touchscreen_list_dirty_ = false; |
| 417 keyboard_list_dirty_ = false; | 417 keyboard_list_dirty_ = false; |
| 418 mouse_list_dirty_ = false; | 418 mouse_list_dirty_ = false; |
| 419 touchpad_list_dirty_ = false; | 419 touchpad_list_dirty_ = false; |
| 420 } | 420 } |
| 421 | 421 |
| 422 void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() { | 422 void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() { |
| 423 std::vector<TouchscreenDevice> touchscreens; | 423 std::vector<TouchscreenDevice> touchscreens; |
| 424 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 424 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
| 425 if (it->second->HasTouchscreen()) { | 425 if (it->second->HasTouchscreen()) { |
| 426 touchscreens.push_back(TouchscreenDevice(it->second->input_device(), | 426 touchscreens.push_back(TouchscreenDevice( |
| 427 it->second->id(), it->second->type(), |
| 427 it->second->GetTouchscreenSize(), it->second->GetTouchPoints())); | 428 it->second->GetTouchscreenSize(), it->second->GetTouchPoints())); |
| 428 } | 429 } |
| 429 } | 430 } |
| 430 | 431 |
| 431 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); | 432 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); |
| 432 } | 433 } |
| 433 | 434 |
| 434 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { | 435 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { |
| 435 std::vector<KeyboardDevice> keyboards; | 436 std::vector<KeyboardDevice> keyboards; |
| 436 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 437 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
| 437 if (it->second->HasKeyboard()) { | 438 if (it->second->HasKeyboard()) { |
| 438 keyboards.push_back(KeyboardDevice(it->second->input_device())); | 439 keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type())); |
| 439 } | 440 } |
| 440 } | 441 } |
| 441 | 442 |
| 442 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); | 443 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); |
| 443 } | 444 } |
| 444 | 445 |
| 445 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { | 446 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { |
| 446 std::vector<InputDevice> mice; | 447 std::vector<InputDevice> mice; |
| 447 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 448 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
| 448 if (it->second->HasMouse()) { | 449 if (it->second->HasMouse()) |
| 449 mice.push_back(it->second->input_device()); | 450 mice.push_back(InputDevice(it->second->id(), it->second->type())); |
| 450 } | |
| 451 } | 451 } |
| 452 | 452 |
| 453 dispatcher_->DispatchMouseDevicesUpdated(mice); | 453 dispatcher_->DispatchMouseDevicesUpdated(mice); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() { | 456 void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() { |
| 457 std::vector<InputDevice> touchpads; | 457 std::vector<InputDevice> touchpads; |
| 458 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 458 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
| 459 if (it->second->HasTouchpad()) { | 459 if (it->second->HasTouchpad()) |
| 460 touchpads.push_back(it->second->input_device()); | 460 touchpads.push_back(InputDevice(it->second->id(), it->second->type())); |
| 461 } | |
| 462 } | 461 } |
| 463 | 462 |
| 464 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); | 463 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); |
| 465 } | 464 } |
| 466 | 465 |
| 467 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( | 466 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( |
| 468 const EventDeviceType type, | 467 const EventDeviceType type, |
| 469 const std::string& name, | 468 const std::string& name, |
| 470 int value) { | 469 int value) { |
| 471 #if defined(USE_EVDEV_GESTURES) | 470 #if defined(USE_EVDEV_GESTURES) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 489 std::vector<int> ids; | 488 std::vector<int> ids; |
| 490 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 489 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
| 491 for (size_t i = 0; i < ids.size(); ++i) { | 490 for (size_t i = 0; i < ids.size(); ++i) { |
| 492 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 491 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
| 493 value); | 492 value); |
| 494 } | 493 } |
| 495 #endif | 494 #endif |
| 496 } | 495 } |
| 497 | 496 |
| 498 } // namespace ui | 497 } // namespace ui |
| OLD | NEW |