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, params.dispatcher)); | 104 fd, params.path, params.id, type, devinfo, 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( | 426 touchscreens.push_back(TouchscreenDevice(it->second->input_device(), |
427 it->second->id(), it->second->type(), | |
428 it->second->GetTouchscreenSize(), it->second->GetTouchPoints())); | 427 it->second->GetTouchscreenSize(), it->second->GetTouchPoints())); |
429 } | 428 } |
430 } | 429 } |
431 | 430 |
432 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); | 431 dispatcher_->DispatchTouchscreenDevicesUpdated(touchscreens); |
433 } | 432 } |
434 | 433 |
435 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { | 434 void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() { |
436 std::vector<KeyboardDevice> keyboards; | 435 std::vector<KeyboardDevice> keyboards; |
437 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 436 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
438 if (it->second->HasKeyboard()) { | 437 if (it->second->HasKeyboard()) { |
439 keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type())); | 438 keyboards.push_back(KeyboardDevice(it->second->input_device())); |
440 } | 439 } |
441 } | 440 } |
442 | 441 |
443 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); | 442 dispatcher_->DispatchKeyboardDevicesUpdated(keyboards); |
444 } | 443 } |
445 | 444 |
446 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { | 445 void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() { |
447 std::vector<InputDevice> mice; | 446 std::vector<InputDevice> mice; |
448 for (auto it = converters_.begin(); it != converters_.end(); ++it) { | 447 for (auto it = converters_.begin(); it != converters_.end(); ++it) { |
449 if (it->second->HasMouse()) | 448 if (it->second->HasMouse()) { |
450 mice.push_back(InputDevice(it->second->id(), it->second->type())); | 449 mice.push_back(it->second->input_device()); |
| 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(InputDevice(it->second->id(), it->second->type())); | 460 touchpads.push_back(it->second->input_device()); |
| 461 } |
461 } | 462 } |
462 | 463 |
463 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); | 464 dispatcher_->DispatchTouchpadDevicesUpdated(touchpads); |
464 } | 465 } |
465 | 466 |
466 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( | 467 void InputDeviceFactoryEvdev::SetIntPropertyForOneType( |
467 const EventDeviceType type, | 468 const EventDeviceType type, |
468 const std::string& name, | 469 const std::string& name, |
469 int value) { | 470 int value) { |
470 #if defined(USE_EVDEV_GESTURES) | 471 #if defined(USE_EVDEV_GESTURES) |
(...skipping 17 matching lines...) Expand all Loading... |
488 std::vector<int> ids; | 489 std::vector<int> ids; |
489 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 490 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
490 for (size_t i = 0; i < ids.size(); ++i) { | 491 for (size_t i = 0; i < ids.size(); ++i) { |
491 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 492 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
492 value); | 493 value); |
493 } | 494 } |
494 #endif | 495 #endif |
495 } | 496 } |
496 | 497 |
497 } // namespace ui | 498 } // namespace ui |
OLD | NEW |