Commit 6c879fbd authored by yukishiino's avatar yukishiino Committed by Commit bot

Allows to fire VKEY_UNKNOWN key events.

On Linux, we have keys with keycode=VKEY_UNKNOWN, for example, ISO_LEVEL3_LATCH key.  We have to emit keydown/up events appropriately even if keycode=VKEY_UNKNOWN.

Just FYI: Firefox also fires keyevents with keycode=0, so the behavior will be compatible.  Compared to IE and Chrome on Windows, it's still compatible because there is no such key as ISO_LEVEL3_LATCH, etc. on Windows.

BUG=402320
TEST=Done manually.

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

Cr-Commit-Position: refs/heads/master@{#300438}
parent a2822d2f
......@@ -342,14 +342,14 @@ TEST_F(WindowEventDispatcherTest, CanProcessEventsWithinSubtree) {
w3->parent()->RemoveChild(w3.get());
}
TEST_F(WindowEventDispatcherTest, IgnoreUnknownKeys) {
TEST_F(WindowEventDispatcherTest, DontIgnoreUnknownKeys) {
ConsumeKeyHandler handler;
root_window()->AddPreTargetHandler(&handler);
ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, ui::EF_NONE);
DispatchEventUsingWindowDispatcher(&unknown_event);
EXPECT_FALSE(unknown_event.handled());
EXPECT_EQ(0, handler.num_key_events());
EXPECT_TRUE(unknown_event.handled());
EXPECT_EQ(1, handler.num_key_events());
handler.Reset();
ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
......
......@@ -104,10 +104,6 @@ ui::EventTarget* WindowTargeter::FindTargetForLocatedEvent(
Window* WindowTargeter::FindTargetForKeyEvent(Window* window,
const ui::KeyEvent& key) {
Window* root_window = window->GetRootWindow();
if (key.key_code() == ui::VKEY_UNKNOWN &&
(key.flags() & ui::EF_IME_FABRICATED_KEY) == 0 &&
key.GetCharacter() == 0)
return NULL;
client::FocusClient* focus_client = client::GetFocusClient(root_window);
Window* focused_window = focus_client->GetFocusedWindow();
if (!focused_window)
......
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