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

Unified Diff: remoting/host/input_injector_x11.cc

Issue 2346643003: [Remoting Host] Handle text event characters that are not presented on the keyboard (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 3 months 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
Index: remoting/host/input_injector_x11.cc
diff --git a/remoting/host/input_injector_x11.cc b/remoting/host/input_injector_x11.cc
index 3c9d0a88fe17565532968acb8a2f348e25f0d80d..4738700f5843a7608190bae09dafa8da9b058beb 100644
--- a/remoting/host/input_injector_x11.cc
+++ b/remoting/host/input_injector_x11.cc
@@ -26,6 +26,7 @@
#include "remoting/host/clipboard.h"
#include "remoting/host/linux/unicode_to_keysym.h"
#include "remoting/host/linux/x11_util.h"
+#include "remoting/host/linux/x_server_key_mapper.h"
#include "remoting/proto/internal.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "ui/events/keycodes/dom/dom_code.h"
@@ -199,6 +200,8 @@ class InputInjectorX11 : public InputInjector {
std::unique_ptr<Clipboard> clipboard_;
+ std::unique_ptr<XServerKeyMapper> key_mapper_;
+
bool saved_auto_repeat_enabled_;
DISALLOW_COPY_AND_ASSIGN(Core);
@@ -367,8 +370,14 @@ void InputInjectorX11::Core::InjectTextEvent(const TextEvent& event) {
uint32_t keycode;
uint32_t modifiers;
- if (!FindKeycodeForUnicode(display_, code_point, &keycode, &modifiers))
- continue;
+ if (!FindKeycodeForUnicode(display_, code_point, &keycode, &modifiers)) {
+ int result = key_mapper_->AddNewCharacter(code_point);
Sergey Ulanov 2016/09/19 21:39:00 Does this work well when you inject a string of ch
Yuwei 2016/09/21 03:47:40 Done.
+ if (result < 0) {
+ continue;
+ }
+ keycode = result;
+ modifiers = 0;
+ }
XkbLockModifiers(display_, XkbUseCoreKbd, modifiers, modifiers);
@@ -634,6 +643,8 @@ void InputInjectorX11::Core::Start(
InitMouseButtonMap();
clipboard_->Start(std::move(client_clipboard));
+
+ key_mapper_.reset(new XServerKeyMapper(display_));
}
void InputInjectorX11::Core::Stop() {
@@ -643,6 +654,7 @@ void InputInjectorX11::Core::Stop() {
}
clipboard_.reset();
+ key_mapper_.reset();
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698