summaryrefslogtreecommitdiffstats
path: root/mandoline
diff options
context:
space:
mode:
authorsky <sky@chromium.org>2015-08-03 14:57:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-03 21:58:30 +0000
commita6029a4c1483a0cdf9501b012b62bb324f28fd34 (patch)
tree5ecfdee3320770ca9405215eee7178fb275ce087 /mandoline
parentdc957e1a0229bd9b4764f74707b28672ae7f50bb (diff)
downloadchromium_src-a6029a4c1483a0cdf9501b012b62bb324f28fd34.zip
chromium_src-a6029a4c1483a0cdf9501b012b62bb324f28fd34.tar.gz
chromium_src-a6029a4c1483a0cdf9501b012b62bb324f28fd34.tar.bz2
Fixes keyboard input
Recent IME changes mean we have to dispatch the event in NativeWidgetViewManager (see DesktopWindowTreeHostX11::DispatchKeyEvent for similar code). BUG=516460 TEST=none R=erg@chromium.org Review URL: https://codereview.chromium.org/1269133003 Cr-Commit-Position: refs/heads/master@{#341627}
Diffstat (limited to 'mandoline')
-rw-r--r--mandoline/ui/aura/input_method_mandoline.cc4
-rw-r--r--mandoline/ui/aura/native_widget_view_manager.cc12
-rw-r--r--mandoline/ui/aura/native_widget_view_manager.h2
3 files changed, 12 insertions, 6 deletions
diff --git a/mandoline/ui/aura/input_method_mandoline.cc b/mandoline/ui/aura/input_method_mandoline.cc
index 3ab9203..f1b510b 100644
--- a/mandoline/ui/aura/input_method_mandoline.cc
+++ b/mandoline/ui/aura/input_method_mandoline.cc
@@ -41,9 +41,7 @@ bool InputMethodMandoline::DispatchKeyEvent(const ui::KeyEvent& event) {
// character event, we instead check to see if this is a character event and
// send out the key if it is. (We fallback to normal dispatch if it isn't.)
if (event.is_char()) {
- const uint16 ch = event.GetCharacter();
- if (GetTextInputClient())
- GetTextInputClient()->InsertChar(ch, event.flags());
+ GetTextInputClient()->InsertChar(event.GetCharacter(), event.flags());
return false;
}
diff --git a/mandoline/ui/aura/native_widget_view_manager.cc b/mandoline/ui/aura/native_widget_view_manager.cc
index 0af2b37..cdc03b3 100644
--- a/mandoline/ui/aura/native_widget_view_manager.cc
+++ b/mandoline/ui/aura/native_widget_view_manager.cc
@@ -102,9 +102,17 @@ void NativeWidgetViewManager::OnViewFocusChanged(mojo::View* gained_focus,
void NativeWidgetViewManager::OnViewInputEvent(mojo::View* view,
const mojo::EventPtr& event) {
- scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >());
- if (ui_event)
+ scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>());
+ if (!ui_event)
+ return;
+
+ if (ui_event->IsKeyEvent()) {
+ window_tree_host_->GetInputMethod()->DispatchKeyEvent(
+ *static_cast<ui::KeyEvent*>(ui_event.get()));
+ ui_event->StopPropagation();
+ } else {
window_tree_host_->SendEventToProcessor(ui_event.get());
+ }
}
} // namespace mandoline
diff --git a/mandoline/ui/aura/native_widget_view_manager.h b/mandoline/ui/aura/native_widget_view_manager.h
index 8042b08..3841f03 100644
--- a/mandoline/ui/aura/native_widget_view_manager.h
+++ b/mandoline/ui/aura/native_widget_view_manager.h
@@ -33,7 +33,7 @@ namespace mandoline {
class WindowTreeHostMojo;
class NativeWidgetViewManager : public views::NativeWidgetAura,
- public mojo::ViewObserver {
+ public mojo::ViewObserver {
public:
NativeWidgetViewManager(views::internal::NativeWidgetDelegate* delegate,
mojo::Shell* shell,