Commit 892bc4bb authored by flackr@chromium.org's avatar flackr@chromium.org

Disable core keyboard device as well when entering touchview.

Repeated keypress events seem to be coming from the core keyboard device for the internal keyboard. Amazingly, they seem to come from the correct device (for my external keyboard at least) so this patch may be all we need.

BUG=402868
TEST=Flip open device past 180 to enter touchview. Hold a key on keyboard. Key is not typed. External keyboard still works while in touchview.

Review URL: https://codereview.chromium.org/460093003

Cr-Commit-Position: refs/heads/master@{#289524}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289524 0039d316-1c4b-4281-b951-d872f2087c98
parent 283bd830
...@@ -36,6 +36,10 @@ const char kInternalTouchpadName[] = "Elan Touchpad"; ...@@ -36,6 +36,10 @@ const char kInternalTouchpadName[] = "Elan Touchpad";
// The name of the xinput device corresponding to the internal keyboard. // The name of the xinput device corresponding to the internal keyboard.
const char kInternalKeyboardName[] = "AT Translated Set 2 keyboard"; const char kInternalKeyboardName[] = "AT Translated Set 2 keyboard";
// Repeated key events have their source set to the core keyboard device.
// These must be disabled also until http://crbug.com/402898 is resolved.
const char kCoreKeyboardName[] = "Virtual core keyboard";
// Device id used to indicate that a device has not been detected. // Device id used to indicate that a device has not been detected.
const int kDeviceIdNone = -1; const int kDeviceIdNone = -1;
...@@ -64,6 +68,7 @@ ScopedDisableInternalMouseAndKeyboardX11:: ...@@ -64,6 +68,7 @@ ScopedDisableInternalMouseAndKeyboardX11::
ScopedDisableInternalMouseAndKeyboardX11() ScopedDisableInternalMouseAndKeyboardX11()
: touchpad_device_id_(kDeviceIdNone), : touchpad_device_id_(kDeviceIdNone),
keyboard_device_id_(kDeviceIdNone), keyboard_device_id_(kDeviceIdNone),
core_keyboard_device_id_(kDeviceIdNone),
last_mouse_location_(GetMouseLocationInScreen()) { last_mouse_location_(GetMouseLocationInScreen()) {
ui::DeviceDataManagerX11* device_data_manager = ui::DeviceDataManagerX11* device_data_manager =
...@@ -81,6 +86,9 @@ ScopedDisableInternalMouseAndKeyboardX11:: ...@@ -81,6 +86,9 @@ ScopedDisableInternalMouseAndKeyboardX11::
} else if (device_name == kInternalKeyboardName) { } else if (device_name == kInternalKeyboardName) {
keyboard_device_id_ = xi_dev_list[i].deviceid; keyboard_device_id_ = xi_dev_list[i].deviceid;
device_data_manager->DisableDevice(keyboard_device_id_); device_data_manager->DisableDevice(keyboard_device_id_);
} else if (device_name == kCoreKeyboardName) {
core_keyboard_device_id_ = xi_dev_list[i].deviceid;
device_data_manager->DisableDevice(core_keyboard_device_id_);
} }
} }
} }
...@@ -104,6 +112,8 @@ ScopedDisableInternalMouseAndKeyboardX11:: ...@@ -104,6 +112,8 @@ ScopedDisableInternalMouseAndKeyboardX11::
device_data_manager->EnableDevice(touchpad_device_id_); device_data_manager->EnableDevice(touchpad_device_id_);
if (keyboard_device_id_ != kDeviceIdNone) if (keyboard_device_id_ != kDeviceIdNone)
device_data_manager->EnableDevice(keyboard_device_id_); device_data_manager->EnableDevice(keyboard_device_id_);
if (core_keyboard_device_id_ != kDeviceIdNone)
device_data_manager->EnableDevice(core_keyboard_device_id_);
device_data_manager->SetDisabledKeyboardAllowedKeys( device_data_manager->SetDisabledKeyboardAllowedKeys(
scoped_ptr<std::set<ui::KeyboardCode> >()); scoped_ptr<std::set<ui::KeyboardCode> >());
ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this); ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
......
...@@ -30,6 +30,7 @@ class ScopedDisableInternalMouseAndKeyboardX11 ...@@ -30,6 +30,7 @@ class ScopedDisableInternalMouseAndKeyboardX11
private: private:
int touchpad_device_id_; int touchpad_device_id_;
int keyboard_device_id_; int keyboard_device_id_;
int core_keyboard_device_id_;
// Tracks the last known mouse cursor location caused before blocking the // Tracks the last known mouse cursor location caused before blocking the
// internal touchpad or caused by an external mouse. // internal touchpad or caused by an external mouse.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment