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 "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "ui/base/glib/glib_integers.h" | 11 #include "ui/base/glib/glib_integers.h" |
12 #include "ui/base/glib/glib_signal.h" | 12 #include "ui/base/glib/glib_signal.h" |
13 #include "ui/base/ime/linux/linux_input_method_context.h" | 13 #include "ui/base/ime/linux/linux_input_method_context.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 | 15 |
| 16 typedef struct _GdkDrawable GdkWindow; |
16 typedef struct _GtkIMContext GtkIMContext; | 17 typedef struct _GtkIMContext GtkIMContext; |
17 | 18 |
18 namespace libgtk2ui { | 19 namespace libgtk2ui { |
19 | 20 |
20 // An implementation of LinuxInputMethodContext which is based on X11 event loop | 21 // An implementation of LinuxInputMethodContext which is based on X11 event loop |
21 // and uses GtkIMContext(gtk-immodule) as a bridge from/to underlying IMEs. | 22 // and uses GtkIMContext(gtk-immodule) as a bridge from/to underlying IMEs. |
22 class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext { | 23 class X11InputMethodContextImplGtk2 : public ui::LinuxInputMethodContext { |
23 public: | 24 public: |
24 explicit X11InputMethodContextImplGtk2( | 25 explicit X11InputMethodContextImplGtk2( |
25 ui::LinuxInputMethodContextDelegate* delegate); | 26 ui::LinuxInputMethodContextDelegate* delegate); |
(...skipping 27 matching lines...) Expand all Loading... |
53 // IME's input context used for TEXT_INPUT_TYPE_NONE and | 54 // IME's input context used for TEXT_INPUT_TYPE_NONE and |
54 // TEXT_INPUT_TYPE_PASSWORD. | 55 // TEXT_INPUT_TYPE_PASSWORD. |
55 GtkIMContext* gtk_context_simple_; | 56 GtkIMContext* gtk_context_simple_; |
56 // IME's input context used for the other text input types. | 57 // IME's input context used for the other text input types. |
57 GtkIMContext* gtk_multicontext_; | 58 GtkIMContext* gtk_multicontext_; |
58 | 59 |
59 // An alias to |gtk_context_simple_| or |gtk_multicontext_| depending on the | 60 // An alias to |gtk_context_simple_| or |gtk_multicontext_| depending on the |
60 // text input type. Can be NULL when it's not focused. | 61 // text input type. Can be NULL when it's not focused. |
61 GtkIMContext* gtk_context_; | 62 GtkIMContext* gtk_context_; |
62 | 63 |
| 64 // Last set client window. |
| 65 GdkWindow* gdk_last_set_client_window_; |
| 66 |
63 // Last known caret bounds relative to the screen coordinates. | 67 // Last known caret bounds relative to the screen coordinates. |
64 gfx::Rect last_caret_bounds_; | 68 gfx::Rect last_caret_bounds_; |
65 | 69 |
66 // A set of hardware keycodes of modifier keys. | 70 // A set of hardware keycodes of modifier keys. |
67 base::hash_set<unsigned int> modifier_keycodes_; | 71 base::hash_set<unsigned int> modifier_keycodes_; |
68 | 72 |
69 // The helper class to trap GTK+'s "commit" signal for direct input key | 73 // The helper class to trap GTK+'s "commit" signal for direct input key |
70 // events. | 74 // events. |
71 // | 75 // |
72 // gtk_im_context_filter_keypress() emits "commit" signal in order to insert | 76 // gtk_im_context_filter_keypress() emits "commit" signal in order to insert |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 109 |
106 FRIEND_TEST_ALL_PREFIXES(X11InputMethodContextImplGtk2FriendTest, | 110 FRIEND_TEST_ALL_PREFIXES(X11InputMethodContextImplGtk2FriendTest, |
107 GtkCommitSignalTrap); | 111 GtkCommitSignalTrap); |
108 | 112 |
109 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); | 113 DISALLOW_COPY_AND_ASSIGN(X11InputMethodContextImplGtk2); |
110 }; | 114 }; |
111 | 115 |
112 } // namespace libgtk2ui | 116 } // namespace libgtk2ui |
113 | 117 |
114 #endif // CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ | 118 #endif // CHROME_BROWSER_UI_LIBGTK2UI_X11_INPUT_METHOD_CONTEXT_IMPL_GTK2_H_ |
OLD | NEW |