diff options
author | sergeyu <sergeyu@chromium.org> | 2014-12-22 16:57:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-23 00:58:39 +0000 |
commit | 90253bddc46a12973aee4c863dca037a29b4a1ed (patch) | |
tree | b038f55df8e663f176747ec06e97161d2f1df85f /remoting/host/input_injector_x11.cc | |
parent | 50987629a2312b2fef3ab54ae177fed3d42f5c58 (diff) | |
download | chromium_src-90253bddc46a12973aee4c863dca037a29b4a1ed.zip chromium_src-90253bddc46a12973aee4c863dca037a29b4a1ed.tar.gz chromium_src-90253bddc46a12973aee4c863dca037a29b4a1ed.tar.bz2 |
Fix input injector on Linux to release all keys before injecting text event.
When '<' and '>' Android keyboard generates KEYCODE_SHIFT_LEFT followed by
KEYCODE_COMMA or KEYCODE_PERIOD. Android client sends shift event as a key
event and then the actual character is sent as a text event. As result
when the input injector tries to inject text event shift key is pressed
and as result injected keys are not interpreted correctly. Fixed input
injector to release all keys before trying to inject text events.
BUG=407463
Review URL: https://codereview.chromium.org/806223008
Cr-Commit-Position: refs/heads/master@{#309508}
Diffstat (limited to 'remoting/host/input_injector_x11.cc')
-rw-r--r-- | remoting/host/input_injector_x11.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/remoting/host/input_injector_x11.cc b/remoting/host/input_injector_x11.cc index 1852e9f..55690da 100644 --- a/remoting/host/input_injector_x11.cc +++ b/remoting/host/input_injector_x11.cc @@ -327,6 +327,14 @@ void InputInjectorX11::Core::InjectTextEvent(const TextEvent& event) { return; } + // Release all keys before injecting text event. This is necessary to avoid + // any interference with the currently pressed keys. E.g. if Shift is pressed + // when TextEvent is received. + for (int key : pressed_keys_) { + XTestFakeKeyEvent(display_, key, False, CurrentTime); + } + pressed_keys_.clear(); + const std::string text = event.text(); for (int32 index = 0; index < static_cast<int32>(text.size()); ++index) { uint32_t code_point; |