OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ |
6 #define CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ | 6 #define CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 typedef struct _GtkIMContext GtkIMContext; | 21 typedef struct _GtkIMContext GtkIMContext; |
22 | 22 |
23 namespace libgtk2ui { | 23 namespace libgtk2ui { |
24 | 24 |
25 // An implementation of LinuxInputMethodContext which is based on X11 event loop | 25 // An implementation of LinuxInputMethodContext which is based on X11 event loop |
26 // and uses GtkIMContext(gtk-immodule) as a bridge from/to underlying IMEs. | 26 // and uses GtkIMContext(gtk-immodule) as a bridge from/to underlying IMEs. |
27 class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext { | 27 class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext { |
28 public: | 28 public: |
29 explicit X11InputMethodContextImplGtk2( | 29 explicit X11InputMethodContextImplGtk2( |
30 ui::LinuxInputMethodContextDelegate* delegate); | 30 ui::LinuxInputMethodContextDelegate* delegate); |
31 virtual ~X11InputMethodContextImplGtk2(); | 31 ~X11InputMethodContextImplGtk2() override; |
32 | 32 |
33 // Overriden from ui::LinuxInputMethodContext | 33 // Overriden from ui::LinuxInputMethodContext |
34 virtual bool DispatchKeyEvent(const ui::KeyEvent& key_event) override; | 34 bool DispatchKeyEvent(const ui::KeyEvent& key_event) override; |
35 virtual void Reset() override; | 35 void Reset() override; |
36 virtual void OnTextInputTypeChanged(ui::TextInputType text_input_type) | 36 void OnTextInputTypeChanged(ui::TextInputType text_input_type) override; |
37 override; | 37 void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override; |
38 virtual void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override; | |
39 | 38 |
40 private: | 39 private: |
41 // Resets the cache of X modifier keycodes. | 40 // Resets the cache of X modifier keycodes. |
42 // TODO(yukishiino): We should call this method whenever X keyboard mapping | 41 // TODO(yukishiino): We should call this method whenever X keyboard mapping |
43 // changes, for example when a user switched to another keyboard layout. | 42 // changes, for example when a user switched to another keyboard layout. |
44 void ResetXModifierKeycodesCache(); | 43 void ResetXModifierKeycodesCache(); |
45 | 44 |
46 // Constructs a GdkEventKey from a XKeyEvent and returns it. Otherwise, | 45 // Constructs a GdkEventKey from a XKeyEvent and returns it. Otherwise, |
47 // returns NULL. The returned GdkEvent must be freed by gdk_event_free. | 46 // returns NULL. The returned GdkEvent must be freed by gdk_event_free. |
48 GdkEvent* GdkEventFromNativeEvent(const base::NativeEvent& native_event); | 47 GdkEvent* GdkEventFromNativeEvent(const base::NativeEvent& native_event); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 133 |
135 FRIEND_TEST_ALL_PREFIXES(X11InputMethodContextImplGtk2FriendTest, | 134 FRIEND_TEST_ALL_PREFIXES(X11InputMethodContextImplGtk2FriendTest, |
136 GtkCommitSignalTrap); | 135 GtkCommitSignalTrap); |
137 | 136 |
138 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); | 137 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); |
139 }; | 138 }; |
140 | 139 |
141 } // namespace libgtk2ui | 140 } // namespace libgtk2ui |
142 | 141 |
143 #endif // CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ | 142 #endif // CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ |
OLD | NEW |