Chromium Code Reviews| Index: ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc |
| diff --git a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc |
| index 77043942b6dfd89c4c7bb3ee546f0db331b47c41..bfcdc209625acf73f3e72b280b3738137bc07c88 100644 |
| --- a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc |
| +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc |
| @@ -73,8 +73,7 @@ ScopedDisableInternalMouseAndKeyboardX11:: |
| last_mouse_location_(GetMouseLocationInScreen()) { |
| ui::DeviceDataManagerX11* device_data_manager = |
| - static_cast<ui::DeviceDataManagerX11*>( |
| - ui::DeviceDataManager::GetInstance()); |
| + ui::DeviceDataManagerX11::GetInstance(); |
| if (device_data_manager->IsXInput2Available()) { |
| const XIDeviceList& xi_dev_list = |
| ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList( |
| @@ -83,10 +82,15 @@ ScopedDisableInternalMouseAndKeyboardX11:: |
| std::string device_name(xi_dev_list[i].name); |
| base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name); |
| if (device_name == kInternalTouchpadName) { |
| - touchpad_device_id_ = xi_dev_list[i].deviceid; |
| - device_data_manager->DisableDevice(touchpad_device_id_); |
| - aura::client::GetCursorClient( |
| - Shell::GetInstance()->GetPrimaryRootWindow())->HideCursor(); |
| + if (device_data_manager->IsDeviceEnabled(xi_dev_list[i].deviceid)) { |
| + // If the touchpad is already disabled we will do nothing about it. |
| + // This will result in doing nothing in the destructor as well since |
| + // |touchpad_device_id_| will remain |kDeviceIdNone|. |
| + touchpad_device_id_ = xi_dev_list[i].deviceid; |
| + device_data_manager->DisableDevice(touchpad_device_id_); |
| + aura::client::GetCursorClient( |
| + Shell::GetInstance()->GetPrimaryRootWindow())->HideCursor(); |
|
oshima
2015/10/29 23:38:43
ditto
afakhry
2015/10/30 05:18:03
Done.
|
| + } |
| } else if (device_name == kCoreKeyboardName) { |
| core_keyboard_device_id_ = xi_dev_list[i].deviceid; |
| device_data_manager->DisableDevice(core_keyboard_device_id_); |
| @@ -118,8 +122,11 @@ ScopedDisableInternalMouseAndKeyboardX11:: |
| ui::DeviceDataManagerX11* device_data_manager = |
| static_cast<ui::DeviceDataManagerX11*>( |
| ui::DeviceDataManager::GetInstance()); |
| - if (touchpad_device_id_ != kDeviceIdNone) |
| + if (touchpad_device_id_ != kDeviceIdNone) { |
| device_data_manager->EnableDevice(touchpad_device_id_); |
| + aura::client::GetCursorClient( |
| + Shell::GetInstance()->GetPrimaryRootWindow())->ShowCursor(); |
| + } |
| if (keyboard_device_id_ != kDeviceIdNone) |
| device_data_manager->EnableDevice(keyboard_device_id_); |
| if (core_keyboard_device_id_ != kDeviceIdNone) |