| Index: chrome/browser/chromeos/system/input_device_settings_impl_x11.cc
|
| diff --git a/chrome/browser/chromeos/system/input_device_settings_impl_x11.cc b/chrome/browser/chromeos/system/input_device_settings_impl_x11.cc
|
| index b9be3aa079b6ff5f639939abf60e45f03c6e3a4b..21674039392c06f2bad61b8e7553901b77e289b3 100644
|
| --- a/chrome/browser/chromeos/system/input_device_settings_impl_x11.cc
|
| +++ b/chrome/browser/chromeos/system/input_device_settings_impl_x11.cc
|
| @@ -22,6 +22,10 @@
|
| #include "base/task_runner.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "ui/events/base_event_utils.h"
|
| +#include "ui/events/devices/x11/device_data_manager_x11.h"
|
| +#include "ui/events/devices/x11/device_list_cache_x11.h"
|
| +#include "ui/gfx/x/x11_types.h"
|
|
|
| namespace chromeos {
|
| namespace system {
|
| @@ -35,6 +39,9 @@ const char kDeviceTypeTouchpad[] = "touchpad";
|
| const char kDeviceTypeMouse[] = "mouse";
|
| const char kInputControl[] = "/opt/google/input/inputcontrol";
|
|
|
| +// The name of the xinput device corresponding to the internal touchpad.
|
| +const char kInternalTouchpadName[] = "Elan Touchpad";
|
| +
|
| typedef base::RefCountedData<bool> RefCountedBool;
|
|
|
| bool ScriptExists(const std::string& script) {
|
| @@ -160,6 +167,8 @@ class InputDeviceSettingsImplX11 : public InputDeviceSettings {
|
| void SetPrimaryButtonRight(bool right) override;
|
| void ReapplyTouchpadSettings() override;
|
| void ReapplyMouseSettings() override;
|
| + void SetInternalTouchpadEnabled(bool enabled) override;
|
| + void SetTouchscreensEnabled(bool enabled) override;
|
|
|
| // Generate arguments for the inputcontrol script.
|
| //
|
| @@ -261,6 +270,33 @@ void InputDeviceSettingsImplX11::ReapplyMouseSettings() {
|
| UpdateMouseSettings(settings);
|
| }
|
|
|
| +void InputDeviceSettingsImplX11::SetInternalTouchpadEnabled(bool enabled) {
|
| + ui::DeviceDataManagerX11* device_data_manager =
|
| + ui::DeviceDataManagerX11::GetInstance();
|
| + if (!device_data_manager->IsXInput2Available())
|
| + return;
|
| +
|
| + const XIDeviceList& xi_dev_list =
|
| + ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(
|
| + gfx::GetXDisplay());
|
| + for (int i = 0; i < xi_dev_list.count; ++i) {
|
| + std::string device_name(xi_dev_list[i].name);
|
| + base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name);
|
| + if (device_name == kInternalTouchpadName) {
|
| + if (enabled)
|
| + device_data_manager->EnableDevice(xi_dev_list[i].deviceid);
|
| + else
|
| + device_data_manager->DisableDevice(xi_dev_list[i].deviceid);
|
| +
|
| + return;
|
| + }
|
| + }
|
| +}
|
| +
|
| +void InputDeviceSettingsImplX11::SetTouchscreensEnabled(bool enabled) {
|
| + ui::SetTouchEventsEnabled(enabled);
|
| +}
|
| +
|
| void InputDeviceSettingsImplX11::GenerateTouchpadArguments(
|
| std::vector<std::string>* argv) {
|
| argv->push_back(kInputControl);
|
|
|