Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: remoting/host/input_injector_x11.cc

Issue 806223008: Fix input injector on Linux to release all keys before injecting text event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/input_injector_x11.cc
diff --git a/remoting/host/input_injector_x11.cc b/remoting/host/input_injector_x11.cc
index 1852e9fabc50ab43f2b8ca516d3e752f3674eb7c..54f416abda7187a5e56445e9cf62ef837bfa5143 100644
--- a/remoting/host/input_injector_x11.cc
+++ b/remoting/host/input_injector_x11.cc
@@ -327,6 +327,15 @@ 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 (std::set<int>::iterator it = pressed_keys_.begin();
Lambros 2014/12/22 23:05:11 nit: Prefer const_iterator Could use C++11 here: f
Sergey Ulanov 2014/12/23 00:13:28 Done.
+ it != pressed_keys_.end(); ++it) {
+ XTestFakeKeyEvent(display_, *it, 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698