Commit 40efb7c7 authored by spang's avatar spang Committed by Commit bot

ozone: evdev: Drop unmapped key events

In particular BTN_* events for the touchpad should not be dispatched as
keypresses. So just filter any presses that aren't mapped.

BUG=425617
TEST=manual on link_freon, events_unittests

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

Cr-Commit-Position: refs/heads/master@{#300559}
parent 826e7f6d
...@@ -354,3 +354,18 @@ TEST_F(KeyEventConverterEvdevTest, KeyWithLock) { ...@@ -354,3 +354,18 @@ TEST_F(KeyEventConverterEvdevTest, KeyWithLock) {
EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code()); EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code());
EXPECT_EQ(0, event->flags()); EXPECT_EQ(0, event->flags());
} }
TEST_F(KeyEventConverterEvdevTest, UnmappedKeyPress) {
ui::MockKeyEventConverterEvdev* dev = device();
struct input_event mock_kernel_queue[] = {
{{0, 0}, EV_KEY, BTN_TOUCH, 1},
{{0, 0}, EV_SYN, SYN_REPORT, 0},
{{0, 0}, EV_KEY, BTN_TOUCH, 0},
{{0, 0}, EV_SYN, SYN_REPORT, 0},
};
dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue));
EXPECT_EQ(0u, size());
}
...@@ -228,6 +228,9 @@ void KeyboardEvdev::DispatchKey(unsigned int key, bool down) { ...@@ -228,6 +228,9 @@ void KeyboardEvdev::DispatchKey(unsigned int key, bool down) {
ui::KeyboardCode code = KeyboardCodeFromEvdevKey(key); ui::KeyboardCode code = KeyboardCodeFromEvdevKey(key);
int flags = modifiers_->GetModifierFlags(); int flags = modifiers_->GetModifierFlags();
if (code == VKEY_UNKNOWN)
return;
callback_.Run(make_scoped_ptr(new KeyEvent( callback_.Run(make_scoped_ptr(new KeyEvent(
down ? ET_KEY_PRESSED : ET_KEY_RELEASED, down ? ET_KEY_PRESSED : ET_KEY_RELEASED,
code, code,
......
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