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

Side by Side Diff: mandoline/ui/aura/input_method_mojo_linux.cc

Issue 1123643007: Restore aura support from Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mandoline/ui/aura/input_method_mojo_linux.h"
6
7 #include "ui/base/ime/text_input_client.h"
8 #include "ui/events/event.h"
9
10 namespace mandoline {
11
12 InputMethodMojoLinux::InputMethodMojoLinux(
13 ui::internal::InputMethodDelegate* delegate)
14 : ui::InputMethodAuraLinux(delegate) {
15 }
16
17 InputMethodMojoLinux::~InputMethodMojoLinux() {}
18
19 bool InputMethodMojoLinux::DispatchKeyEvent(const ui::KeyEvent& event) {
20 DCHECK(event.type() == ui::ET_KEY_PRESSED ||
21 event.type() == ui::ET_KEY_RELEASED);
22 DCHECK(system_toplevel_window_focused());
23
24 // If no text input client, do nothing.
25 if (!GetTextInputClient())
26 return DispatchKeyEventPostIME(event);
27
28 // Here is where we change the differ from our base class's logic. Instead of
29 // always dispatching a key down event, and then sending a synthesized
30 // character event, we instead check to see if this is a character event and
31 // send out the key if it is. (We fallback to normal dispatch if it isn't.)
32 if (event.is_char()) {
33 const uint16 ch = event.GetCharacter();
34 if (GetTextInputClient())
35 GetTextInputClient()->InsertChar(ch, event.flags());
36
37 return false;
38 }
39
40 return DispatchKeyEventPostIME(event);
41 }
42
43 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/ui/aura/input_method_mojo_linux.h ('k') | mandoline/ui/aura/native_widget_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698