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