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

Unified Diff: components/view_manager/display_manager.cc

Issue 1234623004: mandoline: Fix character entry in html_viewer on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ifdef guard after skimming InputMethodWin. Created 5 years, 5 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
« no previous file with comments | « no previous file | mandoline/ui/aura/window_tree_host_mojo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/view_manager/display_manager.cc
diff --git a/components/view_manager/display_manager.cc b/components/view_manager/display_manager.cc
index cf3f113ac4f31c5c2810402a5b909d45ad2276f9..c3d1b23954e054b1fda9a67dcfdac9d2fcc21644 100644
--- a/components/view_manager/display_manager.cc
+++ b/components/view_manager/display_manager.cc
@@ -278,6 +278,39 @@ void DefaultDisplayManager::DispatchEvent(ui::Event* event) {
default:
break;
}
+
+#if defined(USE_X11)
+ // We want to emulate the WM_CHAR generation behaviour of Windows.
+ //
+ // On Linux, we've previously inserted characters by having
+ // InputMethodAuraLinux take all key down events and send a character event
+ // to the TextInputClient. This causes a mismatch in code that has to be
+ // shared between Windows and Linux, including blink code. Now that we're
+ // trying to have one way of doing things, we need to standardize on and
+ // emulate Windows character events.
+ //
+ // This is equivalent to what we're doing in the current Linux port, but
+ // done once instead of done multiple times in different places.
+ if (event->type() == ui::ET_KEY_PRESSED) {
+ ui::KeyEvent* key_press_event = static_cast<ui::KeyEvent*>(event);
+ ui::KeyEvent char_event(key_press_event->GetCharacter(),
+ key_press_event->key_code(),
+ key_press_event->flags());
+
+ DCHECK_EQ(key_press_event->GetCharacter(), char_event.GetCharacter());
+ DCHECK_EQ(key_press_event->key_code(), char_event.key_code());
+ DCHECK_EQ(key_press_event->flags(), char_event.flags());
+
+ char_event.SetExtendedKeyEventData(
+ make_scoped_ptr(new mojo::MojoExtendedKeyEventData(
+ key_press_event->GetLocatedWindowsKeyboardCode(),
+ key_press_event->GetText(),
+ key_press_event->GetUnmodifiedText())));
+ char_event.set_platform_keycode(key_press_event->platform_keycode());
+
+ delegate_->OnEvent(mojo::Event::From(char_event));
+ }
+#endif
}
void DefaultDisplayManager::OnCloseRequest() {
« no previous file with comments | « no previous file | mandoline/ui/aura/window_tree_host_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698